HBASE-15526 Make SnapshotManager accessible through MasterServices

This commit is contained in:
tedyu 2016-03-24 15:59:46 -07:00
parent ad3feaa448
commit 07c597c8a2
4 changed files with 15 additions and 4 deletions

View File

@ -2452,10 +2452,9 @@ public class HMaster extends HRegionServer implements MasterServices {
}
/**
* Exposed for TESTING!
* @return the underlying snapshot manager
*/
public SnapshotManager getSnapshotManagerForTesting() {
public SnapshotManager getSnapshotManager() {
return this.snapshotManager;
}

View File

@ -34,6 +34,7 @@ import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.executor.ExecutorService;
import org.apache.hadoop.hbase.master.normalizer.RegionNormalizer;
import org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv;
import org.apache.hadoop.hbase.master.snapshot.SnapshotManager;
import org.apache.hadoop.hbase.procedure2.ProcedureExecutor;
import org.apache.hadoop.hbase.quotas.MasterQuotaManager;
import org.apache.hadoop.hbase.security.User;
@ -45,6 +46,11 @@ import com.google.protobuf.Service;
*/
@InterfaceAudience.Private
public interface MasterServices extends Server {
/**
* @return the underlying snapshot manager
*/
SnapshotManager getSnapshotManager();
/**
* @return Master's instance of {@link ClusterSchema}
*/

View File

@ -64,6 +64,7 @@ import org.apache.hadoop.hbase.io.Reference;
import org.apache.hadoop.hbase.master.CatalogJanitor.SplitParentFirstComparator;
import org.apache.hadoop.hbase.master.normalizer.RegionNormalizer;
import org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv;
import org.apache.hadoop.hbase.master.snapshot.SnapshotManager;
import org.apache.hadoop.hbase.procedure2.ProcedureExecutor;
import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
import org.apache.hadoop.hbase.protobuf.generated.AdminProtos;
@ -242,6 +243,11 @@ public class TestCatalogJanitor {
return -1;
}
@Override
public SnapshotManager getSnapshotManager() {
return null;
}
@Override
public AssignmentManager getAssignmentManager() {
return this.asm;

View File

@ -131,7 +131,7 @@ public class TestSnapshotFromMaster {
@Before
public void setup() throws Exception {
UTIL.createTable(TABLE_NAME, TEST_FAM);
master.getSnapshotManagerForTesting().setSnapshotHandlerForTesting(TABLE_NAME, null);
master.getSnapshotManager().setSnapshotHandlerForTesting(TABLE_NAME, null);
}
@After
@ -185,7 +185,7 @@ public class TestSnapshotFromMaster {
Mockito.when(mockHandler.getCompletionTimestamp())
.thenReturn(EnvironmentEdgeManager.currentTime());
master.getSnapshotManagerForTesting()
master.getSnapshotManager()
.setSnapshotHandlerForTesting(TABLE_NAME, mockHandler);
// if we do a lookup without a snapshot name, we should fail - you should always know your name