Skip to content

spanconfig: implement the ProtectedTSReader interface on the KVSubscriber#77338

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
arulajmani:kv-subscriber-pts-reader
Mar 4, 2022
Merged

spanconfig: implement the ProtectedTSReader interface on the KVSubscriber#77338
craig[bot] merged 1 commit intocockroachdb:masterfrom
arulajmani:kv-subscriber-pts-reader

Conversation

@arulajmani
Copy link
Copy Markdown
Collaborator

This patch makes the KVSubscriber implement the ProtectedTSReader
interface. This allows the GC queue to consult protected timestamp
information reconciled by sql tenants when making GC decisions.

We also initialize the spanconfigptsreader.adapter struct with a
KVSubscriber now. The adapter was conceived with the intention to
encapsulate PTS information from both the old and new subsystem for
release 22.1 behind a single source for the GC queue to consume.
Threading in the KVSubscriber actually achieves this. We return the
minimum freshness of the cache and KVSubscriber to the GC queue from
the adapter.

Release justification: bug fixes and low risk updates to new
functionality

Release note: None

@arulajmani arulajmani requested a review from a team as a code owner March 3, 2022 16:48
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@arulajmani
Copy link
Copy Markdown
Collaborator Author

@irfansharif made the changes you mentioned on Slack, namely, removed Start from the KVSubscriber interface and moved ForEachOverlappingSpanConfig from the interface (spanconfig.Store) to the concrete impl. PTAL.

@arulajmani arulajmani force-pushed the kv-subscriber-pts-reader branch from d37617f to 0300001 Compare March 4, 2022 01:31
Copy link
Copy Markdown
Contributor

@irfansharif irfansharif left a comment

Choose a reason for hiding this comment

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

LGTM modulo [e,e) showing up in the test grammar to represent a point span. It’s an invalid span if e is both inclusive and exclusive. In our test I think we’ll get the same coverage just testing for the single alphabet span [e,f). If you really want to test keys (not necessary IMO, KV doesn’t ask for configs for keys, does it?) it’s worth adding something in the testing grammar to represent it. Either [e,nil) or some syntax for point specifically. I prefer [e,f) also because at various places we assert on spans having non-nil end keys.

canGC, _, gcTimestamp, oldThreshold, newThreshold := r.checkProtectedTimestampsForGC(ctx, makeTTLDuration(10))
canGC, _, gcTimestamp, oldThreshold, newThreshold, err := r.checkProtectedTimestampsForGC(ctx, makeTTLDuration(10))
require.NoError(t, err)
require.True(t, canGC)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Duplicate line?

This patch makes the `KVSubscriber` implement the `ProtectedTSReader`
interface. This allows the GC queue to consult protected timestamp
information reconciled by sql tenants when making GC decisions.

We also initialize the `spanconfigptsreader.adapter` struct with a
KVSubscriber now. The adapter was conceived with the intention to
encapsulate PTS information from both the old and new subsystem for
release 22.1 behind a single source for the GC queue to consult.
Threading in the KVSubscriber actually achieves this. We return the
minimum freshness of the cache and KVSubscriber to the GC queue as
the "combined" freshnsess of the adapter.

Release justification: bug fixes and low risk updates to new
functionality

Release note: None
@arulajmani arulajmani force-pushed the kv-subscriber-pts-reader branch from 0300001 to 63fde7a Compare March 4, 2022 18:57
Copy link
Copy Markdown
Collaborator Author

@arulajmani arulajmani left a comment

Choose a reason for hiding this comment

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

TFTR! I removed the point tests considering KV doesn't ask for them and given your comment. The CI failure seems to be a flake, going to press merge.

bors r+

Dismissed @irfansharif from a discussion.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @adityamaru, @ajwerner, and @nvanbenschoten)


pkg/kv/kvserver/replica_protected_timestamp_test.go, line 155 at r2 (raw file):

Previously, irfansharif (irfan sharif) wrote…

Duplicate line?

Done.

@craig craig bot merged commit 71eb44f into cockroachdb:master Mar 4, 2022
@craig
Copy link
Copy Markdown
Contributor

craig bot commented Mar 4, 2022

Build succeeded:

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