From b7df66f1a811a130c6fcc57d110659601c9c0cdd Mon Sep 17 00:00:00 2001 From: tedyu Date: Thu, 31 Mar 2016 15:49:07 -0700 Subject: [PATCH] HBASE-15571 Make MasterProcedureManagerHost accessible through MasterServices --- .../java/org/apache/hadoop/hbase/master/HMaster.java | 9 ++++++++- .../apache/hadoop/hbase/master/MasterRpcServices.java | 6 +++--- .../org/apache/hadoop/hbase/master/MasterServices.java | 6 ++++++ .../apache/hadoop/hbase/master/TestCatalogJanitor.java | 6 ++++++ 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java index 481d1d3d018..79070a5aeae 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java @@ -326,7 +326,7 @@ public class HMaster extends HRegionServer implements MasterServices, Server { // monitor for snapshot of hbase tables SnapshotManager snapshotManager; // monitor for distributed procedures - MasterProcedureManagerHost mpmHost; + private MasterProcedureManagerHost mpmHost; // it is assigned after 'initialized' guard set to true, so should be volatile private volatile MasterQuotaManager quotaManager; @@ -2484,6 +2484,13 @@ public class HMaster extends HRegionServer implements MasterServices, Server { return this.snapshotManager; } + /** + * @return the underlying MasterProcedureManagerHost + */ + public MasterProcedureManagerHost getMasterProcedureManagerHost() { + return mpmHost; + } + @Override public void createNamespace( final NamespaceDescriptor descriptor, diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java index f391ca39f5d..c7bf4af164d 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java @@ -725,7 +725,7 @@ public class MasterRpcServices extends RSRpcServices try { master.checkInitialized(); ProcedureDescription desc = request.getProcedure(); - MasterProcedureManager mpm = master.mpmHost.getProcedureManager( + MasterProcedureManager mpm = master.getMasterProcedureManagerHost().getProcedureManager( desc.getSignature()); if (mpm == null) { throw new ServiceException("The procedure is not registered: " @@ -760,7 +760,7 @@ public class MasterRpcServices extends RSRpcServices try { master.checkInitialized(); ProcedureDescription desc = request.getProcedure(); - MasterProcedureManager mpm = master.mpmHost.getProcedureManager( + MasterProcedureManager mpm = master.getMasterProcedureManagerHost().getProcedureManager( desc.getSignature()); if (mpm == null) { throw new ServiceException("The procedure is not registered: " @@ -963,7 +963,7 @@ public class MasterRpcServices extends RSRpcServices try { master.checkInitialized(); ProcedureDescription desc = request.getProcedure(); - MasterProcedureManager mpm = master.mpmHost.getProcedureManager( + MasterProcedureManager mpm = master.getMasterProcedureManagerHost().getProcedureManager( desc.getSignature()); if (mpm == null) { throw new ServiceException("The procedure is not registered: " diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterServices.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterServices.java index a1bcd7da4a5..b9a3f83804c 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterServices.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterServices.java @@ -34,6 +34,7 @@ import org.apache.hadoop.hbase.TableNotDisabledException; import org.apache.hadoop.hbase.TableNotFoundException; import org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv; import org.apache.hadoop.hbase.master.snapshot.SnapshotManager; +import org.apache.hadoop.hbase.procedure.MasterProcedureManagerHost; import org.apache.hadoop.hbase.procedure2.ProcedureExecutor; import org.apache.hadoop.hbase.executor.ExecutorService; import org.apache.hadoop.hbase.quotas.MasterQuotaManager; @@ -51,6 +52,11 @@ public interface MasterServices extends Server { */ SnapshotManager getSnapshotManager(); + /** + * @return the underlying MasterProcedureManagerHost + */ + MasterProcedureManagerHost getMasterProcedureManagerHost(); + /** * @return Master's instance of the {@link AssignmentManager} */ diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestCatalogJanitor.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestCatalogJanitor.java index 2d1c0e8004e..dbcdf7cb474 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestCatalogJanitor.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestCatalogJanitor.java @@ -65,6 +65,7 @@ import org.apache.hadoop.hbase.io.Reference; import org.apache.hadoop.hbase.master.CatalogJanitor.SplitParentFirstComparator; import org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv; import org.apache.hadoop.hbase.master.snapshot.SnapshotManager; +import org.apache.hadoop.hbase.procedure.MasterProcedureManagerHost; import org.apache.hadoop.hbase.procedure2.ProcedureExecutor; import org.apache.hadoop.hbase.protobuf.ProtobufUtil; import org.apache.hadoop.hbase.protobuf.generated.AdminProtos; @@ -241,6 +242,11 @@ public class TestCatalogJanitor { return null; } + @Override + public MasterProcedureManagerHost getMasterProcedureManagerHost() { + return null; + } + @Override public AssignmentManager getAssignmentManager() { return this.asm;