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

Recover the offset from HDFS, even if topic name is not present in storage path #516

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 7 additions & 1 deletion src/main/java/io/confluent/connect/hdfs/FileUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

import io.confluent.connect.hdfs.filter.CommittedFileFilter;
import io.confluent.connect.hdfs.storage.Storage;
import io.confluent.connect.storage.common.StorageCommonConfig;

public class FileUtils {
private static final Logger log = LoggerFactory.getLogger(FileUtils.class);
Expand Down Expand Up @@ -101,7 +102,12 @@ public static String committedFileName(
}

public static String topicDirectory(String url, String topicsDir, String topic) {
return url + "/" + topicsDir + "/" + topic;
boolean topicInPath = Boolean.valueOf(StorageCommonConfig.PATH_INCLUDE_TOPICNAME_CONFIG);

Choose a reason for hiding this comment

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

This will always be false since you're parsing the config string, not looking up the value in the config

if (topicInPath) {
return url + "/" + topicsDir + "/" + topic;
} else {
return url + "/" + topicsDir;
}
}

public static FileStatus fileStatusWithMaxOffset(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ private static class BiHourlyPartitioner extends TimeBasedPartitioner {

@Override
public void configure(Map<String, Object> config) {
super.configure(config);
init(partitionDurationMs, pathFormat, Locale.FRENCH, DATE_TIME_ZONE, config);
}

Expand Down