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

release-19.2: changefeedccl: add scan boundaries based on change in set of columns #42669

Merged

Conversation

aayushshah15
Copy link
Contributor

Backport 1/1 commits from #42053.

/cc @cockroachdb/release


Currently, the changefeed poller detects a scan boundary when
detects that the last version of a table descriptor has a
mutation but the current version doesn't. In case of an ALTER TABLE DROP COLUMN statement, the point at which this happens is the point
at which the schema change backfill completes. This is incorrect since
the dropped column is logically dropped before this point.

This PR corrects this problem by instead checking that the last version of the descriptor has a mutation AND that the number of columns in the current table descriptor is different from the number of columns in the last table descriptor.

Fixes #41961

Release note (bug fix): Changefeeds now emit backfill row updates for
dropped column when the table descriptor drops
that column.

@aayushshah15 aayushshah15 requested a review from danhhz November 21, 2019 19:39
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@danhhz
Copy link
Contributor

danhhz commented Dec 2, 2019

@ajwerner what was our decision here? hold off on merging this in 19.2.2 and get it into 19.2.3?

@ajwerner
Copy link
Contributor

ajwerner commented Dec 2, 2019

Totally dropped the ball on this one, looking now.

@danhhz
Copy link
Contributor

danhhz commented Dec 2, 2019

You're fine, I'm also a reviewer. I was intentionally waiting because I thought we were going to hold off on merging this, but dropped the ball on putting that fact down here

Copy link
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

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

What's going on w.r.t. the build here?

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @ajwerner and @danhhz)

@danhhz
Copy link
Contributor

danhhz commented Dec 2, 2019

GitHub API token environment variable GITHUB_API_TOKEN is not set I think this happened to be opened while that was broken. I think it's since been fixed. I'll ping rerun

Copy link
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

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

:lgtm:

I'm cool with this change even going in to 19.2.2 if there's no drama getting it to build. This change is certainly a behavior change and seems like the riskiest of the backports we plan to actually do but it's also a good change.

Reviewed 4 of 4 files at r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @aayushshah15 and @danhhz)


pkg/ccl/changefeedccl/cdctest/testfeed.go, line 528 at r1 (raw file):

}

// ReformatJSON marshals a golang stdlib based JSON into a byte slice preserving

nit: this comment could use another pass.

@aayushshah15
Copy link
Contributor Author

pkg/ccl/changefeedccl/changefeed_test.go:781:9: it.SeekGE undefined (type engine.SimpleIterator has no field or method SeekGE)
seems like there was an interface change that wasn't backported.

@petermattis
Copy link
Collaborator

pkg/ccl/changefeedccl/changefeed_test.go:781:9: it.SeekGE undefined (type engine.SimpleIterator has no field or method SeekGE)
seems like there was an interface change that wasn't backported.

Correct. See #42390. We don't want to backport the interface change. Instead, you should adapt the backport to the old interface. That is, s/SeekGE/Seek/g.

@ajwerner
Copy link
Contributor

ajwerner commented Dec 2, 2019

pkg/ccl/changefeedccl/changefeed_test.go:781:9: it.SeekGE undefined (type engine.SimpleIterator has no field or method SeekGE)
seems like there was an interface change that wasn't backported.

I want to say this was just a name change. See Seek?

Currently, the changefeed poller detects a scan boundary when it
detects that the last version of a table descriptor has a pending
mutation but the current version doesn't. In case of an `ALTER TABLE
DROP COLUMN` statement, the point at which this happens is the point at
which the schema change backfill completes. However, this is incorrect
since the dropped column gets logically dropped before that.

This PR corrects this problem by instead using the set of column
descriptors within the current and previous table descriptors to detect a
scan boundary.

Fixes cockroachdb#41961

Release note (bug fix): Changefeeds now emit backfill row updates for
                        dropped column when the table descriptor drops
                        that column.
Copy link
Contributor Author

@aayushshah15 aayushshah15 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 (and 1 stale) (waiting on @ajwerner and @danhhz)


pkg/ccl/changefeedccl/cdctest/testfeed.go, line 528 at r1 (raw file):

Previously, ajwerner wrote…

nit: this comment could use another pass.

Done. let me know if it's still unclear.

@aayushshah15
Copy link
Contributor Author

The build should succeed now. are we good to merge this once it's green?

@ajwerner
Copy link
Contributor

ajwerner commented Dec 2, 2019

The build should succeed now. are we good to merge this once it's green?

Fine by me.

@aayushshah15 aayushshah15 merged commit 504ed39 into cockroachdb:release-19.2 Dec 2, 2019
@aayushshah15 aayushshah15 deleted the backport19.2-42053 branch December 11, 2019 05:42
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.

5 participants