-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reproduce bug in HCLRevisionFromString when parsing zero logical clock
While developing the test-case for `EmitImmediatelyStrategy` with CRDB, I detected something I wasn't expecting: when comparing the revision out of the datastore write, and what came out of Watch API, the revisions were different. We use `SHOW COMMIT TIMESTAMP` to retrieve a CRDB [transaction timestamp] (cockroachdb/cockroach#80848). The value coming out of the `update` field in change streams had the same value, but the difference was the notation: one included the logical clock, the other didn't, but logical clocks were the same (zero): - revision generated out of the transaction in `readTransactionCommitRev` uses `NewForHLC(hlcNow)`, which takes a `Decimal`. This in turn calls `decimal.String()`, which returns a number stripped out of the decimal part if it's zero. - revision obtained out of the changefeeds uses `revisions.HLCRevisionFromString (details.Updated)`, and `details.Updated` always comes with the decimal part, even when it's zero Both timestamps were the same, but had a different string representation, and led to a different `HCLRevision` logical lock, hence `.Equal()` method failing.
- Loading branch information
1 parent
686ae94
commit 715e07f
Showing
1 changed file
with
70 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters