void start() throws IOException { if (!noPersistence) { if (server instanceof RegionServerServices) { metaRegion = ((RegionServerServices)server).getFromOnlineRegions( HRegionInfo.FIRST_META_REGIONINFO.getEncodedName()); } if (metaRegion == null) { Configuration conf = server.getConfiguration(); // Config to determine the no of HConnections to META. // A single HConnection should be sufficient in most cases. Only if // you are doing lot of writes (>1M) to META, // increasing this value might improve the write throughput. multiHConnection = new MultiHConnection(conf, conf.getInt("hbase.regionstatestore.meta.connection", 1)); } } initialized = true; }
/** * Initialize this region server flush procedure manager * Uses a zookeeper based member controller. * @param rss region server * @throws KeeperException if the zookeeper cannot be reached */ @Override public void initialize(RegionServerServices rss) throws KeeperException { this.rss = rss; ZooKeeperWatcher zkw = rss.getZooKeeper(); this.memberRpcs = new ZKProcedureMemberRpcs(zkw, MasterFlushTableProcedureManager.FLUSH_TABLE_PROCEDURE_SIGNATURE); Configuration conf = rss.getConfiguration(); long keepAlive = conf.getLong(FLUSH_TIMEOUT_MILLIS_KEY, FLUSH_TIMEOUT_MILLIS_DEFAULT); int opThreads = conf.getInt(FLUSH_REQUEST_THREADS_KEY, FLUSH_REQUEST_THREADS_DEFAULT); // create the actual flush table procedure member ThreadPoolExecutor pool = ProcedureMember.defaultPool(rss.getServerName().toString(), opThreads, keepAlive); this.member = new ProcedureMember(memberRpcs, pool, new FlushTableSubprocedureBuilder()); }
/** * Create a default snapshot handler - uses a zookeeper based member controller. * @param rss region server running the handler * @throws KeeperException if the zookeeper cluster cannot be reached */ @Override public void initialize(RegionServerServices rss) throws KeeperException { this.rss = rss; ZooKeeperWatcher zkw = rss.getZooKeeper(); this.memberRpcs = new ZKProcedureMemberRpcs(zkw, SnapshotManager.ONLINE_SNAPSHOT_CONTROLLER_DESCRIPTION); // read in the snapshot request configuration properties Configuration conf = rss.getConfiguration(); long keepAlive = conf.getLong(SNAPSHOT_TIMEOUT_MILLIS_KEY, SNAPSHOT_TIMEOUT_MILLIS_DEFAULT); int opThreads = conf.getInt(SNAPSHOT_REQUEST_THREADS_KEY, SNAPSHOT_REQUEST_THREADS_DEFAULT); // create the actual snapshot procedure member ThreadPoolExecutor pool = ProcedureMember.defaultPool(rss.getServerName().toString(), opThreads, keepAlive); this.member = new ProcedureMember(memberRpcs, pool, new SnapshotSubprocedureBuilder()); }
@Test public void testRegionCoprocessorHostDefaults() throws Exception { Configuration conf = new Configuration(CONF); HRegion region = mock(HRegion.class); when(region.getRegionInfo()).thenReturn(REGIONINFO); when(region.getTableDesc()).thenReturn(TABLEDESC); RegionServerServices rsServices = mock(RegionServerServices.class); systemCoprocessorLoaded.set(false); tableCoprocessorLoaded.set(false); new RegionCoprocessorHost(region, rsServices, conf); assertEquals("System coprocessors loading default was not honored", systemCoprocessorLoaded.get(), CoprocessorHost.DEFAULT_COPROCESSORS_ENABLED); assertEquals("Table coprocessors loading default was not honored", tableCoprocessorLoaded.get(), CoprocessorHost.DEFAULT_COPROCESSORS_ENABLED && CoprocessorHost.DEFAULT_USER_COPROCESSORS_ENABLED); }
@Test public void testRegionCoprocessorHostAllDisabled() throws Exception { Configuration conf = new Configuration(CONF); conf.setBoolean(CoprocessorHost.COPROCESSORS_ENABLED_CONF_KEY, false); HRegion region = mock(HRegion.class); when(region.getRegionInfo()).thenReturn(REGIONINFO); when(region.getTableDesc()).thenReturn(TABLEDESC); RegionServerServices rsServices = mock(RegionServerServices.class); systemCoprocessorLoaded.set(false); tableCoprocessorLoaded.set(false); new RegionCoprocessorHost(region, rsServices, conf); assertFalse("System coprocessors should not have been loaded", systemCoprocessorLoaded.get()); assertFalse("Table coprocessors should not have been loaded", tableCoprocessorLoaded.get()); }
@Test public void testRegionCoprocessorHostTableLoadingDisabled() throws Exception { Configuration conf = new Configuration(CONF); conf.setBoolean(CoprocessorHost.COPROCESSORS_ENABLED_CONF_KEY, true); // if defaults change conf.setBoolean(CoprocessorHost.USER_COPROCESSORS_ENABLED_CONF_KEY, false); HRegion region = mock(HRegion.class); when(region.getRegionInfo()).thenReturn(REGIONINFO); when(region.getTableDesc()).thenReturn(TABLEDESC); RegionServerServices rsServices = mock(RegionServerServices.class); systemCoprocessorLoaded.set(false); tableCoprocessorLoaded.set(false); new RegionCoprocessorHost(region, rsServices, conf); assertTrue("System coprocessors should have been loaded", systemCoprocessorLoaded.get()); assertFalse("Table coprocessors should not have been loaded", tableCoprocessorLoaded.get()); }
private void OpenRegion(Server server, RegionServerServices rss, HTableDescriptor htd, HRegionInfo hri, OpenRegionCoordination coordination) throws IOException, NodeExistsException, KeeperException, DeserializationException { // Create it OFFLINE node, which is what Master set before sending OPEN RPC ZKAssign.createNodeOffline(server.getZooKeeper(), hri, server.getServerName()); OpenRegionCoordination.OpenRegionDetails ord = coordination.getDetailsForNonCoordinatedOpening(); OpenRegionHandler openHandler = new OpenRegionHandler(server, rss, hri, htd, -1, coordination, ord); rss.getRegionsInTransitionInRS().put(hri.getEncodedNameAsBytes(), Boolean.TRUE); openHandler.process(); // This parse is not used? RegionTransition.parseFrom(ZKAssign.getData(server.getZooKeeper(), hri.getEncodedName())); // delete the node, which is what Master do after the region is opened ZKAssign.deleteNode(server.getZooKeeper(), hri.getEncodedName(), EventType.RS_ZK_REGION_OPENED, server.getServerName()); }
/** * Create an unmanaged {@link HConnection} based on the environment in which we are running the * coprocessor. The {@link HConnection} must be externally cleaned up (we bypass the usual HTable * cleanup mechanisms since we own everything). * @param env environment hosting the {@link HConnection} * @return an unmanaged {@link HConnection}. * @throws IOException if we cannot create the basic connection */ @SuppressWarnings("resource") public static HConnection getConnectionForEnvironment(CoprocessorEnvironment env) throws IOException { Configuration conf = env.getConfiguration(); HConnection connection = null; // this bit is a little hacky - we need to reach kind far into the internals. However, since we // are in a coprocessor (which is part of the internals), this is more ok. if (env instanceof RegionCoprocessorEnvironment) { RegionCoprocessorEnvironment e = (RegionCoprocessorEnvironment) env; RegionServerServices services = e.getRegionServerServices(); if (services instanceof HRegionServer) { connection = new CoprocessorHConnection(conf, (HRegionServer) services); } } // didn't create the custom HConnection, so just create the usual connection. Saves us some conf // lookups, but no network accesses or anything else with excessive overhead. if (connection == null) { connection = HConnectionManager.createConnection(conf); } return connection; }
/** * Create a default snapshot handler - uses a zookeeper based member controller. * @param rss region server running the handler * @throws KeeperException if the zookeeper cluster cannot be reached */ public RegionServerSnapshotManager(RegionServerServices rss) throws KeeperException { this.rss = rss; ZooKeeperWatcher zkw = rss.getZooKeeper(); this.memberRpcs = new ZKProcedureMemberRpcs(zkw, SnapshotManager.ONLINE_SNAPSHOT_CONTROLLER_DESCRIPTION); // read in the snapshot request configuration properties Configuration conf = rss.getConfiguration(); long keepAlive = conf.getLong(SNAPSHOT_TIMEOUT_MILLIS_KEY, SNAPSHOT_TIMEOUT_MILLIS_DEFAULT); int opThreads = conf.getInt(SNAPSHOT_REQUEST_THREADS_KEY, SNAPSHOT_REQUEST_THREADS_DEFAULT); // create the actual snapshot procedure member ThreadPoolExecutor pool = ProcedureMember.defaultPool(rss.getServerName().toString(), opThreads, keepAlive); this.member = new ProcedureMember(memberRpcs, pool, new SnapshotSubprocedureBuilder()); }
private void OpenRegion(Server server, RegionServerServices rss, HTableDescriptor htd, HRegionInfo hri) throws IOException, NodeExistsException, KeeperException { // Create it OFFLINE node, which is what Master set before sending OPEN RPC ZKAssign.createNodeOffline(server.getZooKeeper(), hri, server.getServerName()); int version = ZKAssign.transitionNodeOpening(server.getZooKeeper(), hri, server.getServerName()); OpenRegionHandler openHandler = new OpenRegionHandler(server, rss, hri, htd, version); openHandler.process(); RegionTransitionData data = ZKAssign.getData(server.getZooKeeper(), hri.getEncodedName()); // delete the node, which is what Master do after the region is opened ZKAssign.deleteNode(server.getZooKeeper(), hri.getEncodedName(), EventType.RS_ZK_REGION_OPENED); }
@Test public void testFailedUpdateMeta() throws Exception { Server server = new MockServer(HTU); RegionServerServices rsServices = new MockRegionServerServices(); // Create it OFFLINE, which is what it expects ZKAssign.createNodeOffline(server.getZooKeeper(), TEST_HRI, server.getServerName()); ZKAssign.transitionNodeOpening(server.getZooKeeper(), TEST_HRI, server.getServerName()); // Create the handler OpenRegionHandler handler = new OpenRegionHandler(server, rsServices, TEST_HRI, TEST_HTD) { @Override boolean updateMeta(final HRegion r) { // Fake failure of updating META return false; } }; handler.process(); // Handler should have transitioned it to FAILED_OPEN RegionTransitionData data = ZKAssign.getData(server.getZooKeeper(), TEST_HRI.getEncodedName()); assertEquals(EventType.RS_ZK_REGION_FAILED_OPEN, data.getEventType()); }
@Test public void testFailedUpdateMeta() throws Exception { Server server = new MockServer(HTU); RegionServerServices rsServices = HTU.createMockRegionServerService(); // Create it OFFLINE, which is what it expects ZKAssign.createNodeOffline(server.getZooKeeper(), TEST_HRI, server.getServerName()); // Create the handler OpenRegionHandler handler = new OpenRegionHandler(server, rsServices, TEST_HRI, TEST_HTD) { @Override boolean updateMeta(final HRegion r) { // Fake failure of updating META return false; } }; rsServices.getRegionsInTransitionInRS().put( TEST_HRI.getEncodedNameAsBytes(), Boolean.TRUE); handler.process(); // Handler should have transitioned it to FAILED_OPEN RegionTransition rt = RegionTransition.parseFrom( ZKAssign.getData(server.getZooKeeper(), TEST_HRI.getEncodedName())); assertEquals(EventType.RS_ZK_REGION_FAILED_OPEN, rt.getEventType()); }
@Test public void testTransitionToFailedOpenFromOffline() throws Exception { Server server = new MockServer(HTU); RegionServerServices rsServices = HTU.createMockRegionServerService(server.getServerName()); // Create it OFFLINE, which is what it expects ZKAssign.createNodeOffline(server.getZooKeeper(), TEST_HRI, server.getServerName()); // Create the handler OpenRegionHandler handler = new OpenRegionHandler(server, rsServices, TEST_HRI, TEST_HTD) { @Override boolean transitionZookeeperOfflineToOpening(String encodedName, int versionOfOfflineNode) { return false; } }; rsServices.getRegionsInTransitionInRS().put(TEST_HRI.getEncodedNameAsBytes(), Boolean.TRUE); handler.process(); RegionTransition rt = RegionTransition.parseFrom(ZKAssign.getData(server.getZooKeeper(), TEST_HRI.getEncodedName())); assertEquals(EventType.RS_ZK_REGION_FAILED_OPEN, rt.getEventType()); }
private void OpenRegion(Server server, RegionServerServices rss, HTableDescriptor htd, HRegionInfo hri, OpenRegionCoordination coordination) throws IOException, NodeExistsException, KeeperException, DeserializationException { // Create it OFFLINE node, which is what Master set before sending OPEN RPC ZKAssign.createNodeOffline(server.getZooKeeper(), hri, server.getServerName()); OpenRegionCoordination.OpenRegionDetails ord = coordination.getDetailsForNonCoordinatedOpening(); OpenRegionHandler openHandler = new OpenRegionHandler(server, rss, hri, htd, coordination, ord); rss.getRegionsInTransitionInRS().put(hri.getEncodedNameAsBytes(), Boolean.TRUE); openHandler.process(); // This parse is not used? RegionTransition.parseFrom(ZKAssign.getData(server.getZooKeeper(), hri.getEncodedName())); // delete the node, which is what Master do after the region is opened ZKAssign.deleteNode(server.getZooKeeper(), hri.getEncodedName(), EventType.RS_ZK_REGION_OPENED, server.getServerName()); }
@Test public void testFailedOpenRegion() throws Exception { Server server = new MockServer(HTU); RegionServerServices rsServices = HTU.createMockRegionServerService(); // Create it OFFLINE, which is what it expects ZKAssign.createNodeOffline(server.getZooKeeper(), TEST_HRI, server.getServerName()); // Create the handler OpenRegionHandler handler = new OpenRegionHandler(server, rsServices, TEST_HRI, TEST_HTD) { @Override HRegion openRegion() { // Fake failure of opening a region due to an IOE, which is caught return null; } }; rsServices.getRegionsInTransitionInRS().put( TEST_HRI.getEncodedNameAsBytes(), Boolean.TRUE); handler.process(); // Handler should have transitioned it to FAILED_OPEN RegionTransition rt = RegionTransition.parseFrom( ZKAssign.getData(server.getZooKeeper(), TEST_HRI.getEncodedName())); assertEquals(EventType.RS_ZK_REGION_FAILED_OPEN, rt.getEventType()); }
protected OpenRegionHandler(final Server server, final RegionServerServices rsServices, final HRegionInfo regionInfo, final HTableDescriptor htd, EventType eventType, final int versionOfOfflineNode) { super(server, eventType); this.rsServices = rsServices; this.regionInfo = regionInfo; this.htd = htd; this.versionOfOfflineNode = versionOfOfflineNode; tomActivated = this.server.getConfiguration(). getBoolean(AssignmentManager.ASSIGNMENT_TIMEOUT_MANAGEMENT, AssignmentManager.DEFAULT_ASSIGNMENT_TIMEOUT_MANAGEMENT); assignmentTimeout = this.server.getConfiguration(). getInt(AssignmentManager.ASSIGNMENT_TIMEOUT, AssignmentManager.DEFAULT_ASSIGNMENT_TIMEOUT_DEFAULT); }
/** * Try to transition to open. This function is static to make it usable before creating the * handler. * * This is not guaranteed to succeed, we just do our best. * * @param rsServices * @param hri Region we're working on. * @param versionOfOfflineNode version to checked. * @return whether znode is successfully transitioned to FAILED_OPEN state. */ public static boolean tryTransitionFromOfflineToFailedOpen(RegionServerServices rsServices, final HRegionInfo hri, final int versionOfOfflineNode) { boolean result = false; final String name = hri.getRegionNameAsString(); try { LOG.info("Opening of region " + hri + " failed, transitioning" + " from OFFLINE to FAILED_OPEN in ZK, expecting version " + versionOfOfflineNode); if (ZKAssign.transitionNode( rsServices.getZooKeeper(), hri, rsServices.getServerName(), EventType.M_ZK_REGION_OFFLINE, EventType.RS_ZK_REGION_FAILED_OPEN, versionOfOfflineNode) == -1) { LOG.warn("Unable to mark region " + hri + " as FAILED_OPEN. " + "It's likely that the master already timed out this open " + "attempt, and thus another RS already has the region."); } else { result = true; } } catch (KeeperException e) { LOG.error("Failed transitioning node " + name + " from OFFLINE to FAILED_OPEN", e); } return result; }
/** * Override setter from {@link SplitLogWorkerCoordination} */ @Override public void init(RegionServerServices server, Configuration conf, TaskExecutor splitExecutor, SplitLogWorker worker) { this.server = server; this.worker = worker; this.splitTaskExecutor = splitExecutor; maxConcurrentTasks = conf.getInt("hbase.regionserver.wal.max.splitters", DEFAULT_MAX_SPLITTERS); reportPeriod = conf.getInt("hbase.splitlog.report.period", conf.getInt(HConstants.HBASE_SPLITLOG_MANAGER_TIMEOUT, ZKSplitLogManagerCoordination.DEFAULT_TIMEOUT) / 3); }
/** * Update our OPENING state in zookeeper. * Do this so master doesn't timeout this region-in-transition. * We may lose the znode ownership during the open. Currently its * too hard interrupting ongoing region open. Just let it complete * and check we still have the znode after region open. * * @param context Some context to add to logs if failure * @return True if successful transition. */ @Override public boolean tickleOpening(OpenRegionDetails ord, HRegionInfo regionInfo, RegionServerServices rsServices, final String context) { ZkOpenRegionDetails zkOrd = (ZkOpenRegionDetails) ord; if (!isRegionStillOpening(regionInfo, rsServices)) { LOG.warn("Open region aborted since it isn't opening any more"); return false; } // If previous checks failed... do not try again. if (!isGoodVersion(zkOrd)) return false; String encodedName = regionInfo.getEncodedName(); try { zkOrd.setVersion(ZKAssign.confirmNodeOpening(watcher, regionInfo, zkOrd.getServerName(), zkOrd.getVersion())); } catch (KeeperException e) { coordination.getServer().abort("Exception refreshing OPENING; region=" + encodedName + ", context=" + context, e); zkOrd.setVersion(-1); return false; } boolean b = isGoodVersion(zkOrd); if (!b) { LOG.warn("Failed refreshing OPENING; region=" + encodedName + ", context=" + context); } return b; }
/** * Try to transition to open. * * This is not guaranteed to succeed, we just do our best. * * @param rsServices * @param hri Region we're working on. * @param ord Details about region open task * @return whether znode is successfully transitioned to FAILED_OPEN state. */ @Override public boolean tryTransitionFromOfflineToFailedOpen(RegionServerServices rsServices, final HRegionInfo hri, OpenRegionDetails ord) { ZkOpenRegionDetails zkOrd = (ZkOpenRegionDetails) ord; boolean result = false; final String name = hri.getRegionNameAsString(); try { LOG.info("Opening of region " + hri + " failed, transitioning" + " from OFFLINE to FAILED_OPEN in ZK, expecting version " + zkOrd.getVersionOfOfflineNode()); if (ZKAssign.transitionNode( rsServices.getZooKeeper(), hri, rsServices.getServerName(), EventType.M_ZK_REGION_OFFLINE, EventType.RS_ZK_REGION_FAILED_OPEN, zkOrd.getVersionOfOfflineNode()) == -1) { LOG.warn("Unable to mark region " + hri + " as FAILED_OPEN. " + "It's likely that the master already timed out this open " + "attempt, and thus another RS already has the region."); } else { result = true; } } catch (KeeperException e) { LOG.error("Failed transitioning node " + name + " from OFFLINE to FAILED_OPEN", e); } return result; }
/** * Create an unmanaged {@link HConnection} based on the environment in which we are running the * coprocessor. The {@link HConnection} must be externally cleaned up (we bypass the usual HTable * cleanup mechanisms since we own everything). * @param env environment hosting the {@link HConnection} * @return an unmanaged {@link HConnection}. * @throws IOException if we cannot create the connection */ public static ClusterConnection getConnectionForEnvironment(CoprocessorEnvironment env) throws IOException { // this bit is a little hacky - just trying to get it going for the moment if (env instanceof RegionCoprocessorEnvironment) { RegionCoprocessorEnvironment e = (RegionCoprocessorEnvironment) env; RegionServerServices services = e.getRegionServerServices(); if (services instanceof HRegionServer) { return new CoprocessorHConnection((HRegionServer) services); } } return ConnectionManager.createConnectionInternal(env.getConfiguration()); }
public void initialize(RegionServerServices rss) throws KeeperException { for (RegionServerProcedureManager proc : procedures) { LOG.debug("Procedure " + proc.getProcedureSignature() + " is initializing"); proc.initialize(rss); LOG.debug("Procedure " + proc.getProcedureSignature() + " is initialized"); } }
@Override public void setup(final RegionServerServices server) { server.getChoreService().scheduleChore( new ScheduledChore("CompactionThroughputTuner", this, tuningPeriod) { @Override protected void chore() { tune(server.getCompactionPressure()); } }); }
public static CompactionThroughputController create(RegionServerServices server, Configuration conf) { Class<? extends CompactionThroughputController> clazz = getThroughputControllerClass(conf); CompactionThroughputController controller = ReflectionUtils.newInstance(clazz, conf); controller.setup(server); return controller; }
public OpenMetaHandler(final Server server, final RegionServerServices rsServices, HRegionInfo regionInfo, final HTableDescriptor htd, long masterSystemTime, OpenRegionCoordination coordination, OpenRegionCoordination.OpenRegionDetails ord) { super(server, rsServices, regionInfo, htd, EventType.M_RS_OPEN_META, masterSystemTime, coordination, ord); }
public CloseRegionHandler(final Server server, final RegionServerServices rsServices, final HRegionInfo regionInfo, final boolean abort, CloseRegionCoordination closeRegionCoordination, CloseRegionCoordination.CloseRegionDetails crd, ServerName destination) { this(server, rsServices, regionInfo, abort, closeRegionCoordination, crd, EventType.M_RS_CLOSE_REGION, destination); }
protected CloseRegionHandler(final Server server, final RegionServerServices rsServices, HRegionInfo regionInfo, boolean abort, CloseRegionCoordination closeRegionCoordination, CloseRegionCoordination.CloseRegionDetails crd, EventType eventType, ServerName destination) { super(server, eventType); this.server = server; this.rsServices = rsServices; this.regionInfo = regionInfo; this.abort = abort; this.destination = destination; this.closeRegionCoordination = closeRegionCoordination; this.closeRegionDetails = crd; useZKForAssignment = ConfigUtil.useZKForAssignment(server.getConfiguration()); }
public OpenRegionHandler(final Server server, final RegionServerServices rsServices, HRegionInfo regionInfo, HTableDescriptor htd, long masterSystemTime, OpenRegionCoordination coordination, OpenRegionCoordination.OpenRegionDetails ord) { this(server, rsServices, regionInfo, htd, EventType.M_RS_OPEN_REGION, masterSystemTime, coordination, ord); }
protected OpenRegionHandler(final Server server, final RegionServerServices rsServices, final HRegionInfo regionInfo, final HTableDescriptor htd, EventType eventType, long masterSystemTime, OpenRegionCoordination coordination, OpenRegionCoordination.OpenRegionDetails ord) { super(server, eventType); this.rsServices = rsServices; this.regionInfo = regionInfo; this.htd = htd; this.coordination = coordination; this.ord = ord; useZKForAssignment = ConfigUtil.useZKForAssignment(server.getConfiguration()); this.masterSystemTime = masterSystemTime; }
PostOpenDeployTasksThread(final HRegion region, final Server server, final RegionServerServices services, final AtomicBoolean signaller, long masterSystemTime) { super("PostOpenDeployTasks:" + region.getRegionInfo().getEncodedName()); this.setDaemon(true); this.server = server; this.services = services; this.region = region; this.signaller = signaller; this.masterSystemTime = masterSystemTime; }
public CloseMetaHandler(final Server server, final RegionServerServices rsServices, final HRegionInfo regionInfo, final boolean abort, CloseRegionCoordination closeRegionCoordination, CloseRegionCoordination.CloseRegionDetails crd) { super(server, rsServices, regionInfo, abort, closeRegionCoordination, crd, EventType.M_RS_CLOSE_META); }
public FinishRegionRecoveringHandler(RegionServerServices rss, String regionName, String path) { // we are using the open region handlers, since this operation is in the region open lifecycle super(rss, EventType.M_RS_OPEN_REGION); this.rss = rss; this.regionName = regionName; this.path = path; }
/** * Create a stubbed out RegionServerService, mainly for getting FS. * This version is used by TestTokenAuthentication */ public RegionServerServices createMockRegionServerService(RpcServerInterface rpc) throws IOException { final MockRegionServerServices rss = new MockRegionServerServices(getZooKeeperWatcher()); rss.setFileSystem(getTestFileSystem()); rss.setRpcServer(rpc); return rss; }
@Override public void initialize(RegionServerServices rss) throws KeeperException { this.rss = rss; ZooKeeperWatcher zkw = rss.getZooKeeper(); this.memberRpcs = new ZKProcedureMemberRpcs(zkw, getProcedureSignature()); ThreadPoolExecutor pool = ProcedureMember.defaultPool(rss.getServerName().toString(), 1); this.member = new ProcedureMember(memberRpcs, pool, new SimleSubprocedureBuilder()); LOG.info("Initialized: " + rss.getServerName().toString()); }
public SimpleSubprocedure(RegionServerServices rss, ProcedureMember member, ForeignExceptionDispatcher errorListener, SimpleSubprocedurePool taskManager, String name) { super(member, name, errorListener, 500, 60000); LOG.info("Constructing a SimpleSubprocedure."); this.rss = rss; this.taskManager = taskManager; }
@Test public void testRegionServerCoprocessorHostDefaults() throws Exception { Configuration conf = new Configuration(CONF); RegionServerServices rsServices = mock(RegionServerServices.class); systemCoprocessorLoaded.set(false); new RegionServerCoprocessorHost(rsServices, conf); assertEquals("System coprocessors loading default was not honored", systemCoprocessorLoaded.get(), CoprocessorHost.DEFAULT_COPROCESSORS_ENABLED); }