Skip to content

kv: pass explicit Now timestamp on BatchRequest, remove timestamp downcasting#85764

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
nvb:nvanbenschoten/clockUpdateNow
Aug 12, 2022
Merged

kv: pass explicit Now timestamp on BatchRequest, remove timestamp downcasting#85764
craig[bot] merged 1 commit intocockroachdb:masterfrom
nvb:nvanbenschoten/clockUpdateNow

Conversation

@nvb
Copy link
Copy Markdown
Contributor

@nvb nvb commented Aug 8, 2022

This commit adds an explicit ClockTimestamp field called Now to the BatchRequest header, which mirrors the Now field on the BatchResponse header.

In doing so, it removes the last instance where we downcasted a Timestamp to a ClockTimestamp using the TryToClockTimestamp method. With this change, MVCC ("operation") timestamps never flow back into HLC clocks as clock signals. This was enabled by #80706 and sets the groundwork to remove synthetic timestamps in v23.1 — the role they played in dynamic typing of clock timestamps is now entirely fulfilled by statically typed ClockTimestamp channels.

This is an important step in separating out the MVCC timestamp domain from the clock timestamp domain and clarifying the roles of the two layers. In turn, this layering opens the door for CockroachDB to start thinking about dynamic clock synchronization error bounds.

@nvb nvb requested a review from tbg August 8, 2022 18:51
@nvb nvb requested a review from a team as a code owner August 8, 2022 18:51
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@nvb nvb force-pushed the nvanbenschoten/clockUpdateNow branch from 9f86bd6 to 0b4cc7d Compare August 9, 2022 03:50
Copy link
Copy Markdown
Member

@tbg tbg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained

@nvb
Copy link
Copy Markdown
Contributor Author

nvb commented Aug 10, 2022

TFTR!

Was this implicitly an approval for #76233 as well, or does that still need another look?

// succeeded.
// TODO(nvanbenschoten): remove this in v23.1 when we remove the synthetic
// timestamp bit.
func (t Timestamp) DeprecatedTryToClockTimestamp() (ClockTimestamp, bool) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@nvb nvb force-pushed the nvanbenschoten/clockUpdateNow branch from 0b4cc7d to 90e191d Compare August 11, 2022 18:54
@nvb
Copy link
Copy Markdown
Contributor Author

nvb commented Aug 11, 2022

TFTR!

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Aug 11, 2022

Build failed (retrying...):

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Aug 12, 2022

Build failed (retrying...):

@nvb
Copy link
Copy Markdown
Contributor Author

nvb commented Aug 12, 2022

bors r-

This seems to be causing issues in bors. CI was all green until the last rebase, so something might be up.

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Aug 12, 2022

Canceled.

@nvb
Copy link
Copy Markdown
Contributor Author

nvb commented Aug 12, 2022

I think it might have skewed with #83213. The benchmark (BenchmarkMVCCGCWithForegroundTraffic) added in that PR now seems to be failing.

…ncasting

This commit adds an explicit `ClockTimestamp` field called `Now` to the
`BatchRequest` header, which mirrors the `Now` field on the `BatchResponse`
header.

In doing so, it removes the last instance where we downcasted a `Timestamp` to a
`ClockTimestamp` using the `TryToClockTimestamp` method. With this change, MVCC
("operation") timestamps never flow back into HLC clocks as clock signals. This
was enabled by cockroachdb#80706 and sets the groundwork to remove synthetic timestamps in
v23.1 — the role they played in dynamic typing of clock timestamps is now
entirely fulfilled by statically typed `ClockTimestamp` channels.

This is an important step in separating out the MVCC timestamp domain from the
clock timestamp domain and clarifying the roles of the two layers. In turn, this
layering opens the door for CockroachDB to start thinking about dynamic clock
synchronization error bounds.
@nvb nvb force-pushed the nvanbenschoten/clockUpdateNow branch from 90e191d to c7c154a Compare August 12, 2022 02:01
@nvb
Copy link
Copy Markdown
Contributor Author

nvb commented Aug 12, 2022

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Aug 12, 2022

Build failed (retrying...):

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Aug 12, 2022

Build succeeded:

@craig craig bot merged commit 1ac67a9 into cockroachdb:master Aug 12, 2022
@nvb nvb deleted the nvanbenschoten/clockUpdateNow branch August 12, 2022 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants