Skip to content

Commit

Permalink
Include incremental secondary index files in restore.
Browse files Browse the repository at this point in the history
  • Loading branch information
mattl-netflix committed May 4, 2024
1 parent c1b751f commit b429499
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
15 changes: 10 additions & 5 deletions priam/src/main/java/com/netflix/priam/backupv2/MetaV2Proxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,16 @@ private String getMatch(

@Override
public ImmutableList<AbstractBackupPath> getIncrementals(DateUtil.DateRange dateRange) {
String incrementalPrefix = getMatch(dateRange, AbstractBackupPath.BackupFileType.SST_V2);
String marker =
getMatch(
new DateUtil.DateRange(dateRange.getStartTime(), null),
AbstractBackupPath.BackupFileType.SST_V2);
return new ImmutableList.Builder<AbstractBackupPath>()
.addAll(getIncrementals(dateRange, AbstractBackupPath.BackupFileType.SST_V2))
.addAll(getIncrementals(dateRange, AbstractBackupPath.BackupFileType.SECONDARY_INDEX_V2))
.build();
}

private ImmutableList<AbstractBackupPath> getIncrementals(
DateUtil.DateRange dateRange, AbstractBackupPath.BackupFileType type) {
String incrementalPrefix = getMatch(dateRange, type);
String marker = getMatch(new DateUtil.DateRange(dateRange.getStartTime(), null), type);
logger.info(
"Listing filesystem with prefix: {}, marker: {}, daterange: {}",
incrementalPrefix,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,16 @@ public void testGetSSTFilesFromMeta() throws Exception {
@Test
public void testGetIncrementalFiles() throws Exception {
DateUtil.DateRange dateRange = new DateUtil.DateRange("202812071820,20281229");
Truth.assertThat(metaProxy.getIncrementals(dateRange)).hasSize(3);
ImmutableList<AbstractBackupPath> paths = metaProxy.getIncrementals(dateRange);
Truth.assertThat(paths).hasSize(4);
}

@Test
public void testGetIncrementalFilesIncludesSecondaryIndexes() throws Exception {
DateUtil.DateRange dateRange = new DateUtil.DateRange("202812071820,20281229");
ImmutableList<AbstractBackupPath> paths = metaProxy.getIncrementals(dateRange);
Truth.assertThat(paths.get(3).getType())
.isEqualTo(AbstractBackupPath.BackupFileType.SECONDARY_INDEX_V2);
}

@Test
Expand Down Expand Up @@ -223,6 +232,16 @@ private List<String> getRemoteFakeFiles() {
"SNAPPY",
"PLAINTEXT",
"file4-Data.db"));
files.add(
Paths.get(
getPrefix(),
AbstractBackupPath.BackupFileType.SECONDARY_INDEX_V2.toString(),
"1859828420000",
"keyspace1",
"columnfamily1",
"SNAPPY",
"PLAINTEXT",
"file5-Data.db"));
files.add(
Paths.get(
getPrefix(),
Expand Down

0 comments on commit b429499

Please sign in to comment.