Skip to content

bulker: Add configurable retention time for retry topic #25

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

Merged
merged 1 commit into from
Mar 23, 2025

Conversation

dmeremyanin
Copy link
Contributor

@dmeremyanin dmeremyanin commented Mar 9, 2025

Overview

This PR includes the following updates related to Kafka env variables:

  1. Add documentation for BULKER_KAFKA_TOPIC_SEGMENT_HOURS - added a description for the environment variable in the documentation to clarify its purpose and default value (24h).
  2. Correct default value for BULKER_KAFKA_TOPIC_RETENTION_HOURS in the documentation - fixed the default value for the environment variable to reflect the actual setting.
  3. Fix code to use KAFKA_RETRY_TOPIC_RETENTION_HOURS - updated the code to properly use the environment variable, which was documented but not used in the code.

@@ -196,10 +196,16 @@ e.g. if `BULKER_KAFKA_TOPIC_PREFIX=some.prefix.`, then a full topic name could b

### `BULKER_KAFKA_TOPIC_RETENTION_HOURS`

*Optional, default value: `168` (7 days)*
*Optional, default value: `48` (2 days)*
Copy link
Contributor Author

Choose a reason for hiding this comment

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

KafkaTopicRetentionHours int `mapstructure:"KAFKA_TOPIC_RETENTION_HOURS" default:"48"`


Main topic retention time in hours.

### `BULKER_KAFKA_TOPIC_SEGMENT_HOURS`

*Optional, default value: `24` (1 day)*
Copy link
Contributor Author

Choose a reason for hiding this comment

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

KafkaTopicSegmentHours int `mapstructure:"KAFKA_TOPIC_SEGMENT_HOURS" default:"24"`

@@ -28,6 +28,7 @@ type KafkaConfig struct {
KafkaFetchMessageMaxBytes int `mapstructure:"KAFKA_FETCH_MESSAGE_MAX_BYTES" default:"1048576"`

KafkaRetryTopicSegmentBytes int `mapstructure:"KAFKA_RETRY_TOPIC_SEGMENT_BYTES" default:"104857600"`
KafkaRetryTopicRetentionHours int `mapstructure:"KAFKA_RETRY_TOPIC_RETENTION_HOURS" default:"168"`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

### `BULKER_KAFKA_RETRY_TOPIC_RETENTION_HOURS`
*Optional, default value: `168` (7 days)*
Topic for retried events retention time in hours.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you!

Actually 7 days is too high value for that. When doing retries, retry consumer re-produces messages that are not ready yet. There is no point of having that retention higher than KafkaTopicRetentionHours

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it, I used the default value from the docs. What value would you recommend for this? Should we set it to match the KafkaTopicRetentionHours value (2 days)?"

Copy link
Contributor

Choose a reason for hiding this comment

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

2 days is ok

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, I've updated the default value to 2 days.

@dmeremyanin dmeremyanin force-pushed the retry-topic-retention branch from 1ac144e to cac1100 Compare March 17, 2025 01:18
@absorbb absorbb merged commit ead0738 into jitsucom:main Mar 23, 2025
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