kvserver: fix double span Finish on reproposals#108775
kvserver: fix double span Finish on reproposals#108775craig[bot] merged 4 commits intocockroachdb:masterfrom
Conversation
|
It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR? 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
8d61ee6 to
6e98b9c
Compare
6e98b9c to
24eb9bb
Compare
erikgrinaker
left a comment
There was a problem hiding this comment.
LGTM in principle, just some minor tweaks.
| // proposals for post-processing. | ||
| // | ||
| // TODO(pavelkalinnikov): prove and assert that origP.reproposal was nil. | ||
| origP.reproposal = newProposal |
There was a problem hiding this comment.
This will prevent garbage collection of all the intermediate reproposals. I don't think we hold on to them from anywhere else? Seems like it would be worthwhile to avoid.
I'm guessing the old proposal is discarded after we hit this code path? If so, we really only need the first and last proposal in the chain. We could e.g. have a backreference to the original proposal and update its forward reference to the latest reproposal, or we could have a cancel function that's propagated down to the active reproposal.
There was a problem hiding this comment.
Reworked this bit. It became a bit more ugly, but the GC benefit seems worth it. Longer term, we should improve the lifecycle.
There was a problem hiding this comment.
Also, had to drop the invariant check.
afa3a59 to
9becf3b
Compare
9becf3b to
8a24ab2
Compare
pav-kv
left a comment
There was a problem hiding this comment.
Addressed inline comments, and squashed commits.
8a24ab2 to
d3f93d1
Compare
|
@erikgrinaker Ah hold on, I'm looking if I can add a test. |
Since cockroachdb#106750, ProposalData is being copied on superseding reproposals. The caller only knows about the original proposal, and only detaches its context / tracing span when abandoning the request (e.g. on timeout). By the time of abandoning the request, there might have been a few superseding reproposals, and the context / tracing span is being used by multiple ProposalData objects. In addition to rewriting the original proposal.ctx, we should do the same for all the ProposalData objects corresponding to the same request. This commit unbinds the context for older proposals when reproposing them, and unbinds the latest reproposal context when cleaning up / abandoning the request. Epic: CRDB-25287 Release note: none
Epic: none Release note: none
Epic: none Release note: none
d3f93d1 to
b83edaf
Compare
Epic: none Release note: none
|
@erikgrinaker Added a test, PTAL. |
erikgrinaker
left a comment
There was a problem hiding this comment.
LGTM, thanks. It's possible that we prematurely clear the seed proposal's context here, which could possibly lose some trace events for the remainder of the failed application, but even if we do we likely don't care about them at this point anyway
|
bors r=erikgrinaker |
|
We don't need to backport this, this refactoring is post-23.1. |
|
Build succeeded: |
`TestMultiRegionDataDriven` was skipped in cockroachdb#108107 due to finish (tracing span) being called twice in raft reproposals cockroachdb#107521, which cockroachdb#108775 fixed. Unskip the top level `TestMultiRegionDataDriven` test. Note `/secondary_region` is still skipped due to a known allocator bug. Informs: cockroachdb#98020 Epic: none Release note: None
110063: ccl/multiregionccl: unskip test multi region dd parent test r=rafiss a=kvoli `TestMultiRegionDataDriven` was skipped in #108107 due to finish (tracing span) being called twice in raft reproposals #107521, which #108775 fixed. Unskip the top level `TestMultiRegionDataDriven` test. Note `/secondary_region` is still skipped due to a known allocator bug. Informs: #98020 Epic: none Release note: None Co-authored-by: Austen McClernon <austen@cockroachlabs.com>
Since #106750,
ProposalDatais being copied on superseding reproposals. The caller only knows about the original proposal, and only detaches its context / tracing span when abandoning the request (e.g. on timeout). By the time of abandoning the request, there might have been a few superseding reproposals, and the context / tracing span is being used by multipleProposalDataobjects.In addition to rewriting the original
proposal.ctx, we should do the same for all theProposalDataobjects corresponding to the same request. This commit unbinds the context for older proposals when reproposing them, and unbinds the latest reproposal context when cleaning up / abandoning the request.Fixes #107521
Fixes #108534
Fixes #108241
Fixes #108663
Fixes #108696
Fixes #108837
Epic: CRDB-25287
Release note: none