Skip to content

changefeedccl: Fix cluster ID check logic#106359

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
miretskiy:fut
Jul 7, 2023
Merged

changefeedccl: Fix cluster ID check logic#106359
craig[bot] merged 1 commit intocockroachdb:masterfrom
miretskiy:fut

Conversation

@miretskiy
Copy link
Copy Markdown
Contributor

@miretskiy miretskiy commented Jul 7, 2023

Changefeeds created prior to
#99841 do not have cluster ID field set in their job record. As a result, when upgrading to 23.1.x version, changefeeds created prior to that version will fail with an error message introduced by the above PR.

Fix the cluster ID checking logic to handle this case.
Fixes #106358

Release note (enterprise change): Changefeeds should no longer fail when upgrading to version 23.1.5.

@miretskiy miretskiy requested review from dt and samiskin July 7, 2023 01:19
@miretskiy miretskiy requested a review from a team as a code owner July 7, 2023 01:19
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@miretskiy miretskiy added the backport-23.1.x PAST MAINTENANCE SUPPORT: 23.1 patch releases via ER request only label Jul 7, 2023
`foo: [0]->{"after": null}`,
})
}
cdcTest(t, testFn, feedTestForceSink("cloudstorage"))
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.

I assume this would work with feedTestEnterpriseSinks

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure; I just copied it from elsewhere; changed.

Comment on lines +1406 to +1410
// Resume; we expect to see deleted row.
require.NoError(t, jobFeed.Resume())
assertPayloads(t, foo, []string{
`foo: [0]->{"after": null}`,
})
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.

Could add a check for us automatically setting the CreationClusterID correctly afterwards after resuming

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good idea; done.

Comment on lines +1111 to +1112
// ensureClusterIDMatches verifies that this job record matches
// the cluster ID of this cluster.
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.

could help to mention the context (streaming replication) in which this would error

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

extended comment.

// the cluster ID of this cluster.
func (b *changefeedResumer) ensureClusterIDMatches(ctx context.Context, clusterID uuid.UUID) error {
if createdBy := b.job.Payload().CreationClusterID; createdBy == uuid.Nil {
// This cluster was upgraded from the version that did not set clusterID
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.

Suggested change
// This cluster was upgraded from the version that did not set clusterID
// This cluster was upgraded from a version that did not set clusterID

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

Changefeeds created prior to
cockroachdb#99841 do not
have cluster ID field set in their job record.  As a result,
when upgrading to 23.1.x version, changefeeds created prior
to that version will fail with an error message introduced
by the above PR.

Fix the cluster ID checking logic to handle this case.
Fixes cockroachdb#106358

Release note (enterprise change): Changefeeds should no longer
fail when upgrading to version 23.1.5.
@miretskiy
Copy link
Copy Markdown
Contributor Author

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jul 7, 2023

Build succeeded:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-23.1.x PAST MAINTENANCE SUPPORT: 23.1 patch releases via ER request only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cdc: Changefeed fail when upgrading to 23.1.x

3 participants