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

CXP-3032: Race condition during local.buffer.dir creation #43

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ allprojects {
apply plugin: 'maven-publish'

group = 'com.spredfast.kafka.connect.s3'
version = '1.2.0'
version = '1.2.1'

apply plugin: 'java-library'
sourceCompatibility = 11
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,11 @@ private PartitionWriter(TopicPartition tp, SinkRecord firstRecord) throws IOExce
.orElseThrow(() -> new ConnectException("No local buffer directory configured"));

File directory = new File(localBufferDirectory);
if (!directory.exists() && !directory.mkdirs()) {
int attempts = 3;
while (attempts > 0 && !directory.exists() && !directory.mkdirs()) {
attempts--;

Choose a reason for hiding this comment

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

Does it really work without sleep?

Copy link
Author

Choose a reason for hiding this comment

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

Sleep won't change anything here. By the time it fails, the directory already exists: the adjacent task on the same worker is faster with creating it.

}
if (!directory.exists()) {
throw new ConnectException("Could not create directory " + localBufferDirectory);
}

Expand Down
Loading