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: allow users to alter the sink URI of an existing changefeed #77043

Merged

Conversation

sherman-grewal
Copy link
Contributor

@sherman-grewal sherman-grewal commented Feb 25, 2022

changefeedccl: allow users to alter the sink URI of
an existing changefeed

References #75895

In this PR, we introduce the capability to alter
the sink URI of an existing changefeed. This
can be achieved by executing the following
statement:

ALTER CHANGEFEED <job_id> SET sink = '<sink_uri>'

Note that the sink type cannot be altered. That is,
the sink type must be the same type that was chosen
when the changefeed was initially created.

Release note (enterprise change): Users may now alter
the sink URI of an existing changefeed. This can be
achieved by executing the following statement:

ALTER CHANGEFEED <job_id> SET sink = '<sink_uri>'

Where the sink type of the new sink must match the
sink type of the old sink that was chosen at the
creation of the changefeed.

@sherman-grewal sherman-grewal requested a review from a team as a code owner February 25, 2022 16:32
@sherman-grewal sherman-grewal requested review from HonoreDB and removed request for a team February 25, 2022 16:32
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

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

Reviewed 1 of 3 files at r1.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @HonoreDB and @sherman-grewal)


pkg/ccl/changefeedccl/alter_changefeed_stmt.go, line 181 at r1 (raw file):

					}
					if key == changefeedbase.OptSink {
						newChangefeedStmt.SinkURI = tree.NewDString(value)

This PR is very nice; consider augmenting this logic so that if
newURI scheme differs from old url scheme, then you wipe all of the previously specified sink specific options.

@sherman-grewal sherman-grewal force-pushed the cdc/alter-changefeed-alter-sinks branch 2 times, most recently from 4c16a01 to 730e010 Compare February 25, 2022 19:58
an existing changefeed

In this PR, we introduce the capability to alter
the sink URI of an existing changefeed. This
can be achieved by executing the following
statement:

ALTER CHANGEFEED <job_id> SET sink = '<sink_uri>'

Note that the sink type cannot be altered. That is,
the sink type must be the same type that was chosen
when the changefeed was initially created.

Release note (enterprise change): Users may now alter
the sink URI of an existing changefeed. This can be
achieved by executing the following statement:

ALTER CHANGEFEED <job_id> SET sink = '<sink_uri>'

Where the sink type of the new sink must match the
sink type of the old sink that was chosen at the
creation of the changefeed.
@sherman-grewal sherman-grewal force-pushed the cdc/alter-changefeed-alter-sinks branch from 730e010 to 067f213 Compare February 25, 2022 21:08
Copy link
Contributor Author

@sherman-grewal sherman-grewal 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 @miretskiy)


pkg/ccl/changefeedccl/alter_changefeed_stmt.go, line 181 at r1 (raw file):

Previously, miretskiy (Yevgeniy Miretskiy) wrote…

This PR is very nice; consider augmenting this logic so that if
newURI scheme differs from old url scheme, then you wipe all of the previously specified sink specific options.

As discussed offline, we will be disallowing users to alter changefeed schemes for now. When this option becomes available to users, we will keep this in mind.

@sherman-grewal
Copy link
Contributor Author

bors r+

@craig
Copy link
Contributor

craig bot commented Feb 26, 2022

Build failed:

@sherman-grewal
Copy link
Contributor Author

bors r+

@craig
Copy link
Contributor

craig bot commented Feb 26, 2022

Build succeeded:

if newSinkURI.Scheme != prevSinkURI.Scheme {
return pgerror.Newf(
pgcode.InvalidParameterValue,
`new sink type %q does not match original sink type %q, sink type cannot be altered`,
Copy link
Contributor

Choose a reason for hiding this comment

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

It’d be nice to make it a little more prescriptive, so the user knows what to do next. something like ‘changing the type of a changefeed (in this case %q to %q) is disallowed. use CREATE CHANGEFEED instead.'

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.

4 participants