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

changefeedccl: Bring changefeed transformations out of preview #94806

Merged
merged 2 commits into from Jan 12, 2023

Conversation

miretskiy
Copy link
Contributor

Add a mechanism to migrate changefeed expressions
created in 22.2 clusters to be compatible with
recently introduced changes.

Old changefeed expressions are transparently rewritten,
and the changefeed job record automatically updated
once cluster upgrade has been finalized.

A warning message may be logged if the rewritten expression
is inefficient.

The automatic update might still fail. The end users
are encourraged to closely monitor the health of the
changefeeds during the upgrade, and recreate any failed
changefeeds as needed.

Epic: CRDB-17161

Release note (enterprise change): Changefeed transformations
introduced in 22.2 release in preview mode are no longer
experimental. This feature can now be considered
to be fully production ready.

@miretskiy miretskiy requested review from a team as code owners January 5, 2023 23:13
@miretskiy miretskiy requested review from rytaft and removed request for a team January 5, 2023 23:13
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@miretskiy miretskiy removed the request for review from rytaft January 5, 2023 23:13
@miretskiy
Copy link
Contributor Author

@HonoreDB Only top 2 commits.

Copy link
Contributor

@HonoreDB HonoreDB left a comment

Choose a reason for hiding this comment

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

Reviewed 10 of 10 files at r1, 11 of 11 files at r2, 17 of 17 files at r3, 16 of 16 files at r4, 11 of 11 files at r5, 2 of 2 files at r6, 11 of 11 files at r7, 7 of 7 files at r8, 3 of 11 files at r9.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @miretskiy and @samiskin)


pkg/ccl/changefeedccl/metrics.go line 387 at r8 (raw file):

	metaChangefeedFilteredMessages := metric.Metadata{
		Name:        "changefeed.filtered_messages",
		Help:        "Messages filtered out by all feeds",

Maybe specify "filtered out in memory" in the description and I think also in the name. I assume this doesn't include "messages" that got filtered out by the range constraints before they even became messages which is going to be confusing to the user (if you do N writes, EmittedMessages+FilteredMessages can be less than N).


pkg/ccl/changefeedccl/cdceval/compat.go line 29 at r9 (raw file):

			// Replace this call with a call to row_to_json((cdc_prev).*)
			if n, ok := t.Func.FunctionReference.(*tree.UnresolvedName); ok && n.Parts[0] == "cdc_prev" {
				rowToJSON := &tree.FuncExpr{

could this be a singleton?


pkg/jobs/jobspb/jobs.proto line 936 at r8 (raw file):

  string select = 10;
  sessiondatapb.SessionData session_data = 11 [(gogoproto.nullable) = false];

I'm not sure this change is backwards-compatible, is it meant to be? Non-nullable fields are serialized differently I think.

Copy link
Contributor Author

@miretskiy miretskiy 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! 0 of 0 LGTMs obtained (waiting on @HonoreDB and @samiskin)


pkg/ccl/changefeedccl/metrics.go line 387 at r8 (raw file):

Previously, HonoreDB (Aaron Zinger) wrote…

Maybe specify "filtered out in memory" in the description and I think also in the name. I assume this doesn't include "messages" that got filtered out by the range constraints before they even became messages which is going to be confusing to the user (if you do N writes, EmittedMessages+FilteredMessages can be less than N).

i'd rather not add memory bit; but you do bring up a good point; alas, w/out explain statement, there
is no way to tell how many were filtered. I've expanded help message a bit to at least mention this.


pkg/ccl/changefeedccl/cdceval/compat.go line 29 at r9 (raw file):

Previously, HonoreDB (Aaron Zinger) wrote…

could this be a singleton?

I'm not sure tbh... But I'm honestly not worried about this.


pkg/jobs/jobspb/jobs.proto line 936 at r8 (raw file):

Previously, HonoreDB (Aaron Zinger) wrote…

I'm not sure this change is backwards-compatible, is it meant to be? Non-nullable fields are serialized differently I think.

Sure; but I think it's fine -- session data was added in prior PRs -- and arguably, I should have
added version gate, but I didn't. Anyway, that code was never released, so I think it's fine to make this change now.

@abarganier
Copy link
Member

abarganier commented Jan 11, 2023

On the obs-infra side, the new metric & new addition to the chart catalog LGTM

@abarganier abarganier removed the request for review from a team January 11, 2023 15:20
@miretskiy
Copy link
Contributor Author

@HonoreDB -- want to make sure you saw recent updates...

Yevgeniy Miretskiy added 2 commits January 11, 2023 19:28
Add metric to keep track of the number of filtered messags.
Add debug logging to cdc evaluation library.

Epic: CRDB-17161

Release note: None
Add a mechanism to migrate changefeed expressions
created in 22.2 clusters to be compatible with
recently introduced changes.

Old changefeed expressions are transparently rewritten,
and the changefeed job record automatically updated
once cluster upgrade has been finalized.

A warning message may be logged if the rewritten expression
is inefficient.

The automatic update might still fail.  The end users
are encourraged to closely monitor the health of the
changefeeds during the upgrade, and recreate any failed
changefeeds as needed.

Epic: CRDB-17161

Release note (enterprise change): Changefeed transformations
introduced in 22.2 release in preview mode are no longer
experimental.  This feature can now be considered
to be fully production ready.
Copy link
Contributor

@HonoreDB HonoreDB left a comment

Choose a reason for hiding this comment

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

Reviewed 46 of 46 files at r10, 7 of 43 files at r11.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @miretskiy and @samiskin)


pkg/ccl/changefeedccl/changefeed_stmt.go line 1400 at r11 (raw file):

	// Job record upgraded.  Return transient error to reload job record and retry.
	if newExpression == oldExpression {

I think safer to compare tree.AsString before and after than directly compare pointers?


pkg/ccl/changefeedccl/metrics.go line 387 at r8 (raw file):

Previously, miretskiy (Yevgeniy Miretskiy) wrote…

i'd rather not add memory bit; but you do bring up a good point; alas, w/out explain statement, there
is no way to tell how many were filtered. I've expanded help message a bit to at least mention this.

I agree there's no way to efficiently tell right now. I'm not sure "the range constraints" communicates this to a non-roacher, would "due to primary key constraints in WHERE clauses" be reasonably accurate?

@miretskiy
Copy link
Contributor Author

to primary key constraints in WHERE clauses

done.

@miretskiy
Copy link
Contributor Author

I think safer to compare tree.AsString before and after than directly compare pointers?

I think it's fine; walk methods compare pointers when they need to determine if something changed.

@miretskiy miretskiy merged commit 3be6194 into cockroachdb:master Jan 12, 2023
@miretskiy
Copy link
Contributor Author

Argh; accidentally merged w/out updates to doc string.

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