storage: Update timestamp cache before updating a lease on a replica#17109
storage: Update timestamp cache before updating a lease on a replica#17109m-schneider merged 1 commit intocockroachdb:masterfrom
Conversation
|
Looks good so far! Reviewed 2 of 2 files at r1. pkg/storage/store.go, line 1861 at r1 (raw file):
Can you just drop the last argument to pkg/storage/store.go, line 1861 at r1 (raw file):
Looking through the It seems that the original call intentionally wanted things to look like the lease was changing hands so that Comments from Reviewable |
05e1861 to
2cad033
Compare
|
Review status: 0 of 2 files reviewed at latest revision, 2 unresolved discussions. pkg/storage/store.go, line 1861 at r1 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
I reran the storage tests and nothing fails. I read through all of the comments for that PR as well and the main concern was for the pushTxnQueue to be enabled after the call to leasePostApply, which it is because that's only gated by iAmTheLeaseHolder. The tests added in that PR only check to see if the queue is enabled, but don't test the contents. pkg/storage/store.go, line 1861 at r1 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Good point, cleaned up. Comments from Reviewable |
|
Reviewed 2 of 2 files at r2. pkg/storage/store.go, line 1861 at r1 (raw file): Previously, m-schneider (Masha Schneider) wrote…
Oh, gotcha, I was looking at the wrong part of the code, namely the one where the queue is disabled. No problem then! Comments from Reviewable |
|
See https://teamcity.cockroachdb.com/viewLog.html?buildId=300601&buildTypeId=Cockroach_UnitTests for fixing the CI. |
- Before we would update the in-memory lease on a replica, unlock it and then we would update the timestamp cache. This would allow a replica to start processing requests for a lease without first having taken into account reads served from the old lease holder. We could see this by running: make stress PKG=./pkg/sql/logictest TESTS=TestParallel/subquery_retry_multinode STRESSFLAGS='-p 32' This would fail because we would have duplicate values in a table where inserts should have had monotonically increasing values. - After this change the test passes. We also updated splitPostApply, to send the current lease as the previous lease to leasePostApply to prevent an update to the timestamp cache when a lease hasn't changed hands. Closes cockroachdb#16610
2cad033 to
c54d9b0
Compare
|
Thanks! Comments from Reviewable |
|
I think we want to cherry-pick this into 1.0.x. If we do it soon it can go in to 1.0.4 (the cutoff is today). Review status: 1 of 2 files reviewed at latest revision, 2 unresolved discussions, all commit checks successful. pkg/storage/store.go, line 1858 at r3 (raw file):
This comment got a little muddled ("an right lease", and there's no longer a Comments from Reviewable |
unlock it and then we would update the timestamp cache. This would
allow a replica to start processing requests for a lease without
first having taken into account reads served from the old lease
holder. We could see this by running:
make stress PKG=./pkg/sql/logictest
TESTS=TestParallel/subquery_retry_multinode STRESSFLAGS='-p 32'
This would fail because we would have duplicate values in a table
where inserts should have had monotonically increasing values.
to send the current lease as the previous lease to leasePostApply to
prevent an update to the timestamp cache when a lease hasn't changed
hands.
Closes #16610