in squangle/mysql_client/Operation.cpp [1440:1489]
void FetchOperation::specializedCompleteOperation() {
// Stats for query
if (result_ == OperationResult::Succeeded) {
// set last successful query time to MysqlConnectionHolder
conn()->setLastActivityTime(chrono::steady_clock::now());
db::QueryLoggingData logging_data(
getOperationType(),
elapsed(),
num_queries_executed_,
rendered_query_.toString(),
rows_received_,
total_result_size_,
no_index_used_,
use_checksum_ || conn()->getConnectionOptions().getUseChecksum(),
attributes_,
readResponseAttributes());
client()->logQuerySuccess(logging_data, *conn().get());
} else {
db::FailureReason reason = db::FailureReason::DATABASE_ERROR;
if (result_ == OperationResult::Cancelled) {
reason = db::FailureReason::CANCELLED;
} else if (result_ == OperationResult::TimedOut) {
reason = db::FailureReason::TIMEOUT;
}
client()->logQueryFailure(
db::QueryLoggingData(
getOperationType(),
elapsed(),
num_queries_executed_,
rendered_query_.toString(),
rows_received_,
total_result_size_,
no_index_used_,
use_checksum_ || conn()->getConnectionOptions().getUseChecksum(),
{},
readResponseAttributes()),
reason,
mysql_errno(),
mysql_error(),
*conn().get());
}
if (result_ != OperationResult::Succeeded) {
notifyFailure(result_);
}
// This frees the `Operation::wait()` call. We need to free it here because
// callback can stealConnection and we can't notify anymore.
conn()->notify();
notifyOperationCompleted(result_);
}