Prevent client profiling maintenance from profiling itself

This commit is contained in:
Trevor Clinkenbeard 2026-07-27 13:03:21 -07:00
parent 8632b283ef
commit 971d883db7
1 changed files with 8 additions and 2 deletions

View File

@ -616,13 +616,19 @@ struct TrInfoChunk {
static const Key CLIENT_LATENCY_INFO_PREFIX = "client_latency/"_sr;
static const Key CLIENT_LATENCY_INFO_CTR_PREFIX = "client_latency_counter/"_sr;
static void resetClientStatusTransaction(Transaction* tr) {
tr->reset();
// Profiling maintenance must not generate more records for itself to persist.
tr->trState->trLogInfo.clear();
}
static Future<Void> transactionInfoCommitActor(Transaction* tr, std::vector<TrInfoChunk>* chunks) {
const Key clientLatencyAtomicCtr = CLIENT_LATENCY_INFO_CTR_PREFIX.withPrefix(fdbClientInfoPrefixRange.begin);
int retryCount = 0;
while (true) {
Error err;
try {
tr->reset();
resetClientStatusTransaction(tr);
tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr->setOption(FDBTransactionOptions::LOCK_AWARE);
[[maybe_unused]] Future<Standalone<StringRef>> vstamp = tr->getVersionstamp();
@ -656,7 +662,7 @@ static Future<Void> delExcessClntTxnEntriesActor(Transaction* tr, int64_t client
while (true) {
Error err;
try {
tr->reset();
resetClientStatusTransaction(tr);
tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr->setOption(FDBTransactionOptions::LOCK_AWARE);
Optional<Value> ctrValue = co_await tr->get(KeyRef(clientLatencyAtomicCtr), Snapshot::True);