Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protectedts: flip knob to enable multi-tenant PTS in clusters #77478

Merged
merged 1 commit into from
Mar 14, 2022

Conversation

adityamaru
Copy link
Contributor

@adityamaru adityamaru commented Mar 8, 2022

This change switches the EnableProtectedTimestampForMultiTenant
testing knob to DisableProtectedTimestampForMultiTenant. This means
that all tests and clusters will now run with the ptpb.Target and spanconfig backed
protectedts infrastructure by default.

Informs: #73727

Release note: None

Release justification: high impact change to enable new functionality.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@adityamaru adityamaru force-pushed the flip-pts-on branch 2 times, most recently from c33bd84 to a47d177 Compare March 10, 2022 11:17
@adityamaru adityamaru marked this pull request as ready for review March 10, 2022 11:21
@adityamaru adityamaru requested a review from a team as a code owner March 10, 2022 11:21
@adityamaru adityamaru requested a review from a team March 10, 2022 11:21
@adityamaru adityamaru requested a review from a team as a code owner March 10, 2022 11:21
@adityamaru adityamaru requested review from dt, shermanCRL, samiskin, arulajmani and a team and removed request for a team and shermanCRL March 10, 2022 11:21
@adityamaru
Copy link
Contributor Author

adityamaru commented Mar 10, 2022

@arulajmani most of the test changes were switching over from spans to targets, and waiting for KV to reconcile in some cases. The non-trivial changes were in TestStrictGCEnforcement and TestProtectedTimestamps, I don't know if those tests can be rewritten to be simpler, we can discuss this offline.

@samiskin I edited one of the tests you recently wrote for CDC. I also left a TODO for CDC which I'm happy to discuss and try to resolve with your help.

@adityamaru adityamaru force-pushed the flip-pts-on branch 2 times, most recently from 8956ac3 to 20e666f Compare March 11, 2022 17:25
@adityamaru
Copy link
Contributor Author

@samiskin @miretskiy I've had to rewrite some of the changefeed PTS tests to fit better with the new system where a PTS record written to the system table isn't enough to check a Protect. We actually have to check that the protection has made its way down to KV. I'd appreciate a look at the changes in changefeed_test.go. I'm trying to flip this knob before branch cut if possible so that everyone can start stressing the new subsystem during stability

@adityamaru adityamaru removed the request for review from a team March 11, 2022 17:30
@adityamaru adityamaru changed the title protectedts: flip testing knob to enable multi-tenant PTS protectedts: flip knob to enable multi-tenant PTS in clusters Mar 11, 2022
Copy link
Collaborator

@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.

I only have minor/nitty comments, the change looks :lgtm: . Thanks for doing this, it's exciting to see this wired up end to end, with integration tests!

I'll echo your comment from above, the changes to changefeed_test.go are non-trivial and I'm not too familiar with those tests. It's best to get someone from CDC to sign them off.

Reviewed 26 of 27 files at r1, 3 of 4 files at r2.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @adityamaru, @arulajmani, @dt, @miretskiy, and @samiskin)


pkg/spanconfig/spanconfigptsreader/adapter.go, line 97 at r2 (raw file):

	// Now ensure the KVSubscriber is fresh enough.
	testutils.SucceedsSoon(t, func() error {
		_, fresh, err := a.GetProtectionTimestamps(ctx, keys.EverythingSpan)

nit: I don't think this matters, does it?


pkg/kv/kvserver/client_replica_test.go, line 3458 at r2 (raw file):

// to the zone configs.
//
// TODO(adityamaru,arulajmani): Once the protectedts.Cache goes away this test

Do you have thoughts on how we'd change this once the Cache goes away? What you're doing here (replacing cache freshness by blocking the KVSubscriber to make progress) seems sane. I can't think of how we'd want to change this in the future, but maybe I'm missing something. Mind opening an issue with how you'd like to see this evolve once the Cache goes away? Alternatively, if you're happy with how this test is looking (I am!) then I wouldn't be sad seeing this TODO removed entirely.


pkg/kv/kvserver/client_replica_test.go, line 3597 at r2 (raw file):

			}
		}
		waitForProtectionAndReadProtectedTimestamps = func(t *testing.T, nodeID roachpb.NodeID,

Mind adding a comment for future us, once "waitForProtectionANdReadProtectedTimestamps" doesn't ring the same bell as it does today?


pkg/kv/kvserver/protectedts/ptcache/cache_test.go, line 283 at r2 (raw file):

	p := ptstorage.WithDatabase(ptstorage.New(s.ClusterSettings(),
		s.InternalExecutor().(sqlutil.InternalExecutor),
		&protectedts.TestingKnobs{DisableProtectedTimestampForMultiTenant: true}), s.DB())

nit: here, and below, formatting looks a bit off. Maybe:

	p := ptstorage.WithDatabase(
		ptstorage.New(
			s.ClusterSettings(),
			s.InternalExecutor().(sqlutil.InternalExecutor),
			&protectedts.TestingKnobs{DisableProtectedTimestampForMultiTenant: true},
		),
		s.DB(),
	)

pkg/kv/kvserver/protectedts/ptstorage/storage_test.go, line 676 at r2 (raw file):

		s := tc.Server(0)
		pts := s.ExecutorConfig().(sql.ExecutorConfig).ProtectedTimestampProvider

I noticed in a couple of places we've moved to using the TestCluster version of these interfaces (protectedts.Storage in this case) instead of constructing one with passed in testing knobs -- I'm curious if there was a reason for this switch?

Copy link
Contributor Author

@adityamaru adityamaru left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @arulajmani, @dt, @miretskiy, and @samiskin)


