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

Adds flush.file.size to allow file size based rotation #671

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Usiel
Copy link

@Usiel Usiel commented Nov 10, 2023

Problem

See: #365

We want to be able to control the size of the files produced by the connector.

Solution

This change gets us in the vicinity of such a feature. A file size guarantee would require a major rewrite, as the current logic is based on partitions.

The file size based rotation is implemented in such a way, that we rotate all open files for a given TopicPartitionWriter instance, when any file has reached the configured limit.

I wanted a solution that does not have to count bytes and do unnecessary serialization, thus I implemented a few wrappers around the existing OutputStreams, which allow us to access the current file size. This implies that, even with small messages, we will produce files that may be larger than configured depending on the size of the output buffers.

I'm happy to work on this more, if you all are open to this feature. For the use case I have at my company, this current version is sufficient.

Does this solution apply anywhere else?
  • yes
  • no
If yes, where?

Test Strategy

Testing done:
  • Unit tests (might add some)
  • Integration tests
  • System tests
  • Manual tests

I am running this on a Kafka Connect 7.2.4 cluster, so far no issues with String and Avro formats.

Being able to control the size of the written files is extremely helpful. This change gets us in the vicinity of such a feature.
A file size guarantee would require a major rewrite, as the current logic is heavily based on partitions. The file size based rotation
is implemented in such a way, that we rotate all open files for a given `TopicPartitionWriter` instance, when any file has reached
the configured limit.

See: confluentinc#365
@Usiel Usiel requested a review from a team as a code owner November 10, 2023 10:11
Copy link

cla-assistant bot commented Nov 10, 2023

CLA assistant check
All committers have signed the CLA.

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.

None yet

1 participant