发布

  • [OPIK-6968] [BE] perf: drop per-project trace-threads lock from ingestion, closing and sampling (#7131)

    frostbyte_neo 发布于 2026-06-17 07:15:11 +00:00

    Removes the {projectId}-trace-threads-process lock from three flows where it provided no real protection:

    • processTraceThreads (ingestion save): processThreadAsync resolves thread IDs idempotently and saveTraceThreads writes a ReplacingMergeTree keyed by last_updated_at, so concurrent saves converge.

    • processProjectWithTraceThreadsPendingClosure (closing scan): a project's closing is already serialized across pods by the per-project buffer token (addToPendingQueue / unlockUsingToken, retained); the trace-threads lock was redundant.

    • updateThreadSampledValue (sampling): the bulk update reads the latest row (FINAL) and overrides only sampling_per_rule. The lock never closed the read->commit window anyway: CH here has no read-your-own-writes (insert_quorum=0, select_sequential_consistency=0, async insert), so serializing the app calls does not serialize data visibility. Correctness rests on reading max(last_updated_at) + last-writer-wins by version, not the lock.

    Remaining acquirers (openThread, closeThreads) and the buffer-token lock are unchanged. Follow-up to #7121.

    Co-authored-by: Claude Opus 4.8 (1M context) noreply@anthropic.com

    下载附件