Skip to content

Commit

Permalink
Always TTL backups. (#1038)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattl-netflix committed Apr 15, 2023
1 parent c107cf3 commit 7247964
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Expand Up @@ -68,21 +68,20 @@ public void scheduleService() throws Exception {
// restart.
snapshotMetaTask.uploadFiles();

// Schedule the TTL service
TaskTimer timer =
BackupTTLTask.getTimer(backupRestoreConfig, tokenRetriever.getRingPosition());
scheduleTask(scheduler, BackupTTLTask.class, timer);

// Schedule the backup verification service
scheduleTask(
scheduler,
BackupVerificationTask.class,
BackupVerificationTask.getTimer(backupRestoreConfig));
} else {
scheduler.deleteTask(BackupTTLTask.JOBNAME);
scheduler.deleteTask(BackupVerificationTask.JOBNAME);
}

// Schedule the TTL service
TaskTimer timer =
BackupTTLTask.getTimer(backupRestoreConfig, tokenRetriever.getRingPosition());
scheduleTask(scheduler, BackupTTLTask.class, timer);

// Start the Incremental backup schedule if enabled
scheduleTask(
scheduler,
Expand Down
Expand Up @@ -17,6 +17,7 @@

package com.netflix.priam.backupv2;

import com.google.common.truth.Truth;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.netflix.priam.backup.AbstractBackup;
Expand Down Expand Up @@ -72,6 +73,8 @@ public void testBackupDisabled(
{
backupRestoreConfig.getSnapshotMetaServiceCronExpression();
result = "-1";
backupRestoreConfig.getBackupTTLMonitorPeriodInSec();
result = 600;
configuration.getDataFileLocation();
result = "target/data";
}
Expand Down Expand Up @@ -109,7 +112,7 @@ public void testBackupDisabled(
cassandraTunerService,
tokenRetriever);
backupService.scheduleService();
Assert.assertTrue(scheduler.getScheduler().getJobGroupNames().isEmpty());
Truth.assertThat(scheduler.getScheduler().getJobGroupNames()).hasSize(1);

// snapshot V2 name should not be there.
Set<Path> backupPaths =
Expand Down Expand Up @@ -220,6 +223,6 @@ public void updateService(
Assert.assertEquals(3, scheduler.getScheduler().getJobKeys(null).size());

backupService.onChangeUpdateService();
Assert.assertEquals(0, scheduler.getScheduler().getJobKeys(null).size());
Assert.assertEquals(1, scheduler.getScheduler().getJobKeys(null).size());
}
}

0 comments on commit 7247964

Please sign in to comment.