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

fix: windowed tables now have cleanup policy compact+delete #5743

Merged
merged 4 commits into from Jul 9, 2020

Conversation

vcrfxia
Copy link
Contributor

@vcrfxia vcrfxia commented Jul 1, 2020

Description

Fixes #5554

BREAKING CHANGE: ksqlDB now creates windowed tables with cleanup policy "compact,delete", rather than "compact". Also, topics that back streams are always created with cleanup policy "delete", rather than the broker default (by default, "delete").

Testing done

Unit tests + manual.

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 July 1, 2020 00:26
Copy link
Contributor

@agavra agavra left a comment

Choose a reason for hiding this comment

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

LGTM, but see inline question about default cleanup behavior

Comment on lines +190 to +191
final Map<String, ?> config =
ImmutableMap.of(TopicConfig.CLEANUP_POLICY_CONFIG, topicCleanUpPolicy);
Copy link
Contributor

Choose a reason for hiding this comment

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

it seems that for create stream previously we were using the default for the cluster, but now we've changed that to explicitly specify delete. Is that correct/desired?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The default is delete: https://kafka.apache.org/documentation/#cleanup.policy

I thought explicitly specifying the policy was cleaner than having empty vs non-empty maps, but if there are situations you're concerned about in terms of correctness we should definitely investigate / return to passing empty maps.

Copy link
Contributor

Choose a reason for hiding this comment

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

Something to check is to see if the CREATE STREAM code path will change the config of a topic to delete if it already exists. Another thing to consider if it's possible (though I wouldn't understand why anyone would do this) to change the default for the cluster for cleanup.policy. If neither of these are a real concern, then I'm happy making it explicit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Turns out it's possible to change the default cleanup.policy using the broker config log.cleanup.policy. I've switched this PR back to specifying empty configs in the case of streams in order to avoid a breaking change, but this behavior (using the default for streams and forcing tables to be compacted) feels weird to me. Is it preferable to use the broker default for streams, rather than specifying delete?

Copy link
Contributor

Choose a reason for hiding this comment

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

Good question, there's definitely a strong argument toward forcing delete for streams... I could be convinced either way, perhaps now I'm actually leaning a little bit toward your original code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I'll go with the original then.

Regarding your other question:

Something to check is to see if the CREATE STREAM code path will change the config of a topic to delete if it already exists.

This never happens since the KafkaTopicClient does not update topics if they exist. (It also doesn't even validate the cleanup policy, only number of replicas and partitions:

validateTopicProperties(topic, numPartitions, replicationFactor);
)

@vcrfxia vcrfxia merged commit 2038770 into confluentinc:master Jul 9, 2020
@vcrfxia vcrfxia deleted the delete-compact branch July 9, 2020 04:12
vcrfxia added a commit to vcrfxia/ksql that referenced this pull request Jul 16, 2020
…tinc#5743)

BREAKING CHANGE: ksqlDB now creates windowed tables with cleanup policy "compact,delete", rather than "compact". Also, topics that back streams are always created with cleanup policy "delete", rather than the broker default (by default, "delete").
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.

Windowed Tables should use [delete, compact] for their Sink Topics
2 participants