Skip to content

Commit

Permalink
Address PR review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Sachin Kale <[email protected]>
  • Loading branch information
Sachin Kale committed Aug 31, 2024
1 parent ac362ee commit dfb69db
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -749,9 +749,10 @@ protected Set<Long> getGenerationsToBeDeleted(

if (RemoteStoreSettings.isPinnedTimestampsEnabled()) {
String latestMetadataFileToBeDeleted = metadataFilesToBeDeleted.get(0);
long maxGenerationFromLatestMetadataFile = metadataFileGenerationMap.containsKey(latestMetadataFileToBeDeleted)
? metadataFileGenerationMap.get(latestMetadataFileToBeDeleted).v2()
: getMinMaxTranslogGenerationFromMetadataFile(latestMetadataFileToBeDeleted, translogTransferManager).v2();
long maxGenerationFromLatestMetadataFile = getMinMaxTranslogGenerationFromMetadataFile(
latestMetadataFileToBeDeleted,
translogTransferManager
).v2();

if (indexDeleted) {
maxGenerationToBeDeleted = maxGenerationFromLatestMetadataFile;
Expand All @@ -762,9 +763,8 @@ protected Set<Long> getGenerationsToBeDeleted(

// From the remaining files, read the oldest file to get min generation to be deleted
String oldestMetadataFileToBeDeleted = metadataFilesToBeDeleted.get(metadataFilesToBeDeleted.size() - 1);
long minGenerationToBeDeleted = metadataFileGenerationMap.containsKey(oldestMetadataFileToBeDeleted)
? metadataFileGenerationMap.get(oldestMetadataFileToBeDeleted).v1()
: getMinMaxTranslogGenerationFromMetadataFile(oldestMetadataFileToBeDeleted, translogTransferManager).v1();
long minGenerationToBeDeleted = getMinMaxTranslogGenerationFromMetadataFile(oldestMetadataFileToBeDeleted, translogTransferManager)
.v1();

TreeSet<Tuple<Long, Long>> pinnedGenerations = getOrderedPinnedMetadataGenerations(metadataFileGenerationMap);
for (long generation = maxGenerationToBeDeleted; generation >= minGenerationToBeDeleted; generation--) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,15 +339,15 @@ private void deleteFileIfExists(Path filePath) throws IOException {
}
}

public TranslogTransferMetadata readMetadata(long timestamp) throws IOException {
if (timestamp <= 0) {
public TranslogTransferMetadata readMetadata(long pinnedTimestamp) throws IOException {
if (pinnedTimestamp <= 0) {
return readMetadata();
}
return readMetadata((blobMetadataList) -> {
List<String> metadataFiles = blobMetadataList.stream().map(BlobMetadata::name).collect(Collectors.toList());
Set<String> metadataFilesMatchingTimestamp = RemoteStoreUtils.getPinnedTimestampLockedFiles(
metadataFiles,
Set.of(timestamp),
Set.of(pinnedTimestamp),
file -> RemoteStoreUtils.invertLong(file.split(METADATA_SEPARATOR)[3]),
TranslogTransferMetadata::getNodeIdByPrimaryTermAndGen,
true
Expand Down

0 comments on commit dfb69db

Please sign in to comment.