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

Fix issue with S3 FS not working with segments with spaces in the name #10055

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,13 @@ public void reloadSegment(String segmentName, IndexLoadingConfig indexLoadingCon
// doesn't load anything from an empty indexDir, but gets the info to complete the copyTo.
try (SegmentDirectory segmentDirectory = initSegmentDirectory(segmentName, String.valueOf(zkMetadata.getCrc()),
indexLoadingConfig)) {
if (segmentDirectory.isDirectoryMatchingWithLatestConfigs()) {
// The segment directory is already in sync with latest configs
ImmutableSegment segment = ImmutableSegmentLoader.load(indexDir, indexLoadingConfig, schema);
addSegment(segment);
removeBackup(indexDir);
return;
}
segmentDirectory.copyTo(indexDir);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ private String normalizeToDirectoryPrefix(URI uri)
Preconditions.checkNotNull(uri, "uri is null");
URI strippedUri = getBase(uri).relativize(uri);
if (isPathTerminatedByDelimiter(strippedUri)) {
return sanitizePath(strippedUri.getPath());
return sanitizePath(strippedUri.toString());
}
return sanitizePath(strippedUri.getPath() + DELIMITER);
return sanitizePath(strippedUri.toString() + DELIMITER);
}

private URI normalizeToDirectoryUri(URI uri)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ public SegmentLocalFSDirectory(File directoryFile, SegmentMetadataImpl metadata,
}
}

@Override
public boolean isDirectoryMatchingWithLatestConfigs() {
return false;
}

@Override
public URI getIndexDir() {
return _indexDir.toURI();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@
*/
public abstract class SegmentDirectory implements Closeable {

public abstract boolean isDirectoryMatchingWithLatestConfigs();
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this API stands for?


public abstract URI getIndexDir();

public abstract SegmentMetadataImpl getSegmentMetadata();
Expand Down