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

feat(migrations): implement clean command #7153

Merged
merged 2 commits into from
Mar 4, 2021

Conversation

vcrfxia
Copy link
Contributor

@vcrfxia vcrfxia commented Mar 3, 2021

Description

This PR implements the migrations clean command, which cleans up the migrations metadata stream and table (and underlying Kafka topics), if present.

Also fixes a bug around custom migrations stream names.

Testing done

Unit + integration.

Reviewer checklist

  • Ensure docs are updated if necessary. (eg. if a user visible feature is being added or changed).
  • Ensure relevant issues are linked (description should include text like "Fixes #")

@vcrfxia vcrfxia requested a review from a team as a code owner March 3, 2021 23:05
private static boolean sourceExists(final String sourceName, final boolean isTable) {
final String sourceType = isTable ? "TABLE" : "STREAM";
final List<KsqlEntity> entities = makeKsqlRequest("LIST " + sourceType + "S;");
assertThat(entities, hasSize(1));
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm having trouble figuring out why this works - shouldn't the streams FOO and BAR also be listed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's only one entity returned from the ksql server. That one entity is a list of streams (or tables) which may contain multiple streams (or tables).

@@ -73,7 +76,7 @@ private String createVersionTable(final String name, final String topic) {
+ " latest_by_offset(completed_on) AS completed_on, \n"
+ " latest_by_offset(previous) AS previous, \n"
+ " latest_by_offset(error_reason) AS error_reason \n"
+ " FROM migration_events \n"
+ " FROM " + streamName + " \n"
+ " GROUP BY version_key;\n";
Copy link
Contributor

Choose a reason for hiding this comment

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

thanks for fixing this!

@vcrfxia vcrfxia merged commit 2e546b6 into confluentinc:master Mar 4, 2021
@vcrfxia vcrfxia deleted the migrations-clean branch March 4, 2021 02:57
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.

2 participants