Search in sources :

Example 6 with SnapshotManager

use of org.apache.hadoop.hbase.master.snapshot.SnapshotManager in project hbase by apache.

the class TestSnapshotCleanerChore method testSnapshotCleanerWithNoTtlExpired.

@Test
public void testSnapshotCleanerWithNoTtlExpired() throws IOException {
    snapshotManager = Mockito.mock(SnapshotManager.class);
    Stoppable stopper = new StoppableImplementation();
    Configuration conf = getSnapshotCleanerConf();
    SnapshotCleanerChore snapshotCleanerChore = new SnapshotCleanerChore(stopper, conf, snapshotManager);
    List<SnapshotProtos.SnapshotDescription> snapshotDescriptionList = new ArrayList<>();
    snapshotDescriptionList.add(getSnapshotDescription(-2, "snapshot01", "table01", EnvironmentEdgeManager.currentTime() - 100000));
    snapshotDescriptionList.add(getSnapshotDescription(10, "snapshot02", "table02", EnvironmentEdgeManager.currentTime()));
    Mockito.when(snapshotManager.getCompletedSnapshots()).thenReturn(snapshotDescriptionList);
    try {
        LOG.info("2 Snapshots are completed but TTL is not expired for any of them");
        snapshotCleanerChore.chore();
    } finally {
        stopper.stop("Stopping Test Stopper");
    }
    Mockito.verify(snapshotManager, Mockito.times(0)).deleteSnapshot(Mockito.any());
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) ArrayList(java.util.ArrayList) Stoppable(org.apache.hadoop.hbase.Stoppable) SnapshotManager(org.apache.hadoop.hbase.master.snapshot.SnapshotManager) Test(org.junit.Test)

Aggregations

SnapshotManager (org.apache.hadoop.hbase.master.snapshot.SnapshotManager)6 Configuration (org.apache.hadoop.conf.Configuration)5 Stoppable (org.apache.hadoop.hbase.Stoppable)5 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)3 HBaseTestingUtil (org.apache.hadoop.hbase.HBaseTestingUtil)1 MasterAddressSyncer (org.apache.hadoop.hbase.master.zksyncer.MasterAddressSyncer)1 MetaLocationSyncer (org.apache.hadoop.hbase.master.zksyncer.MetaLocationSyncer)1 MasterProcedureManagerHost (org.apache.hadoop.hbase.procedure.MasterProcedureManagerHost)1 MasterFlushTableProcedureManager (org.apache.hadoop.hbase.procedure.flush.MasterFlushTableProcedureManager)1 RSGroupAdminEndpoint (org.apache.hadoop.hbase.rsgroup.RSGroupAdminEndpoint)1 RSGroupBasedLoadBalancer (org.apache.hadoop.hbase.rsgroup.RSGroupBasedLoadBalancer)1 LoadBalancerTracker (org.apache.hadoop.hbase.zookeeper.LoadBalancerTracker)1 SnapshotCleanupTracker (org.apache.hadoop.hbase.zookeeper.SnapshotCleanupTracker)1 ZKWatcher (org.apache.hadoop.hbase.zookeeper.ZKWatcher)1