Skip to content

Conversation

@shanthoosh
Copy link
Contributor

@shanthoosh shanthoosh commented Jan 14, 2020

Symptom: Checkpoint and changelog kafka topics of a samza job may be created with cleanup.policy set to 'delete' instead of 'compact' for certain cases.

Cause:

  • Checkpoint: The control-flow in KafkaStreamSpec to build checkpoint spec swallows the essential kafka-topic configuration rather it passes empty configuration bag to kafka-broker. This behavior was introduced in SAMZA-2339.
  • Changelog: The change-log topic configurations were incorrectly generated when the RocksDB store TTL is set to -1 by the user. This behavior was introduced in SAMZA-1929.

Changes: Fix the topic-creation control-flow for the metadata topics and generate the correct topic-configurations.

Tests: Added unit tests to validate that the expected topic configuration bag was generated for both checkpoint and changelog topics.

API Changes: None

Upgrade Instructions: None

Usage Instructions: None

@shanthoosh
Copy link
Contributor Author

@prateekm Can you please take a look at this patch.

Copy link
Contributor Author

@shanthoosh shanthoosh left a comment

Choose a reason for hiding this comment

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

Thanks for the review.

Copy link
Contributor

@prateekm prateekm left a comment

Choose a reason for hiding this comment

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

Thanks for the fix.

checkpointTopicProperties.putAll(spec.getConfig());
kafkaSpec = KafkaStreamSpec.fromSpec(StreamSpec.createCheckpointStreamSpec(spec.getPhysicalName(), spec.getSystemName()))
.copyWithReplicationFactor(Integer.parseInt(new KafkaConfig(config).getCheckpointReplicationFactor().get()))
.copyWithProperties(checkpointTopicProperties);
Copy link
Contributor

Choose a reason for hiding this comment

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

We can do it separately, can we add .copyWithConfig or .copyWithMap which takes Config or Map<String, String> ?

copyWithProperties is not user friendly, as we are converting a Map/Config to a properties, and this method basically convert it back.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, adding the copyWithConfig to KafkaStreamSpec might be good convenience API. We've additional cleanup planned with this control-flow in the near-future. If acceptable, then I can couple this change with that. Since it's a critical bug-fix, I would prefer to keep the change minimal by containing it to the fix alone and do the clean-up later.

@shanthoosh shanthoosh merged commit 80c799d into apache:master Jan 15, 2020
rmatharu-zz pushed a commit to rmatharu-zz/samza that referenced this pull request Jan 21, 2020
…ache#1251)

* Fix the checkpoint and changelog topic creation configurations.

* Address review comments.

* Address review comments.
lhaiesp pushed a commit that referenced this pull request Feb 6, 2020
)

* Fix the checkpoint and changelog topic creation configurations.

* Address review comments.

* Address review comments.
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.

3 participants