You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's say the maxLeaseIndex assigned here is 100 and the timestamp of the command is 1000. The closed timestamp tracker now knows 100 as the MLAI of a command that has an effect at ts=1000.
log.Warningf(ctx, "failed to repropose with new lease index: %s", pErr)
returnpErr
From the perspective of closed timestamps, this is problematic. A CT update might have been sent out stating that "if you've caught up to lease index 100, you've seen all the proposals that will have an effect on timestamp 1000". But it turns out that in this example, such a command will pop out of raft at lease index 200.
It seems that this can cause a violation of the invariant that any closed out MVCC snapshot is immutable.
As for fixing this, the "natural" attempt is to go through the tracker again. However, if we find that the tracker pushes the proposal (i.e. the original timestamp has closed out, as it has in this example), we need someone to reevaluate it.
It's possible that we would be better off removing this one-off below-raft-reproposal path completely and instead opting for having the client reevaluate the command unconditionally. The one-off path was originally introduced to accommodate pipelined writes (where the client returns early and isn't around to reevaluate the command) but this doesn't mean we can't reevaluate the batch, just that we have to create a goroutine to do so. This approach is less performant, but this is a rare case where simplicity is more important than performance.
The text was updated successfully, but these errors were encountered:
tbg
added
the
C-bug
Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
label
Nov 27, 2019
Prior to this commit, tryReproposeWithNewLeaseIndex would not consult
with the closed timestamp tracker. This meant that a proposal may end up
with a new lease index at a timestamp that consumers of closed timestamp
updates had already considered immutable. In other words, this broke
closed timestamp guarantees and would by extension also have the
potential to break CDC's.
This path is fairly rare and it isn't one likely to cause problems
in practice, though it certainly could have.
See cockroachdb#42821 for details.
Fixescockroachdb#42821
Release note (bug fix): fix a bug which could lead to follower reads or
CDC updates that did not reflect the full set of data at the timestamp.
This bug was never observed in practice and should be rare to cause
issues, one of the necessary ingredients being an aggressive closed
timestamp interval.
42939: storage: respect closed timestamp in tryReproposeWithNewLeaseIndex r=nvanbenschoten a=tbg
Prior to this commit, tryReproposeWithNewLeaseIndex would not consult
with the closed timestamp tracker. This meant that a proposal may end up
with a new lease index at a timestamp that consumers of closed timestamp
updates had already considered immutable. In other words, this broke
closed timestamp guarantees and would by extension also have the
potential to break CDC's.
This path is fairly rare and it isn't one likely to cause problems
in practice, though it certainly could have.
See #42821 for details.
Fixes#42821
Release note (bug fix): fix a bug which could lead to follower reads or
CDC updates that did not reflect the full set of data at the timestamp.
This bug was never observed in practice and should be rare to cause
issues, one of the necessary ingredients being an aggressive closed
timestamp interval.
Co-authored-by: Tobias Schottdorf <[email protected]>
Consider proposing a write and this code path:
cockroach/pkg/storage/replica_write.go
Lines 149 to 165 in 4850974
Let's say the
maxLeaseIndex
assigned here is 100 and the timestamp of the command is 1000. The closed timestamp tracker now knows 100 as the MLAI of a command that has an effect at ts=1000.The proposal now hits this code path
cockroach/pkg/storage/replica_application_result.go
Lines 145 to 151 in 27c3d49
and gets reproposed with a new lease index, let's say 200:
cockroach/pkg/storage/replica_application_result.go
Lines 210 to 215 in 27c3d49
From the perspective of closed timestamps, this is problematic. A CT update might have been sent out stating that "if you've caught up to lease index 100, you've seen all the proposals that will have an effect on timestamp 1000". But it turns out that in this example, such a command will pop out of raft at lease index 200.
It seems that this can cause a violation of the invariant that any closed out MVCC snapshot is immutable.
As for fixing this, the "natural" attempt is to go through the tracker again. However, if we find that the tracker pushes the proposal (i.e. the original timestamp has closed out, as it has in this example), we need someone to reevaluate it.
It's possible that we would be better off removing this one-off below-raft-reproposal path completely and instead opting for having the client reevaluate the command unconditionally. The one-off path was originally introduced to accommodate pipelined writes (where the client returns early and isn't around to reevaluate the command) but this doesn't mean we can't reevaluate the batch, just that we have to create a goroutine to do so. This approach is less performant, but this is a rare case where simplicity is more important than performance.
The text was updated successfully, but these errors were encountered: