public synchronized void add(Throwable ex, Row row, ServerName serverName) { if (row == null){ throw new IllegalArgumentException("row cannot be null. location=" + serverName); } throwables.add(ex); actions.add(row); addresses.add(serverName != null ? serverName.toString() : "null"); }
@Override public String toString() { return hsa.toString() + ";" + hri.getRegionNameAsString(); } }
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); }
@Override public void cancel(String why) { if (finished) return; this.finished = true; LOG.info("Stop taking snapshot=" + ClientSnapshotDescriptionUtils.toString(snapshot) + " because: " + why); CancellationException ce = new CancellationException(why); monitor.receive(new ForeignException(master.getServerName().toString(), ce)); }
private boolean containMetaWals(ServerName serverName) throws IOException { Path logDir = new Path(master.getWALRootDir(), AbstractFSWALProvider.getWALDirectoryName(serverName.toString())); Path splitDir = logDir.suffix(AbstractFSWALProvider.SPLITTING_EXT); Path checkDir = master.getFileSystem().exists(splitDir) ? splitDir : logDir; return master.getFileSystem().listStatus(checkDir, META_FILTER).length > 0; }
@Override public Void call() throws Exception { LOG.info("Execute subprocedure on " + rss.getServerName().toString()); return null; }
public ScannerIdGenerator(ServerName serverName) { long hash = Hashing.murmur3_32().hashString(serverName.toString(), java.nio.charset.StandardCharsets.UTF_8).asInt(); this.serverNameHash = hash << 32; }
/** * @param sn Name of this mock regionserver * @throws IOException * @throws org.apache.hadoop.hbase.ZooKeeperConnectionException */ MockRegionServer(final Configuration conf, final ServerName sn) throws ZooKeeperConnectionException, IOException { this.sn = sn; this.conf = conf; this.zkw = new ZKWatcher(conf, sn.toString(), this, true); }
public void complete(long procId, Throwable error) { RemoteProcedureResult.Builder builder = RemoteProcedureResult.newBuilder().setProcId(procId); if (error != null) { LOG.debug("Failed to complete execution of proc pid={}", procId, error); builder.setStatus(RemoteProcedureResult.Status.ERROR).setError( ForeignExceptionUtil.toProtoForeignException(server.getServerName().toString(), error)); } else { LOG.debug("Successfully complete execution of proc pid={}", procId); builder.setStatus(RemoteProcedureResult.Status.SUCCESS); } results.add(builder.build()); }
@Override public void start() { this.memberRpcs.start(rss.getServerName().toString(), member); LOG.info("Started."); }
@Test public void testEmptyLogDir() throws Exception { LOG.info("testEmptyLogDir"); slm = new SplitLogManager(master, conf); FileSystem fs = TEST_UTIL.getTestFileSystem(); Path emptyLogDirPath = new Path(new Path(fs.getWorkingDirectory(), HConstants.HREGION_LOGDIR_NAME), ServerName.valueOf("emptyLogDir", 1, 1).toString()); fs.mkdirs(emptyLogDirPath); slm.splitLogDistributed(emptyLogDirPath); assertFalse(fs.exists(emptyLogDirPath)); }
@Test public void testCustomProvider() throws IOException { final Configuration config = new Configuration(); config.set(WALFactory.WAL_PROVIDER, IOTestProvider.class.getName()); final WALFactory walFactory = new WALFactory(config, this.currentServername.toString()); Class<? extends WALProvider> walProvider = walFactory.getProviderClass( WALFactory.WAL_PROVIDER, Providers.filesystem.name()); assertEquals(IOTestProvider.class, walProvider); WALProvider metaWALProvider = walFactory.getMetaProvider(); assertEquals(IOTestProvider.class, metaWALProvider.getClass()); }
@Test public void testCustomMetaProvider() throws IOException { final Configuration config = new Configuration(); config.set(WALFactory.META_WAL_PROVIDER, IOTestProvider.class.getName()); final WALFactory walFactory = new WALFactory(config, this.currentServername.toString()); Class<? extends WALProvider> walProvider = walFactory.getProviderClass( WALFactory.WAL_PROVIDER, Providers.filesystem.name()); assertEquals(Providers.filesystem.clazz, walProvider); WALProvider metaWALProvider = walFactory.getMetaProvider(); assertEquals(IOTestProvider.class, metaWALProvider.getClass()); } }
@Test public void testOnlySetWALProvider() throws IOException { Configuration conf = new Configuration(); conf.set(WAL_PROVIDER, WALFactory.Providers.multiwal.name()); WALFactory walFactory = new WALFactory(conf, this.currentServername.toString()); WALProvider wrappedWALProvider = ((SyncReplicationWALProvider) walFactory.getWALProvider()) .getWrappedProvider(); assertEquals(SyncReplicationWALProvider.class, walFactory.getWALProvider().getClass()); // class of WALProvider and metaWALProvider are the same when metaWALProvider is not set assertEquals(WALFactory.Providers.multiwal.clazz, wrappedWALProvider.getClass()); assertEquals(WALFactory.Providers.multiwal.clazz, walFactory.getMetaProvider().getClass()); }
@Test public void testOnlySetMetaWALProvider() throws IOException { Configuration conf = new Configuration(); conf.set(META_WAL_PROVIDER, WALFactory.Providers.asyncfs.name()); WALFactory walFactory = new WALFactory(conf, this.currentServername.toString()); WALProvider wrappedWALProvider = ((SyncReplicationWALProvider) walFactory.getWALProvider()) .getWrappedProvider(); assertEquals(SyncReplicationWALProvider.class, walFactory.getWALProvider().getClass()); assertEquals(WALFactory.Providers.defaultProvider.clazz, wrappedWALProvider.getClass()); assertEquals(WALFactory.Providers.asyncfs.clazz, walFactory.getMetaProvider().getClass()); }
@Override public void initialize(RegionServerServices rss) throws KeeperException { this.rss = rss; ZKWatcher 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()); }
@Before public void setUp() throws Exception { fs = cluster.getFileSystem(); dir = new Path(hbaseDir, currentTest.getMethodName()); this.currentServername = ServerName.valueOf(currentTest.getMethodName(), 16010, 1); wals = new WALFactory(conf, this.currentServername.toString()); }
@Test public void testDeleteIfEquals() throws Exception { final ServerName sn = ServerName.valueOf("localhost", 1234, System.currentTimeMillis()); final MasterAddressTracker addressTracker = setupMasterTracker(sn, 1772); try { assertFalse("shouldn't have deleted wrong master server.", MasterAddressTracker.deleteIfEquals(addressTracker.getWatcher(), "some other string.")); } finally { assertTrue("Couldn't clean up master", MasterAddressTracker.deleteIfEquals(addressTracker.getWatcher(), sn.toString())); } }