pkg/spanconfig/spanconfigptsreader/adapter.go, line 97 at r2 (raw file):

Previously, arulajmani (Arul Ajmani) wrote…

nit: I don't think this matters, does it?

Does roachpb.Span{} and keys.EverythingSpan have the same effect? I was under the impression that by passing in EverythingSpan we would wait for all the frontier timestamps of the KVSubscribers rangefeed to be this fresh.


pkg/kv/kvserver/client_replica_test.go, line 3458 at r2 (raw file):

Previously, arulajmani (Arul Ajmani) wrote…

Do you have thoughts on how we'd change this once the Cache goes away? What you're doing here (replacing cache freshness by blocking the KVSubscriber to make progress) seems sane. I can't think of how we'd want to change this in the future, but maybe I'm missing something. Mind opening an issue with how you'd like to see this evolve once the Cache goes away? Alternatively, if you're happy with how this test is looking (I am!) then I wouldn't be sad seeing this TODO removed entirely.

This is a stale comment, i rewrote the test a couple of times until i realized we no longer need waitForCacheAfter() anymore. Removed.


pkg/kv/kvserver/client_replica_test.go, line 3597 at r2 (raw file):

Previously, arulajmani (Arul Ajmani) wrote…

Mind adding a comment for future us, once "waitForProtectionANdReadProtectedTimestamps" doesn't ring the same bell as it does today?

Done.


pkg/kv/kvserver/protectedts/ptstorage/storage_test.go, line 676 at r2 (raw file):

Previously, arulajmani (Arul Ajmani) wrote…

I noticed in a couple of places we've moved to using the TestCluster version of these interfaces (protectedts.Storage in this case) instead of constructing one with passed in testing knobs -- I'm curious if there was a reason for this switch?

I felt that we were anyways spinning up a testcluster with the testing knobs, so didn't make sense to re-init a parallel pts.Storage. I'm unsure what the initial motivation to do that was.

This change switches the `EnableProtectedTimestampForMultiTenant`
testing knob to `DisableProtectedTimestampForMultiTenant`. This means
that all tests will now run with the ptpb.Target and spanconfig backed
protectedts infrastructure by default.

Informs: cockroachdb#73727

Release note: None

Release justification: non-production code changes
Copy link
Contributor

@samiskin samiskin left a comment

Choose a reason for hiding this comment

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

Changefeed test changes look good!

@adityamaru
Copy link
Contributor Author

TFTRs!!

bors r=arulajmani,samiskin

@craig
Copy link
Contributor

craig bot commented Mar 14, 2022

Build succeeded:

@craig craig bot merged commit 1dd7ed3 into cockroachdb:master Mar 14, 2022
@adityamaru adityamaru deleted the flip-pts-on branch March 14, 2022 16:01
arulajmani added a commit to arulajmani/cockroach that referenced this pull request Mar 14, 2022
Fix race introduced in cockroachdb#77478.

Release justification: non-production code changes
Release note: None
craig bot pushed a commit that referenced this pull request Mar 14, 2022
77658: colexec: add native support for COALESCE, IF, NULLIF r=yuzefovich a=yuzefovich

**colexec: remove no longer used testing knob**

Previously, in a test helper method we allowed the fallback to the
row-by-row engine. At some point this was needed, but right now all
callers don't utilize that ability, so we can easily remove it.

Release note: None

Release justification: testing only change.

**colbuilder: order expressions lexicographically**

Release note: None

Release justification: low risk cleanup.

**colexec: add native support for COALESCE, IF, NULLIF**

This commit adds the native vectorized support for `CoalesceExpr`,
`IfExpr`, and `NullIfExpr` by planning the equivalent CASE expressions.
Namely, for `CoalesceExpr` we do
```
CASE
  WHEN CoalesceExpr.Exprs[0] IS DISTINCT FROM NULL THEN CoalesceExpr.Exprs[0]
  WHEN CoalesceExpr.Exprs[1] IS DISTINCT FROM NULL THEN CoalesceExpr.Exprs[1]
  ...
END
```
for `IfExpr` we do
```
CASE WHEN IfExpr.Cond THEN IfExpr.True ELSE IfExpr.Else END
```
and for `NullIfExpr` we do
```
CASE WHEN Expr1 == Expr2 THEN NULL ELSE Expr1 END
```

This commit additionally introduces some unit tests for these newly
supported expressions while extracting out some testing facilities from
the caseOp tests.

Fixes: #66015.

Release note: None

Release justification: low risk, high benefit change to existing
functionality.

77784: dev: `--rewrite` should imply `--ignore-cache` r=irfansharif a=rickystewart

If you meant to rewrite again but didn't update any source files, Bazel
can reuse the cached results which is confusing.

Release justification: Non-production code changes
Release note: None

77806: kvserver: fix datarace in TestStrictGCEnforcement r=arulajmani a=arulajmani

Fix race introduced in #77478.

Release justification: non-production code changes
Release note: None

Co-authored-by: Yahor Yuzefovich <yahor@cockroachlabs.com>
Co-authored-by: Ricky Stewart <ricky@cockroachlabs.com>
Co-authored-by: arulajmani <arulajmani@gmail.com>
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.

None yet

4 participants