/** @param server */ public LogRoller(final Server server, final RegionServerServices services) { super("LogRoller"); this.server = server; this.services = services; this.rollperiod = this.server.getConfiguration(). getLong("hbase.regionserver.logroll.period", 3600000); this.threadWakeFrequency = this.server.getConfiguration(). getInt(HConstants.THREAD_WAKE_FREQUENCY, 10 * 1000); this.checkLowReplicationInterval = this.server.getConfiguration().getLong( "hbase.regionserver.hlog.check.lowreplication.interval", 30 * 1000); }
/** * @return Return the FileSystem object used (can return null!). */ // TODO: On Master, return Master's. On RegionServer, return RegionServers. The FileSystems // may differ. TODO. default FileSystem getFileSystem() { // This default is pretty dodgy! Configuration c = getConfiguration(); FileSystem fs = null; try { if (c != null) { fs = FileSystem.get(c); } } catch (IOException e) { // If an exception, just return null } return fs; }
/** * Default base class constructor. */ public EventHandler(Server server, EventType eventType) { this.parent = Tracer.getCurrentSpan(); this.server = server; this.eventType = eventType; seqid = seqids.incrementAndGet(); if (server != null) { this.waitingTimeForEvents = server.getConfiguration(). getInt("hbase.master.event.waiting.time", 1000); } }
public HeapMemoryTunerChore() { super(server.getServerName() + "-HeapMemoryTunerChore", server, defaultChorePeriod); Class<? extends HeapMemoryTuner> tunerKlass = server.getConfiguration().getClass( HBASE_RS_HEAP_MEMORY_TUNER_CLASS, DefaultHeapMemoryTuner.class, HeapMemoryTuner.class); heapMemTuner = ReflectionUtils.newInstance(tunerKlass, server.getConfiguration()); tunerContext .setOffheapMemStore(regionServerAccounting.isOffheap()); }
protected AuthenticationTokenSecretManager createSecretManager() { if (!isSecurityEnabled) return null; if (server == null) return null; Configuration conf = server.getConfiguration(); long keyUpdateInterval = conf.getLong("hbase.auth.key.update.interval", 24*60*60*1000); long maxAge = conf.getLong("hbase.auth.token.max.lifetime", 7*24*60*60*1000); return new AuthenticationTokenSecretManager(conf, server.getZooKeeper(), server.getServerName().toString(), keyUpdateInterval, maxAge); }
this.server.getConfiguration(), this.rsServices, new CancelableProgressable() {
public ZkCoordinatedStateManager(Server server) { this.watcher = server.getZooKeeper(); splitLogWorkerCoordination = new ZkSplitLogWorkerCoordination(server.getServerName(), watcher); splitLogManagerCoordination = new ZKSplitLogManagerCoordination(server.getConfiguration(), watcher); }
@VisibleForTesting HeapMemoryManager(BlockCache blockCache, FlushRequester memStoreFlusher, Server server, RegionServerAccounting regionServerAccounting) { Configuration conf = server.getConfiguration(); this.blockCache = toResizableBlockCache(blockCache); this.memStoreFlusher = memStoreFlusher; this.server = server; this.regionServerAccounting = regionServerAccounting; this.tunerOn = doInit(conf); this.defaultChorePeriod = conf.getInt(HBASE_RS_HEAP_MEMORY_TUNER_PERIOD, HBASE_RS_HEAP_MEMORY_TUNER_DEFAULT_PERIOD); this.heapOccupancyLowWatermark = conf.getFloat(HConstants.HEAP_OCCUPANCY_LOW_WATERMARK_KEY, HConstants.DEFAULT_HEAP_OCCUPANCY_LOW_WATERMARK); metricsHeapMemoryManager = new MetricsHeapMemoryManager(); }
public DummyNodeFailoverWorker(ServerName deadRS, Server s) throws Exception { this.deadRS = deadRS; this.server = s; this.rq = ReplicationStorageFactory.getReplicationQueueStorage(server.getZooKeeper(), server.getConfiguration()); }
@Test public void testAborting() throws Exception { final Configuration conf = HBaseConfiguration.create(); final Server server = mock(Server.class); when(server.getConfiguration()).thenReturn(conf); ExecutorService executorService = new ExecutorService("unit_test"); executorService.startExecutorService( ExecutorType.MASTER_SERVER_OPERATIONS, 1); executorService.submit(new EventHandler(server, EventType.M_SERVER_SHUTDOWN) { @Override public void process() throws IOException { throw new RuntimeException("Should cause abort"); } }); Waiter.waitFor(conf, 30000, new Predicate<Exception>() { @Override public boolean evaluate() throws Exception { try { verify(server, times(1)).abort(anyString(), (Throwable) anyObject()); return true; } catch (Throwable t) { return false; } } }); executorService.shutdown(); }
WALProvider walProvider) throws IOException { this.server = server; this.conf = this.server.getConfiguration(); this.isReplicationForBulkLoadDataEnabled = ReplicationUtils.isReplicationForBulkLoadDataEnabled(this.conf);
when(mockedServer.getConfiguration()).thenReturn(HBaseConfiguration.create());
Server server = new DummyServer("hostname1.example.org"); ReplicationQueueStorage rq = ReplicationStorageFactory .getReplicationQueueStorage(server.getZooKeeper(), server.getConfiguration()); ReplicationFactory.getReplicationPeers(s1.getZooKeeper(), s1.getConfiguration()); rp1.init(); NodeFailoverWorker w1 =
Mockito.when(server.getConfiguration()).thenReturn(CONF); Mockito.when(server.isStopped()).thenReturn(false); Mockito.when(server.isAborted()).thenReturn(false);
when(server.getConfiguration()).thenReturn(CONF); when(server.isStopped()).thenReturn(false); when(server.isAborted()).thenReturn(false);
Mockito.when(server.getConfiguration()).thenReturn(CONF); Mockito.when(server.isStopped()).thenReturn(false); Mockito.when(server.isAborted()).thenReturn(false);
@Test public void testCleanupUnknownPeerZNode() throws Exception { Server server = new DummyServer("hostname2.example.org"); ReplicationQueueStorage rq = ReplicationStorageFactory .getReplicationQueueStorage(server.getZooKeeper(), server.getConfiguration()); // populate some znodes in the peer znode // add log to an unknown peer String group = "testgroup"; rq.addWAL(server.getServerName(), "2", group + ".log1"); rq.addWAL(server.getServerName(), "2", group + ".log2"); NodeFailoverWorker w1 = manager.new NodeFailoverWorker(server.getServerName()); w1.run(); // The log of the unknown peer should be removed from zk for (String peer : manager.getAllQueues()) { assertTrue(peer.startsWith("1")); } }
Server server = new DummyServer("hostname0.example.org"); ReplicationQueueStorage rq = ReplicationStorageFactory .getReplicationQueueStorage(server.getZooKeeper(), server.getConfiguration());
/** * Default base class constructor. */ public EventHandler(Server server, EventType eventType) { this.server = server; this.eventType = eventType; seqid = seqids.incrementAndGet(); this.waitingTimeForEvents = server.getConfiguration(). getInt("hbase.master.event.waiting.time", 1000); }
public DummyNodeFailoverWorker(ServerName deadRS, Server s) throws Exception { this.deadRS = deadRS; this.server = s; this.rq = ReplicationStorageFactory.getReplicationQueueStorage(server.getZooKeeper(), server.getConfiguration()); }