method2testcases
stringlengths
118
6.63k
### Question: SplitLogManager { void handleDeadWorker(ServerName workerName) { synchronized (deadWorkersLock) { if (deadWorkers == null) { deadWorkers = new HashSet<ServerName>(100); } deadWorkers.add(workerName); } LOG.info("dead splitlog worker " + workerName); } SplitLogManager(Server server, Configuration conf, Sto...
### Question: SplitLogManager { public long splitLogDistributed(final Path logDir) throws IOException { List<Path> logDirs = new ArrayList<Path>(); logDirs.add(logDir); return splitLogDistributed(logDirs); } SplitLogManager(Server server, Configuration conf, Stoppable stopper, MasterServices master, ServerName se...
### Question: SplitLogManager { void removeStaleRecoveringRegions(final Set<ServerName> failedServers) throws IOException, InterruptedIOException { Set<String> knownFailedServers = new HashSet<String>(); if (failedServers != null) { for (ServerName tmpServerName : failedServers) { knownFailedServers.add(tmpServerName.g...
### Question: StealJobQueue extends PriorityBlockingQueue<T> { @Override public T take() throws InterruptedException { lock.lockInterruptibly(); try { while (true) { T retVal = this.poll(); if (retVal == null) { retVal = stealFromQueue.poll(); } if (retVal == null) { notEmpty.await(); } else { return retVal; } } } fina...
### Question: CleanerChore extends ScheduledChore { @VisibleForTesting boolean checkAndDeleteDirectory(Path dir) { if (LOG.isTraceEnabled()) { LOG.trace("Checking directory: " + dir); } try { FileStatus[] children = FSUtils.listStatus(fs, dir); boolean allChildrenDeleted = checkAndDeleteEntries(children); if (!allChild...
### Question: SnapshotLogCleaner extends BaseLogCleanerDelegate { @Override public void setConf(Configuration conf) { super.setConf(conf); try { long cacheRefreshPeriod = conf.getLong( WAL_CACHE_REFRESH_PERIOD_CONF_KEY, DEFAULT_WAL_CACHE_REFRESH_PERIOD); final FileSystem fs = FSUtils.getCurrentFileSystem(conf); Path ro...
### Question: ServerCrashProcedure extends StateMachineProcedure<MasterProcedureEnv, ServerCrashState> implements ServerProcedureInterface { @Override public ServerName getServerName() { return this.serverName; } ServerCrashProcedure(final ServerName serverName, final boolean shouldSplitWal, final boolean carryin...
### Question: StorefileRefresherChore extends ScheduledChore { @Override protected void chore() { for (Region r : regionServer.getOnlineRegionsLocalContext()) { if (!r.isReadOnly()) { continue; } if (onlyMetaRefresh && !r.getRegionInfo().isMetaTable()) continue; String encodedName = r.getRegionInfo().getEncodedName(); ...
### Question: StripeStoreFileManager implements StoreFileManager, StripeCompactionPolicy.StripeInformationProvider { @Override public ImmutableCollection<StoreFile> clearFiles() { ImmutableCollection<StoreFile> result = state.allFilesCached; this.state = new State(); this.fileStarts.clear(); this.fileEnds.clear(); retu...
### Question: StealJobQueue extends PriorityBlockingQueue<T> { @Override public T poll(long timeout, TimeUnit unit) throws InterruptedException { long nanos = unit.toNanos(timeout); lock.lockInterruptibly(); try { while (true) { T retVal = this.poll(); if (retVal == null) { retVal = stealFromQueue.poll(); } if (retVal ...
### Question: StripeStoreFileManager implements StoreFileManager, StripeCompactionPolicy.StripeInformationProvider { @Override public List<StoreFile> getLevel0Files() { return this.state.level0Files; } StripeStoreFileManager( KVComparator kvComparator, Configuration conf, StripeStoreConfig config); @Override void...
### Question: StoreFileInfo { @Override public int hashCode() { int hash = 17; hash = hash * 31 + ((reference == null) ? 0 : reference.hashCode()); hash = hash * 31 + ((initialPath == null) ? 0 : initialPath.hashCode()); hash = hash * 31 + ((link == null) ? 0 : link.hashCode()); return hash; } StoreFileInfo(final Confi...
### Question: ServerNonceManager { public void endOperation(long group, long nonce, boolean success) { if (nonce == HConstants.NO_NONCE) return; NonceKey nk = new NonceKey(group, nonce); OperationContext newResult = nonces.get(nk); assert newResult != null; synchronized (newResult) { assert newResult.getState() == Oper...
### Question: RegionSplitPolicy extends Configured { protected byte[] getSplitPoint() { byte[] explicitSplitPoint = this.region.getExplicitSplitPoint(); if (explicitSplitPoint != null) { return explicitSplitPoint; } List<Store> stores = region.getStores(); byte[] splitPointFromLargestStore = null; long largestStoreSize...
### Question: HeapMemoryManager { public static HeapMemoryManager create(Configuration conf, FlushRequester memStoreFlusher, Server server, RegionServerAccounting regionServerAccounting) { BlockCache blockCache = CacheConfig.instantiateBlockCache(conf); if (blockCache instanceof ResizableBlockCache) { return new HeapMe...
### Question: MetricsWAL extends WALActionsListener.Base { @Override public void logRollRequested(boolean underReplicated) { source.incrementLogRollRequested(); if (underReplicated) { source.incrementLowReplicationLogRoll(); } } MetricsWAL(); @VisibleForTesting MetricsWAL(MetricsWALSource s); @Override void postSync(f...
### Question: MetricsWAL extends WALActionsListener.Base { @Override public void postSync(final long timeInNanos, final int handlerSyncs) { source.incrementSyncTime(timeInNanos/1000000L); } MetricsWAL(); @VisibleForTesting MetricsWAL(MetricsWALSource s); @Override void postSync(final long timeInNanos, final int handle...
### Question: FSHLog implements WAL { @Override public void close() throws IOException { shutdown(); final FileStatus[] files = getFiles(); if (null != files && 0 != files.length) { for (FileStatus file : files) { Path p = getWALArchivePath(this.fullPathArchiveDir, file.getPath()); if (!this.listeners.isEmpty()) { for ...
### Question: SequenceIdAccounting { Long startCacheFlush(final byte[] encodedRegionName, final Set<byte[]> families) { Map<byte[], Long> oldSequenceIds = null; Long lowestUnflushedInRegion = HConstants.NO_SEQNUM; synchronized (tieLock) { Map<byte[], Long> m = this.lowestUnflushedSequenceIds.get(encodedRegionName); if ...
### Question: SequenceIdAccounting { boolean areAllLower(Map<byte[], Long> sequenceids) { Map<byte[], Long> flushing = null; Map<byte[], Long> unflushed = null; synchronized (this.tieLock) { flushing = flattenToLowestSequenceId(this.flushingSequenceIds); unflushed = flattenToLowestSequenceId(this.lowestUnflushedSequenc...
### Question: StealJobQueue extends PriorityBlockingQueue<T> { public BlockingQueue<T> getStealFromQueue() { return stealFromQueue; } StealJobQueue(); BlockingQueue<T> getStealFromQueue(); @Override boolean offer(T t); @Override T take(); @Override T poll(long timeout, TimeUnit unit); }### Answer: @Test public void te...
### Question: SequenceIdAccounting { byte[][] findLower(Map<byte[], Long> sequenceids) { List<byte[]> toFlush = null; synchronized (tieLock) { for (Map.Entry<byte[], Long> e: sequenceids.entrySet()) { Map<byte[], Long> m = this.lowestUnflushedSequenceIds.get(e.getKey()); if (m == null) continue; long lowest = getLowest...
### Question: IdLock { void assertMapEmpty() { assert map.size() == 0; } Entry getLockEntry(long id); void releaseLockEntry(Entry entry); @VisibleForTesting void waitForWaiters(long id, int numWaiters); }### Answer: @Test public void testMultipleClients() throws Exception { ExecutorService exec = Executors.newFixedTh...
### Question: SnapshotManifest { public static SnapshotManifest open(final Configuration conf, final FileSystem fs, final Path workingDir, final SnapshotDescription desc) throws IOException { SnapshotManifest manifest = new SnapshotManifest(conf, fs, workingDir, desc, null); manifest.load(); return manifest; } private ...
### Question: ExportSnapshot extends Configured implements Tool { static List<List<Pair<SnapshotFileInfo, Long>>> getBalancedSplits( final List<Pair<SnapshotFileInfo, Long>> files, final int ngroups) { Collections.sort(files, new Comparator<Pair<SnapshotFileInfo, Long>>() { public int compare(Pair<SnapshotFileInfo, Lon...
### Question: SnapshotDescriptionUtils { public static SnapshotDescription validate(SnapshotDescription snapshot, Configuration conf) throws IllegalArgumentException { if (!snapshot.hasTable()) { throw new IllegalArgumentException( "Descriptor doesn't apply to a table, so we can't build it."); } long time = snapshot.ge...
### Question: SnapshotDescriptionUtils { public static void completeSnapshot(SnapshotDescription snapshot, Path rootdir, Path workingDir, FileSystem fs) throws SnapshotCreationException, IOException { Path finishedDir = getCompletedSnapshotDir(snapshot, rootdir); LOG.debug("Snapshot is done, just moving the snapshot fr...
### Question: JMXListener implements Coprocessor { @Override public void start(CoprocessorEnvironment env) throws IOException { int rmiRegistryPort = -1; int rmiConnectorPort = -1; Configuration conf = env.getConfiguration(); if (env instanceof MasterCoprocessorEnvironment) { rmiRegistryPort = conf.getInt("master" + RM...
### Question: JMXListener implements Coprocessor { @Override public void stop(CoprocessorEnvironment env) throws IOException { stopConnectorServer(); } static JMXServiceURL buildJMXServiceURL(int rmiRegistryPort, int rmiConnectorPort); void startConnectorServer(int rmiRegistryPort, int rmiConnectorPort); void st...
### Question: TagRewriteCell implements Cell, SettableSequenceId, SettableTimestamp, HeapSize { @Override public long heapSize() { long sum = CellUtil.estimatedHeapSizeOf(cell) - cell.getTagsLength(); sum += ClassSize.OBJECT; sum += (2 * ClassSize.REFERENCE); if (this.tags != null) { sum += ClassSize.align(ClassSize.AR...
### Question: KeyLocker { public ReentrantLock acquireLock(K key) { if (key == null) throw new IllegalArgumentException("key must not be null"); lockPool.purge(); ReentrantLock lock = lockPool.get(key); lock.lock(); return lock; } ReentrantLock acquireLock(K key); Map<K, Lock> acquireLocks(Set<? extends K> keys); }##...
### Question: DynamicClassLoader extends ClassLoaderBase { @Override public Class<?> loadClass(String name) throws ClassNotFoundException { try { return parent.loadClass(name); } catch (ClassNotFoundException e) { if (LOG.isDebugEnabled()) { LOG.debug("Class " + name + " not found - using dynamical class loader"); } if...
### Question: Threads { public static void sleepWithoutInterrupt(final long msToWait) { long timeMillis = System.currentTimeMillis(); long endTime = timeMillis + msToWait; boolean interrupted = false; while (timeMillis < endTime) { try { Thread.sleep(endTime - timeMillis); } catch (InterruptedException ex) { interrupte...
### Question: OrderedBytes { public static int encodeString(PositionedByteRange dst, String val, Order ord) { if (null == val) { return encodeNull(dst, ord); } if (val.contains("\u0000")) throw new IllegalArgumentException("Cannot encode String values containing '\\u0000'"); final int offset = dst.getOffset(), start = ...
### Question: SimpleMutableByteRange extends AbstractByteRange { @Override public boolean equals(Object thatObject) { if (thatObject == null) { return false; } if (this == thatObject) { return true; } if (hashCode() != thatObject.hashCode()) { return false; } if (!(thatObject instanceof SimpleMutableByteRange)) { retur...
### Question: WeakObjectPool { public V get(K key) { ObjectReference ref = referenceCache.get(key); if (ref != null) { V obj = ref.get(); if (obj != null) { return obj; } referenceCache.remove(key, ref); } V newObj = objectFactory.createObject(key); ObjectReference newRef = new ObjectReference(key, newObj); while (true...
### Question: AES extends Cipher { @VisibleForTesting SecureRandom getRNG() { return rng; } AES(CipherProvider provider); @Override String getName(); @Override int getKeyLength(); @Override int getIvLength(); @Override Key getRandomKey(); @Override Encryptor getEncryptor(); @Override Decryptor getDecryptor(); @Override...
### Question: BoundedByteBufferPool { public void putBuffer(ByteBuffer bb) { if (bb.capacity() > this.maxByteBufferSizeToCache) return; boolean success = false; int average = 0; lock.lock(); try { success = this.buffers.offer(bb); if (success) { this.totalReservoirCapacity += bb.capacity(); average = this.totalReservoi...
### Question: ChoreService implements ChoreServicer { @Override public synchronized void cancelChore(ScheduledChore chore) { cancelChore(chore, true); } @VisibleForTesting ChoreService(final String coreThreadPoolPrefix); ChoreService(final String coreThreadPoolPrefix, final boolean jitter); ChoreService(final String...
### Question: ChoreService implements ChoreServicer { int getCorePoolSize() { return scheduler.getCorePoolSize(); } @VisibleForTesting ChoreService(final String coreThreadPoolPrefix); ChoreService(final String coreThreadPoolPrefix, final boolean jitter); ChoreService(final String coreThreadPoolPrefix, int corePoolSi...
### Question: ChoreService implements ChoreServicer { public synchronized boolean scheduleChore(ScheduledChore chore) { if (chore == null) { return false; } try { chore.setChoreServicer(this); ScheduledFuture<?> future = scheduler.scheduleAtFixedRate(chore, chore.getInitialDelay(), chore.getPeriod(), chore.getTimeUnit(...
### Question: ZKConfig { public static Properties makeZKProps(Configuration conf) { Properties zkProperties = makeZKPropsFromZooCfg(conf); if (zkProperties == null) { zkProperties = makeZKPropsFromHbaseConfig(conf); } return zkProperties; } private ZKConfig(); static Properties makeZKProps(Configuration conf); @Deprec...
### Question: ZKConfig { public static String getZooKeeperClusterKey(Configuration conf) { return getZooKeeperClusterKey(conf, null); } private ZKConfig(); static Properties makeZKProps(Configuration conf); @Deprecated static Properties parseZooCfg(Configuration conf, InputStream inputStream); static String getZ...
### Question: ZKConfig { public static void validateClusterKey(String key) throws IOException { transformClusterKey(key); } private ZKConfig(); static Properties makeZKProps(Configuration conf); @Deprecated static Properties parseZooCfg(Configuration conf, InputStream inputStream); static String getZKQuorumServe...
### Question: FixedLengthWrapper implements DataType<T> { @Override public T decode(PositionedByteRange src) { if (src.getRemaining() < length) { throw new IllegalArgumentException("Not enough buffer remaining. src.offset: " + src.getOffset() + " src.length: " + src.getLength() + " src.position: " + src.getPosition() +...
### Question: HBaseConfiguration extends Configuration { public static Configuration subset(Configuration srcConf, String prefix) { Configuration newConf = new Configuration(false); for (Map.Entry<String, String> entry : srcConf) { if (entry.getKey().startsWith(prefix)) { String newKey = entry.getKey().substring(prefix...
### Question: HBaseConfiguration extends Configuration { public static String getPassword(Configuration conf, String alias, String defPass) throws IOException { String passwd = null; try { Method m = Configuration.class.getMethod("getPassword", String.class); char[] p = (char[]) m.invoke(conf, alias); if (p != null) { ...
### Question: TimeoutBlockingQueue { public TimeoutBlockingQueue(TimeoutRetriever<? super E> timeoutRetriever) { this(32, timeoutRetriever); } TimeoutBlockingQueue(TimeoutRetriever<? super E> timeoutRetriever); @SuppressWarnings("unchecked") TimeoutBlockingQueue(int capacity, TimeoutRetriever<? super E> timeoutRetriev...
### Question: ProcedureStoreTracker { public boolean isTracking(long minId, long maxId) { return map.floorEntry(minId) != null || map.floorEntry(maxId) != null; } void insert(long procId); void insert(final long procId, final long[] subProcIds); void update(long procId); void delete(long procId); long getUpdatedMinPro...
### Question: ProcedureStoreTracker { public void delete(long procId) { Map.Entry<Long, BitSetNode> entry = map.floorEntry(procId); assert entry != null : "expected node to delete procId=" + procId; BitSetNode node = entry.getValue(); assert node.contains(procId) : "expected procId in the node"; node.delete(procId); if...
### Question: WALProcedureStore extends ProcedureStoreBase { @VisibleForTesting protected void periodicRollForTesting() throws IOException { lock.lock(); try { periodicRoll(); } finally { lock.unlock(); } } WALProcedureStore(final Configuration conf, final FileSystem fs, final Path logDir, final LeaseRecovery lea...
### Question: WALProcedureStore extends ProcedureStoreBase { @Override public void load(final ProcedureLoader loader) throws IOException { if (logs.isEmpty()) { throw new RuntimeException("recoverLease() must be called before loading data"); } if (logs.size() == 1) { if (LOG.isDebugEnabled()) { LOG.debug("No state logs...
### Question: ThriftHBaseServiceHandler implements THBaseService.Iface { @Override public boolean exists(ByteBuffer table, TGet get) throws TIOError, TException { Table htable = getTable(table); try { return htable.exists(getFromThrift(get)); } catch (IOException e) { throw getTIOError(e); } finally { closeTable(htable...
### Question: ThriftHBaseServiceHandler implements THBaseService.Iface { @Override public List<TDelete> deleteMultiple(ByteBuffer table, List<TDelete> deletes) throws TIOError, TException { Table htable = getTable(table); try { htable.delete(deletesFromThrift(deletes)); } catch (IOException e) { throw getTIOError(e); }...
### Question: ThriftHBaseServiceHandler implements THBaseService.Iface { @Override public TResult increment(ByteBuffer table, TIncrement increment) throws TIOError, TException { Table htable = getTable(table); try { return resultFromHBase(htable.increment(incrementFromThrift(increment))); } catch (IOException e) { thro...
### Question: ThriftHBaseServiceHandler implements THBaseService.Iface { @Override public TResult append(ByteBuffer table, TAppend append) throws TIOError, TException { Table htable = getTable(table); try { return resultFromHBase(htable.append(appendFromThrift(append))); } catch (IOException e) { throw getTIOError(e); ...
### Question: ThriftHBaseServiceHandler implements THBaseService.Iface { @Override public boolean checkAndPut(ByteBuffer table, ByteBuffer row, ByteBuffer family, ByteBuffer qualifier, ByteBuffer value, TPut put) throws TIOError, TException { Table htable = getTable(table); try { return htable.checkAndPut(byteBufferToB...
### Question: ThriftHBaseServiceHandler implements THBaseService.Iface { @Override public boolean checkAndDelete(ByteBuffer table, ByteBuffer row, ByteBuffer family, ByteBuffer qualifier, ByteBuffer value, TDelete deleteSingle) throws TIOError, TException { Table htable = getTable(table); try { if (value == null) { ret...
### Question: ThriftHBaseServiceHandler implements THBaseService.Iface { @Override public TResult get(ByteBuffer table, TGet get) throws TIOError, TException { Table htable = getTable(table); try { return resultFromHBase(htable.get(getFromThrift(get))); } catch (IOException e) { throw getTIOError(e); } finally { closeT...
### Question: ThriftHBaseServiceHandler implements THBaseService.Iface { @Override public void put(ByteBuffer table, TPut put) throws TIOError, TException { Table htable = getTable(table); try { htable.put(putFromThrift(put)); } catch (IOException e) { throw getTIOError(e); } finally { closeTable(htable); } } ThriftHBa...
### Question: ClientExceptionsUtil { public static Throwable findException(Object exception) { if (exception == null || !(exception instanceof Throwable)) { return null; } Throwable cur = (Throwable) exception; while (cur != null) { if (isSpecialException(cur)) { return cur; } if (cur instanceof RemoteException) { Remo...
### Question: LongComparator extends ByteArrayComparable { @Override public int compareTo(byte[] value, int offset, int length) { Long that = Bytes.toLong(value, offset, length); return this.longValue.compareTo(that); } LongComparator(long value); @Override int compareTo(byte[] value, int offset, int length); @Override...
### Question: RegionLocations { public RegionLocations removeByServer(ServerName serverName) { HRegionLocation[] newLocations = null; for (int i = 0; i < locations.length; i++) { if (locations[i] != null && serverName.equals(locations[i].getServerName())) { if (newLocations == null) { newLocations = new HRegionLocation...
### Question: RegionLocations { public RegionLocations remove(HRegionLocation location) { if (location == null) return this; if (location.getRegionInfo() == null) return this; int replicaId = location.getRegionInfo().getReplicaId(); if (replicaId >= locations.length) return this; if (locations[replicaId] == null || !lo...
### Question: RegionLocations { public RegionLocations updateLocation(HRegionLocation location, boolean checkForEquals, boolean force) { assert location != null; int replicaId = location.getRegionInfo().getReplicaId(); HRegionLocation oldLoc = getRegionLocation(location.getRegionInfo().getReplicaId()); HRegionLocation ...
### Question: IPCUtil { @SuppressWarnings("resource") public ByteBuffer buildCellBlock(final Codec codec, final CompressionCodec compressor, final CellScanner cellScanner) throws IOException { return buildCellBlock(codec, compressor, cellScanner, null); } IPCUtil(final Configuration conf); @SuppressWarnings("resource")...
### Question: PayloadCarryingRpcController extends TimeLimitedRpcController implements CellScannable { public CellScanner cellScanner() { return cellScanner; } PayloadCarryingRpcController(); PayloadCarryingRpcController(final CellScanner cellScanner); PayloadCarryingRpcController(final List<CellScannable> cellIterab...
### Question: AsyncProcess { @VisibleForTesting void waitUntilDone() throws InterruptedIOException { waitForMaximumCurrentTasks(0); } AsyncProcess(ClusterConnection hc, Configuration conf, ExecutorService pool, RpcRetryingCallerFactory rpcCaller, boolean useGlobalErrors, RpcControllerFactory rpcFactory); AsyncReq...
### Question: AsyncProcess { protected ConnectionManager.ServerErrorTracker createServerErrorTracker() { return new ConnectionManager.ServerErrorTracker( this.serverTrackerTimeout, this.numTries); } AsyncProcess(ClusterConnection hc, Configuration conf, ExecutorService pool, RpcRetryingCallerFactory rpcCaller, bo...
### Question: Get extends Query implements Row, Comparable<Row> { public Get(byte [] row) { Mutation.checkRow(row); this.row = row; } Get(byte [] row); Get(Get get); boolean isCheckExistenceOnly(); Get setCheckExistenceOnly(boolean checkExistenceOnly); boolean isClosestRowBefore(); Get setClosestRowBefore(boolean clos...
### Question: Operation { public String toJSON(int maxCols) throws IOException { return JsonMapper.writeMapAsString(toMap(maxCols)); } abstract Map<String, Object> getFingerprint(); abstract Map<String, Object> toMap(int maxCols); Map<String, Object> toMap(); String toJSON(int maxCols); String toJSON(); String toStrin...
### Question: DelayingRunner implements Runnable { public DelayingRunner(long sleepTime, Map.Entry<byte[], List<Action<T>>> e) { this.sleepTime = sleepTime; add(e); } DelayingRunner(long sleepTime, Map.Entry<byte[], List<Action<T>>> e); void setRunner(Runnable runner); @Override void run(); void add(Map.Entry<byte[], L...
### Question: Scan extends Query { @Override public Scan setAuthorizations(Authorizations authorizations) { return (Scan) super.setAuthorizations(authorizations); } Scan(); Scan(byte [] startRow, Filter filter); Scan(byte [] startRow); Scan(byte [] startRow, byte [] stopRow); Scan(Scan scan); Scan(Get get); boolea...
### Question: Put extends Mutation implements HeapSize, Comparable<Row> { public Put addColumn(byte [] family, byte [] qualifier, byte [] value) { return addColumn(family, qualifier, this.ts, value); } Put(byte [] row); Put(byte[] row, long ts); Put(byte [] rowArray, int rowOffset, int rowLength); Put(ByteBuffer row...
### Question: ClientScanner extends AbstractClientScanner { @Override public Result next() throws IOException { if (cache.size() == 0 && this.closed) { return null; } if (cache.size() == 0) { loadCache(); } if (cache.size() > 0) { return cache.poll(); } writeScanMetrics(); return null; } ClientScanner(final Configurati...
### Question: ZooKeeperWatcher implements Watcher, Abortable, Closeable { public boolean isClientReadable(String node) { return node.equals(baseZNode) || isAnyMetaReplicaZnode(node) || node.equals(getMasterAddressZNode()) || node.equals(clusterIdZNode)|| node.equals(rsZNode) || node.equals(tableZNode) || node.startsWit...
### Question: HBaseFsck extends Configured implements Closeable { public ErrorReporter getErrors() { return errors; } HBaseFsck(Configuration conf); HBaseFsck(Configuration conf, ExecutorService exec); void connect(); void offlineHdfsIntegrityRepair(); int onlineConsistencyRepair(); int onlineHbck(); static byte[] key...
### Question: HBaseFsck extends Configured implements Closeable { private void deleteMetaRegion(HbckInfo hi) throws IOException { deleteMetaRegion(hi.metaEntry.getRegionName()); } HBaseFsck(Configuration conf); HBaseFsck(Configuration conf, ExecutorService exec); void connect(); void offlineHdfsIntegrityRepair(); int ...
### Question: IdReadWriteLock { @VisibleForTesting int purgeAndGetEntryPoolSize() { gc(); Threads.sleep(200); lockPool.purge(); return lockPool.size(); } ReentrantReadWriteLock getLock(long id); @VisibleForTesting void waitForWaiters(long id, int numWaiters); }### Answer: @Test(timeout = 60000) public void testMultip...
### Question: ConnectionCache { ConnectionInfo getCurrentConnection() throws IOException { String userName = getEffectiveUser(); ConnectionInfo connInfo = connections.get(userName); if (connInfo == null || !connInfo.updateAccessTime()) { Lock lock = locker.acquireLock(userName); try { connInfo = connections.get(userNam...
### Question: RegionSizeCalculator { public long getRegionSize(byte[] regionId) { Long size = sizeMap.get(regionId); if (size == null) { LOG.debug("Unknown region:" + Arrays.toString(regionId)); return 0; } else { return size; } } @Deprecated RegionSizeCalculator(HTable table); RegionSizeCalculator(RegionLocator regi...
### Question: FSVisitor { public static void visitTableStoreFiles(final FileSystem fs, final Path tableDir, final StoreFileVisitor visitor) throws IOException { FileStatus[] regions = FSUtils.listStatus(fs, tableDir, new FSUtils.RegionDirFilter(fs)); if (regions == null) { if (LOG.isTraceEnabled()) { LOG.trace("No regi...
### Question: FSVisitor { public static void visitTableRecoveredEdits(final FileSystem fs, final Path tableDir, final FSVisitor.RecoveredEditsVisitor visitor) throws IOException { FileStatus[] regions = FSUtils.listStatus(fs, tableDir, new FSUtils.RegionDirFilter(fs)); if (regions == null) { if (LOG.isTraceEnabled()) {...
### Question: FSVisitor { public static void visitLogFiles(final FileSystem fs, final Path rootDir, final LogFileVisitor visitor) throws IOException { Path logsDir = new Path(rootDir, HConstants.HREGION_LOGDIR_NAME); FileStatus[] logServerDirs = FSUtils.listStatus(fs, logsDir); if (logServerDirs == null) { if (LOG.isTr...
### Question: FileLink { @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (this.getClass().equals(obj.getClass())) { return Arrays.equals(this.locations, ((FileLink) obj).locations); } return false; } protected FileLink(); FileLink(Path originPath, Path... alternativePaths); FileLi...
### Question: FileLink { @Override public int hashCode() { return Arrays.hashCode(locations); } protected FileLink(); FileLink(Path originPath, Path... alternativePaths); FileLink(final Collection<Path> locations); Path[] getLocations(); @Override String toString(); boolean exists(final FileSystem fs); Path getAvail...
### Question: FileLink { public FSDataInputStream open(final FileSystem fs) throws IOException { return new FSDataInputStream(new FileLinkInputStream(fs, this)); } protected FileLink(); FileLink(Path originPath, Path... alternativePaths); FileLink(final Collection<Path> locations); Path[] getLocations(); @Override S...
### Question: LruCachedBlock implements HeapSize, Comparable<LruCachedBlock> { @Override public int hashCode() { return (int)(accessTime ^ (accessTime >>> 32)); } LruCachedBlock(BlockCacheKey cacheKey, Cacheable buf, long accessTime); LruCachedBlock(BlockCacheKey cacheKey, Cacheable buf, long accessTime, boolean...
### Question: BucketCache implements BlockCache, HeapSize { public BucketAllocator getAllocator() { return this.bucketAllocator; } BucketCache(String ioEngineName, long capacity, int blockSize, int[] bucketSizes, int writerThreadNum, int writerQLen, String persistencePath); BucketCache(String ioEngineName, long ...
### Question: BucketCache implements BlockCache, HeapSize { void stopWriterThreads() throws InterruptedException { for (WriterThread writerThread : writerThreads) { writerThread.disableWriter(); writerThread.interrupt(); writerThread.join(); } } BucketCache(String ioEngineName, long capacity, int blockSize, int[] bucke...
### Question: Reference { public static Reference read(final FileSystem fs, final Path p) throws IOException { InputStream in = fs.open(p); try { in = in.markSupported()? in: new BufferedInputStream(in); int pblen = ProtobufUtil.lengthOfPBMagic(); in.mark(pblen); byte [] pbuf = new byte[pblen]; int read = in.read(pbuf)...
### Question: MetaMigrationConvertingToPB { static boolean isMetaTableUpdated(final HConnection hConnection) throws IOException { List<Result> results = MetaTableAccessor.fullScanOfMeta(hConnection); if (results == null || results.isEmpty()) { LOG.info("hbase:meta doesn't have any entries to update."); return true; } f...
### Question: LocalHBaseCluster { public LocalHBaseCluster(final Configuration conf) throws IOException { this(conf, DEFAULT_NO); } LocalHBaseCluster(final Configuration conf); LocalHBaseCluster(final Configuration conf, final int noRegionServers); LocalHBaseCluster(final Configuration conf, final int noMasters, ...
### Question: LogLevel { public static void main(String[] args) { if (args.length == 3 && "-getlevel".equals(args[0])) { process("http: return; } else if (args.length == 4 && "-setlevel".equals(args[0])) { process("http: + "&level=" + args[3]); return; } System.err.println(USAGES); System.exit(-1); } static void main(...
### Question: WsImportMojo extends AbstractJaxwsMojo { static String getActiveHttpProxy(Settings s) { String retVal = null; for (Proxy p : s.getProxies()) { if (p.isActive() && "http".equals(p.getProtocol())) { StringBuilder sb = new StringBuilder(); String user = p.getUsername(); String pwd = p.getPassword(); if (user...
### Question: TracingHttpClientBuilder extends HttpClientBuilder { public TracingHttpClientBuilder disableInjection() { this.injectDisabled = true; return this; } TracingHttpClientBuilder(); TracingHttpClientBuilder( RedirectStrategy redirectStrategy, boolean redirectHandlingDisabled); TracingHttpClie...
### Question: WXBizMsgCrypt { public String encrypt(String randomStr, String text) throws AesException { ByteGroup byteCollector = new ByteGroup(); byte[] randomStrBytes = randomStr.getBytes(CHARSET); byte[] textBytes = text.getBytes(CHARSET); byte[] networkBytesOrder = getNetworkBytesOrder(textBytes.length); byte[] ap...
### Question: WXBizMsgCrypt { public String verifyUrl(String msgSignature, String timeStamp, String nonce, String echoStr) throws AesException { String signature = SHA1.getSHA1(token, timeStamp, nonce, echoStr); if (!signature.equals(msgSignature)) { throw new AesException(AesException.ValidateSignatureError); } String...
### Question: MainActivityPresenter implements MainActivityContract.Presenter { @VisibleForTesting void checkAndroidVersionCompatibility() { if (!supportedByArtist()) { mView.showIncompatibleAndroidVersionDialog(); } } MainActivityPresenter(MainActivityContract.View view, SettingsManager setti...
### Question: MainActivityPresenter implements MainActivityContract.Presenter { @Override public void selectFragment(@selectableFragment int id) { Fragment selectedFragment = null; switch (id) { case INFO_FRAGMENT: if (mInfoFragment == null) { mInfoFragment = new InfoFragment(); } selectedFragment = mInfoFragment; brea...