Skip to content

Commit

Permalink
Fix translog GC generation range
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 21, 2024
1 parent 20c7f05 commit 55f1963
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ public static Set<String> getPinnedTimestampLockedFiles(
*
* @param metadataFiles List of metadata file names to filter.
* @param getTimestampFunction Function to extract timestamp from a file name.
* @param minimumAge Minimum age threshold for filtering.
* @param maximumAllowedTimestamp Minimum age threshold for filtering.
* @return A list of metadata file names that are older than the minimum age.
*/
public static List<String> filterOutMetadataFilesBasedOnAge(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -699,14 +699,23 @@ public void onResponse(List<BlobMetadata> blobMetadata) {
for (long generation = maxGenerationToBeDeleted; generation >= minGenerationToBeDeleted; generation--) {
// 8. Check if the generation is not referred by metadata file matching pinned timestamps
Tuple<Long, Long> ceilingGenerationRange = pinnedGenerations.ceiling(new Tuple<>(generation, generation));
if (ceilingGenerationRange != null
Tuple<Long, Long> floorGenerationRange = pinnedGenerations.floor(new Tuple<>(generation, generation));
if ((ceilingGenerationRange != null
&& generation >= ceilingGenerationRange.v1()
&& generation <= ceilingGenerationRange.v2()) {
&& generation <= ceilingGenerationRange.v2())
|| (floorGenerationRange != null
&& generation >= floorGenerationRange.v1()
&& generation <= floorGenerationRange.v2())) {
continue;
}
logger.warn("PinnedGenerations: {}", pinnedGenerations);
logger.warn("CeilingGenerationRange: {}", ceilingGenerationRange);
logger.warn("FloorGenerationRange: {}", floorGenerationRange);
logger.warn("Generation: {}", generation);
generationsToDelete.add(generation);
}
logger.warn("Generations to delete: {}", generationsToDelete.size());
logger.warn("Number of generations to delete: {}", generationsToDelete.size());
logger.warn("Generations to delete: {}", generationsToDelete);
if (generationsToDelete.isEmpty() == false) {
// 9. Delete stale generations
deleteRemoteGenerations(generationsToDelete);
Expand Down

0 comments on commit 55f1963

Please sign in to comment.