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 d51863c commit 7bb2a38
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 6 deletions.
17 changes: 12 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 @@ -84,11 +84,18 @@ 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 @@ -17,6 +17,7 @@

package com.netflix.priam.backupv2;

import com.google.common.collect.ImmutableList;
import com.google.common.truth.Truth;
import com.google.inject.Guice;
import com.google.inject.Injector;
Expand Down Expand Up @@ -131,7 +132,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 @@ -221,6 +231,17 @@ private List<String> getRemoteFakeFiles() {
"SNAPPY",
"PLAINTEXT",
"file4-Data.db"));
files.add(
Paths.get(
getPrefix(),
AbstractBackupPath.BackupFileType.SECONDARY_INDEX_V2.toString(),
"1859828420000",
"keyspace1",
"columnfamily1",
"index1",
"SNAPPY",
"PLAINTEXT",
"file5-Data.db"));
files.add(
Paths.get(
getPrefix(),
Expand Down

0 comments on commit 7bb2a38

Please sign in to comment.