name
stringlengths
12
178
code_snippet
stringlengths
8
36.5k
score
float64
3.26
3.68
hbase_HFileContextAttributesBuilderConsumer_setReadType_rdh
/** * Specify the {@link ReadType} involced in this IO operation. */ public HFileContextAttributesBuilderConsumer setReadType(final ReadType readType) { // TODO: this is not a part of the HFileBlock, its context of the operation. Should track this // detail elsewhere. this.readType = readType; return this; }
3.26
hbase_HFileContextAttributesBuilderConsumer_setSkipChecksum_rdh
/** * Specify that the {@link ChecksumType} should not be included in the attributes. */ public HFileContextAttributesBuilderConsumer setSkipChecksum(final boolean skipChecksum) { this.skipChecksum = skipChecksum; return this; }
3.26
hbase_MetricsAssignmentManager_getOpenProcMetrics_rdh
/** * Returns Set of common metrics for OpenRegionProcedure */ public ProcedureMetrics getOpenProcMetrics() { return openProcMetrics; }
3.26
hbase_MetricsAssignmentManager_updateRITOldestAge_rdh
/** * update the timestamp for oldest region in transition metrics. */ public void updateRITOldestAge(final long timestamp) { assignmentManagerSource.setRITOldestAge(timestamp); }
3.26
hbase_MetricsAssignmentManager_updateRitDuration_rdh
/** * update the duration metrics of region is transition */ public void updateRitDuration(long duration) { assignmentManagerSource.updateRitDuration(duration); }
3.26
hbase_MetricsAssignmentManager_m1_rdh
/** * Returns Set of common metrics for unassign procedure */ public ProcedureMetrics m1() { return unassignProcMetrics; }
3.26
hbase_MetricsAssignmentManager_getMergeProcMetrics_rdh
/** * Returns Set of common metrics for merge procedure */ public ProcedureMetrics getMergeProcMetrics() { return mergeProcMetrics; }
3.26
hbase_MetricsAssignmentManager_updateRITCount_rdh
/** * set new value for number of regions in transition. */ public void updateRITCount(final int ritCount) { assignmentManagerSource.setRIT(ritCount); }
3.26
hbase_MetricsAssignmentManager_m0_rdh
/** * update RIT count that are in this state for more than the threshold as defined by the property * rit.metrics.threshold.time. */ public void m0(final int ritCountOverThreshold) { assignmentManagerSource.setRITCountOverThreshold(ritCountOverThreshold); }
3.26
hbase_MetricsAssignmentManager_getAssignProcMetrics_rdh
/** * Returns Set of common metrics for assign procedure */ public ProcedureMetrics getAssignProcMetrics() { return f0; }
3.26
hbase_MetricsAssignmentManager_getSplitProcMetrics_rdh
/** * Returns Set of common metrics for split procedure */ public ProcedureMetrics getSplitProcMetrics() { return splitProcMetrics; }
3.26
hbase_MetricsAssignmentManager_getMoveProcMetrics_rdh
/** * Returns Set of common metrics for move procedure */ public ProcedureMetrics getMoveProcMetrics() { return moveProcMetrics; }
3.26
hbase_MetricsAssignmentManager_getCloseProcMetrics_rdh
/** * Returns Set of common metrics for CloseRegionProcedure */ public ProcedureMetrics getCloseProcMetrics() { return closeProcMetrics; }
3.26
hbase_MetricsAssignmentManager_getReopenProcMetrics_rdh
/** * Returns Set of common metrics for reopen procedure */ public ProcedureMetrics getReopenProcMetrics() { return reopenProcMetrics; }
3.26
hbase_RegionServerAccounting_getGlobalMemStoreHeapSize_rdh
/** * Returns the global memstore on-heap size in the RegionServer */ public long getGlobalMemStoreHeapSize() { return this.globalMemStoreHeapSize.sum(); }
3.26
hbase_RegionServerAccounting_getGlobalMemStoreOffHeapSize_rdh
/** * Returns the global memstore off-heap size in the RegionServer */ public long getGlobalMemStoreOffHeapSize() { return this.globalMemStoreOffHeapSize.sum(); }
3.26
hbase_RegionServerAccounting_setGlobalMemStoreLimits_rdh
// Called by the tuners. void setGlobalMemStoreLimits(long newGlobalMemstoreLimit) { if (this.memType == MemoryType.HEAP) { this.globalMemStoreLimit = newGlobalMemstoreLimit; this.f0 = ((long) (this.globalMemStoreLimit * this.globalMemStoreLimitLowMarkPercent)); } else { this.globalOnHeapMemstoreLimit = newGlobalMemstoreLimit; this.globalOnHeapMemstoreLimitLowMark = ((long) (this.globalOnHeapMemstoreLimit * this.globalMemStoreLimitLowMarkPercent)); } }
3.26
hbase_RegionServerAccounting_isAboveHighWaterMark_rdh
/** * Return the FlushType if we are above the memstore high water mark * * @return the FlushType */ public FlushType isAboveHighWaterMark() { // for onheap memstore we check if the global memstore size and the // global heap overhead is greater than the global memstore limit if (memType == MemoryType.HEAP) { if (getGlobalMemStoreHeapSize() >= globalMemStoreLimit) { return FlushType.ABOVE_ONHEAP_HIGHER_MARK; } } else // If the configured memstore is offheap, check for two things // 1) If the global memstore off-heap size is greater than the configured // 'hbase.regionserver.offheap.global.memstore.size' // 2) If the global memstore heap size is greater than the configured onheap // global memstore limit 'hbase.regionserver.global.memstore.size'. // We do this to avoid OOME incase of scenarios where the heap is occupied with // lot of onheap references to the cells in memstore if (getGlobalMemStoreOffHeapSize() >= globalMemStoreLimit) { // Indicates that global memstore size is above the configured // 'hbase.regionserver.offheap.global.memstore.size' return FlushType.ABOVE_OFFHEAP_HIGHER_MARK; } else if (getGlobalMemStoreHeapSize() >= this.globalOnHeapMemstoreLimit) { // Indicates that the offheap memstore's heap overhead is greater than the // configured 'hbase.regionserver.global.memstore.size'. return FlushType.ABOVE_ONHEAP_HIGHER_MARK; } return FlushType.NORMAL; }
3.26
hbase_RegionServerAccounting_getGlobalMemStoreDataSize_rdh
/** * Returns the global Memstore data size in the RegionServer */ public long getGlobalMemStoreDataSize() { return globalMemStoreDataSize.sum();}
3.26
hbase_RegionServerAccounting_isAboveLowWaterMark_rdh
/** * Return the FlushType if we're above the low watermark * * @return the FlushType */ public FlushType isAboveLowWaterMark() { // for onheap memstore we check if the global memstore size and the // global heap overhead is greater than the global memstore lower mark limit if (memType == MemoryType.HEAP) { if (getGlobalMemStoreHeapSize() >= f0) { return FlushType.ABOVE_ONHEAP_LOWER_MARK; } } else if (getGlobalMemStoreOffHeapSize() >= f0) { // Indicates that the offheap memstore's size is greater than the global memstore // lower limit return FlushType.ABOVE_OFFHEAP_LOWER_MARK; } else if (getGlobalMemStoreHeapSize() >= globalOnHeapMemstoreLimitLowMark) { // Indicates that the offheap memstore's heap overhead is greater than the global memstore // onheap lower limit return FlushType.ABOVE_ONHEAP_LOWER_MARK; } return FlushType.NORMAL; }
3.26
hbase_AbstractRpcBasedConnectionRegistry_transformMetaRegionLocations_rdh
/** * Simple helper to transform the result of getMetaRegionLocations() rpc. */ private static RegionLocations transformMetaRegionLocations(GetMetaRegionLocationsResponse resp) { List<HRegionLocation> regionLocations = new ArrayList<>(); resp.getMetaLocationsList().forEach(location -> regionLocations.add(ProtobufUtil.toRegionLocation(location))); return new RegionLocations(regionLocations); }
3.26
hbase_AbstractRpcBasedConnectionRegistry_groupCall_rdh
/** * send requests concurrently to hedgedReadsFanout end points. If any of the request is succeeded, * we will complete the future and quit. If all the requests in one round are failed, we will * start another round to send requests concurrently tohedgedReadsFanout end points. If all end * points have been tried and all of them are failed, we will fail the future. */private <T extends Message> void groupCall(CompletableFuture<T> future, Set<ServerName> servers, List<ClientMetaService.Interface> stubs, int startIndexInclusive, Callable<T> callable, Predicate<T> isValidResp, String debug, ConcurrentLinkedQueue<Throwable> errors) { int endIndexExclusive = Math.min(startIndexInclusive + hedgedReadFanOut, stubs.size()); AtomicInteger remaining = new AtomicInteger(endIndexExclusive - startIndexInclusive); for (int i = startIndexInclusive; i < endIndexExclusive; i++) { addListener(call(stubs.get(i), callable), (r, e) -> { // a simple check to skip all the later operations earlier if (future.isDone()) { return; } if ((e == null) && (!isValidResp.test(r))) {e = badResponse(debug); } if (e != null) { // make sure when remaining reaches 0 we have all exceptions in the errors queue errors.add(e); if (remaining.decrementAndGet() == 0) { if (endIndexExclusive == stubs.size()) { // we are done, complete the future with exception RetriesExhaustedException ex = new RetriesExhaustedException("masters", stubs.size(), new ArrayList<>(errors)); future.completeExceptionally(new MasterRegistryFetchException(servers, ex)); } else { groupCall(future, servers, stubs, endIndexExclusive, callable, isValidResp, debug, errors); } } } else { // do not need to decrement the counter any more as we have already finished the future. future.complete(r); } }); }}
3.26
hbase_ScheduledChore_toString_rdh
/** * A summation of this chore in human readable format. Downstream users should not presume parsing * of this string can relaibly be done between versions. Instead, they should rely on the public * accessor methods to get the information they desire. */ @InterfaceAudience.Private @Override public String toString() { return (((("ScheduledChore name=" + getName()) + ", period=") + getPeriod()) + ", unit=") + getTimeUnit(); }
3.26
hbase_ScheduledChore_onChoreMissedStartTime_rdh
/** * Notify the ChoreService that this chore has missed its start time. Allows the ChoreService to * make the decision as to whether or not it would be worthwhile to increase the number of core * pool threads */ private synchronized void onChoreMissedStartTime() { if (choreService != null) { choreService.onChoreMissedStartTime(this); } }
3.26
hbase_ScheduledChore_getInitialDelay_rdh
/** * Returns initial delay before executing chore in getTimeUnit() units */ public long getInitialDelay() { return initialDelay; }
3.26
hbase_ScheduledChore_getPeriod_rdh
/** * Returns period to execute chore in getTimeUnit() units */ public int getPeriod() { return period; }
3.26
hbase_ScheduledChore_updateTimeTrackingBeforeRun_rdh
/** * Update our time tracking members. Called at the start of an execution of this chore's run() * method so that a correct decision can be made as to whether or not we missed the start time */ private synchronized void updateTimeTrackingBeforeRun() { timeOfLastRun = timeOfThisRun; timeOfThisRun = EnvironmentEdgeManager.currentTime(); }
3.26
hbase_ScheduledChore_getTimeBetweenRuns_rdh
/** * Return how long in millis has it been since this chore last run. Useful for checking if the * chore has missed its scheduled start time by too large of a margin */ synchronized long getTimeBetweenRuns() { return timeOfThisRun - timeOfLastRun; }
3.26
hbase_ScheduledChore_isScheduled_rdh
/** * Returns true when this Chore is scheduled with a ChoreService */ public synchronized boolean isScheduled() { return (choreService != null) && choreService.isChoreScheduled(this); }
3.26
hbase_ScheduledChore_cleanup_rdh
/** * Override to run cleanup tasks when the Chore encounters an error and must stop running */ protected void cleanup() {}
3.26
hbase_ScheduledChore_isValidTime_rdh
/** * Return true if time is earlier or equal to current time */ private synchronized boolean isValidTime(final long time) { return (time > 0) && (time <= EnvironmentEdgeManager.currentTime()); }
3.26
hbase_ScheduledChore_missedStartTime_rdh
/** * Returns true when the time between runs exceeds the acceptable threshold */ private synchronized boolean missedStartTime() { return (isValidTime(timeOfLastRun) && isValidTime(timeOfThisRun)) && (getTimeBetweenRuns() > getMaximumAllowedTimeBetweenRuns());}
3.26
hbase_ScheduledChore_getMaximumAllowedTimeBetweenRuns_rdh
/** * Returns max allowed time in millis between runs. */ private double getMaximumAllowedTimeBetweenRuns() { // Threshold used to determine if the Chore's current run started too late return 1.5 * timeUnit.toMillis(period); }
3.26
hbase_ScheduledChore_shutdown_rdh
/** * Completely shutdown the ScheduleChore, which means we will call cleanup and you should not * schedule it again. * <p/> * This is another path to cleanup the chore, comparing to stop the stopper instance passed in. */ public synchronized void shutdown(boolean mayInterruptIfRunning) { cancel(mayInterruptIfRunning); cleanup(); }
3.26
hbase_ScheduledChore_m0_rdh
/** * Override to run a task before we start looping. * * @return true if initial chore was successful */ protected boolean m0() { // Default does nothing return true; }
3.26
hbase_ScheduledChore_triggerNow_rdh
/** * Returns false when the Chore is not currently scheduled with a ChoreService */ public synchronized boolean triggerNow() { if (choreService == null) { return false; } choreService.triggerNow(this); return true; }
3.26
hbase_WAL_m0_rdh
/** * Used to initialize the WAL. Usually this is for creating the first writer. */ default void m0() throws IOException { }
3.26
hbase_WAL_getKey_rdh
/** * Gets the key */ public WALKeyImpl getKey() { return key; }
3.26
hbase_WAL_sync_rdh
/** * * @param txid * Transaction id to sync to. * @param forceSync * Flag to force sync rather than flushing to the buffer. Example - Hadoop hflush * vs hsync. * @throws when * timeout, it would throw {@link WALSyncTimeoutIOException}. */ default void sync(long txid, boolean forceSync) throws IOException { sync(txid); } /** * WAL keeps track of the sequence numbers that are as yet not flushed im memstores in order to be * able to do accounting to figure which WALs can be let go. This method tells WAL that some * region is about to flush. The flush can be the whole region or for a column family of the * region only. * <p> * Currently, it is expected that the update lock is held for the region; i.e. no concurrent * appends while we set up cache flush. * * @param families * Families to flush. May be a subset of all families in the region. * @return Returns {@link HConstants#NO_SEQNUM}
3.26
hbase_WAL_getEdit_rdh
/** * Gets the edit */ public WALEdit getEdit() {return edit; }
3.26
hbase_ServerCrashProcedure_zkCoordinatedSplitMetaLogs_rdh
/** * Split hbase:meta logs using 'classic' zk-based coordination. Superceded by procedure-based WAL * splitting. * * @see #createSplittingWalProcedures(MasterProcedureEnv, boolean) */ private void zkCoordinatedSplitMetaLogs(MasterProcedureEnv env) throws IOException { LOG.debug("Splitting meta WALs {}", this); MasterWalManager mwm = env.getMasterServices().getMasterWalManager(); AssignmentManager am = env.getMasterServices().getAssignmentManager(); am.getRegionStates().metaLogSplitting(serverName); mwm.splitMetaLog(serverName); am.getRegionStates().metaLogSplit(serverName); LOG.debug("Done splitting meta WALs {}", this); }
3.26
hbase_ServerCrashProcedure_getRegionsOnCrashedServer_rdh
/** * Returns List of Regions on crashed server. */ List<RegionInfo> getRegionsOnCrashedServer(MasterProcedureEnv env) { return env.getMasterServices().getAssignmentManager().getRegionsOnServer(serverName); }
3.26
hbase_ServerCrashProcedure_isMatchingRegionLocation_rdh
/** * Moved out here so can be overridden by the HBCK fix-up SCP to be less strict about what it will * tolerate as a 'match'. * * @return True if the region location in <code>rsn</code> matches that of this crashed server. */ protected boolean isMatchingRegionLocation(RegionStateNode rsn) { return this.serverName.equals(rsn.getRegionLocation()); }
3.26
hbase_ServerCrashProcedure_zkCoordinatedSplitLogs_rdh
/** * Split logs using 'classic' zk-based coordination. Superceded by procedure-based WAL splitting. * * @see #createSplittingWalProcedures(MasterProcedureEnv, boolean) */ private void zkCoordinatedSplitLogs(final MasterProcedureEnv env) throws IOException { LOG.debug("Splitting WALs {}", this); MasterWalManager mwm = env.getMasterServices().getMasterWalManager(); AssignmentManager am = env.getMasterServices().getAssignmentManager(); // TODO: For Matteo. Below BLOCKs!!!! Redo so can relinquish executor while it is running. // PROBLEM!!! WE BLOCK HERE. Can block for hours if hundreds of WALs to split and hundreds // of SCPs running because big cluster crashed down. am.getRegionStates().logSplitting(this.serverName); mwm.splitLog(this.serverName); if (!carryingMeta) { mwm.archiveMetaLog(this.serverName); } am.getRegionStates().logSplit(this.serverName); LOG.debug("Done splitting WALs {}", this); }
3.26
hbase_ServerCrashProcedure_assignRegions_rdh
/** * Assign the regions on the crashed RS to other Rses. * <p/> * In this method we will go through all the RegionStateNodes of the give regions to find out * whether there is already an TRSP for the region, if so we interrupt it and let it retry on * other server, otherwise we will schedule a TRSP to bring the region online. * <p/> * We will also check whether the table for a region is enabled, if not, we will skip assigning * it. */private void assignRegions(MasterProcedureEnv env, List<RegionInfo> regions) throws IOException { AssignmentManager am = env.getMasterServices().getAssignmentManager(); boolean retainAssignment = env.getMasterConfiguration().getBoolean(MASTER_SCP_RETAIN_ASSIGNMENT, DEFAULT_MASTER_SCP_RETAIN_ASSIGNMENT); for (RegionInfo region : regions) { RegionStateNode regionNode = am.getRegionStates().getOrCreateRegionStateNode(region); regionNode.lock(); try { // This is possible, as when a server is dead, TRSP will fail to schedule a RemoteProcedure // and then try to assign the region to a new RS. And before it has updated the region // location to the new RS, we may have already called the am.getRegionsOnServer so we will // consider the region is still on this crashed server. Then before we arrive here, the // TRSP could have updated the region location, or even finished itself, so the region is // no longer on this crashed server any more. We should not try to assign it again. Please // see HBASE-23594 for more details. // UPDATE: HBCKServerCrashProcedure overrides isMatchingRegionLocation; this check can get // in the way of our clearing out 'Unknown Servers'. if (!isMatchingRegionLocation(regionNode)) { // See HBASE-24117, though we have already changed the shutdown order, it is still worth // double checking here to confirm that we do not skip assignment incorrectly. if (!am.isRunning()) { throw new DoNotRetryIOException("AssignmentManager has been stopped, can not process assignment any more"); } LOG.info("{} found {} whose regionLocation no longer matches {}, skipping assign...", this, regionNode, serverName); continue; }if (regionNode.getProcedure() != null) { LOG.info("{} found RIT {}; {}", this, regionNode.getProcedure(), regionNode); regionNode.getProcedure().serverCrashed(env, regionNode, getServerName(), !retainAssignment); continue; } if (env.getMasterServices().getTableStateManager().isTableState(regionNode.getTable(), State.DISABLING)) { // We need to change the state here otherwise the TRSP scheduled by DTP will try to // close the region from a dead server and will never succeed. Please see HBASE-23636 // for more details. env.getAssignmentManager().regionClosedAbnormally(regionNode); LOG.info("{} found table disabling for region {}, set it state to ABNORMALLY_CLOSED.", this, regionNode); continue; } if (env.getMasterServices().getTableStateManager().isTableState(regionNode.getTable(), State.DISABLED)) { // This should not happen, table disabled but has regions on server. LOG.warn("Found table disabled for region {}, procDetails: {}", regionNode, this); continue; } TransitRegionStateProcedure proc = TransitRegionStateProcedure.assign(env, region, !retainAssignment, null); regionNode.setProcedure(proc); addChildProcedure(proc); } finally { regionNode.unlock(); } } }
3.26
hbase_Abortable_abort_rdh
/** * It just call another abort method and the Throwable parameter is null. * * @param why * Why we're aborting. * @see Abortable#abort(String, Throwable) */ default void abort(String why) { abort(why, null); }
3.26
hbase_AbstractHBaseTool_doStaticMain_rdh
/** * Call this from the concrete tool class's main function. */ protected void doStaticMain(String[] args) { int ret; try { ret = ToolRunner.run(HBaseConfiguration.create(), this, args); } catch (Exception ex) { LOG.error("Error running command-line tool", ex); ret = EXIT_FAILURE; } System.exit(ret); }
3.26
hbase_AbstractHBaseTool_parseLong_rdh
/** * Parse a number and enforce a range. */ public static long parseLong(String s, long minValue, long maxValue) { long v11 = Long.parseLong(s); if ((v11 < minValue) || (v11 > maxValue)) { throw new IllegalArgumentException(((((("The value " + v11) + " is out of range [") + minValue) + ", ") + maxValue) + "]");} return v11; }
3.26
hbase_AbstractHBaseTool_newParser_rdh
/** * Create the parser to use for parsing and validating the command line. Since commons-cli lacks * the capability to validate arbitrary combination of options, it may be helpful to bake custom * logic into a specialized parser implementation. See LoadTestTool for examples. * * @return a new parser specific to the current tool */ protected CommandLineParser newParser() { return new DefaultParser(); }
3.26
hbase_AbstractPositionedByteRange_setOffset_rdh
/** * Update the beginning of this range. {@code offset + length} may not be greater than * {@code bytes.length}. Resets {@code position} to 0. the new start of this range. * * @return this. */ @Override public PositionedByteRange setOffset(int offset) { this.position = 0; super.setOffset(offset); return this; }
3.26
hbase_AbstractPositionedByteRange_get_rdh
// java boilerplate @Override public PositionedByteRange get(int index, byte[] dst) { super.get(index, dst); return this; }
3.26
hbase_AbstractPositionedByteRange_setLength_rdh
/** * Update the length of this range. {@code offset + length} should not be greater than * {@code bytes.length}. If {@code position} is greater than the new {@code length}, sets * {@code position} to {@code length}. The new length of this range. * * @return this. */ @Override public PositionedByteRange setLength(int length) { this.position = Math.min(position, length); super.setLength(length); return this; }
3.26
hbase_StoreScanner_selectScannersFrom_rdh
/** * Filters the given list of scanners using Bloom filter, time range, and TTL. * <p> * Will be overridden by testcase so declared as protected. */ protected List<KeyValueScanner> selectScannersFrom(HStore store, List<? extends KeyValueScanner> allScanners) { boolean memOnly; boolean filesOnly; if (scan instanceof InternalScan) { InternalScan iscan = ((InternalScan) (scan)); memOnly = iscan.isCheckOnlyMemStore(); filesOnly = iscan.isCheckOnlyStoreFiles(); } else { memOnly = false; filesOnly = false; } List<KeyValueScanner> scanners = new ArrayList<>(allScanners.size()); // We can only exclude store files based on TTL if minVersions is set to 0. // Otherwise, we might have to return KVs that have technically expired. long expiredTimestampCutoff = (minVersions == 0) ? f2 : Long.MIN_VALUE; // include only those scan files which pass all filters for (KeyValueScanner kvs : allScanners) { boolean isFile = kvs.isFileScanner(); if (((!isFile) && filesOnly) || (isFile && memOnly)) { kvs.close();continue; } if (kvs.shouldUseScanner(scan, store, expiredTimestampCutoff)) { scanners.add(kvs); } else { kvs.close(); } } return scanners; }
3.26
hbase_StoreScanner_updateReaders_rdh
// Implementation of ChangedReadersObserver @Override public void updateReaders(List<HStoreFile> sfs, List<KeyValueScanner> memStoreScanners) throws IOException { if (CollectionUtils.isEmpty(sfs) && CollectionUtils.isEmpty(memStoreScanners)) { return; } boolean updateReaders = false; flushLock.lock(); try { if (!closeLock.tryLock()) { // The reason for doing this is that when the current store scanner does not retrieve // any new cells, then the scanner is considered to be done. The heap of this scanner // is not closed till the shipped() call is completed. Hence in that case if at all // the partial close (close (false)) has been called before updateReaders(), there is no // need for the updateReaders() to happen. LOG.debug("StoreScanner already has the close lock. There is no need to updateReaders"); // no lock acquired. clearAndClose(memStoreScanners); return; } // lock acquired updateReaders = true; if (this.closing) { LOG.debug("StoreScanner already closing. There is no need to updateReaders"); clearAndClose(memStoreScanners); return; } flushed = true; final boolean isCompaction = false; boolean usePread = get || scanUsePread; // SEE HBASE-19468 where the flushed files are getting compacted even before a scanner // calls next(). So its better we create scanners here rather than next() call. Ensure // these scanners are properly closed() whether or not the scan is completed successfully // Eagerly creating scanners so that we have the ref counting ticking on the newly created // store files. In case of stream scanners this eager creation does not induce performance // penalty because in scans (that uses stream scanners) the next() call is bound to happen. List<KeyValueScanner> scanners = store.getScanners(sfs, cacheBlocks, get, usePread, isCompaction, matcher, scan.getStartRow(), scan.getStopRow(), this.readPt, false); flushedstoreFileScanners.addAll(scanners); if (!CollectionUtils.isEmpty(memStoreScanners)) { clearAndClose(memStoreScannersAfterFlush); memStoreScannersAfterFlush.addAll(memStoreScanners); } } finally { flushLock.unlock(); if (updateReaders) { closeLock.unlock(); } } // Let the next() call handle re-creating and seeking }
3.26
hbase_StoreScanner_seekAsDirection_rdh
/** * Do a reseek in a normal StoreScanner(scan forward) * * @return true if scanner has values left, false if end of scanner */ protected boolean seekAsDirection(Cell kv) throws IOException { return reseek(kv); }
3.26
hbase_StoreScanner_parallelSeek_rdh
/** * Seek storefiles in parallel to optimize IO latency as much as possible * * @param scanners * the list {@link KeyValueScanner}s to be read from * @param kv * the KeyValue on which the operation is being requested */ private void parallelSeek(final List<? extends KeyValueScanner> scanners, final Cell kv) throws IOException { if (scanners.isEmpty()) return; int storeFileScannerCount = scanners.size(); CountDownLatch latch = new CountDownLatch(storeFileScannerCount); List<ParallelSeekHandler> handlers = new ArrayList<>(storeFileScannerCount); for (KeyValueScanner scanner : scanners) { if (scanner instanceof StoreFileScanner) {ParallelSeekHandler seekHandler = new ParallelSeekHandler(scanner, kv, this.readPt, latch); executor.submit(seekHandler); handlers.add(seekHandler);} else { scanner.seek(kv); latch.countDown(); } } try { latch.await(); } catch (InterruptedException ie) { throw ((InterruptedIOException) (new InterruptedIOException().initCause(ie))); } for (ParallelSeekHandler handler : handlers) { if (handler.getErr() != null) { throw new IOException(handler.getErr()); } } }
3.26
hbase_StoreScanner_getAllScannersForTesting_rdh
/** * Used in testing. * * @return all scanners in no particular order */ List<KeyValueScanner> getAllScannersForTesting() { List<KeyValueScanner> allScanners = new ArrayList<>(); KeyValueScanner current = heap.getCurrentForTesting(); if (current != null) allScanners.add(current); for (KeyValueScanner scanner : heap.getHeap()) allScanners.add(scanner); return allScanners; }
3.26
hbase_StoreScanner_getEstimatedNumberOfKvsScanned_rdh
/** * Returns The estimated number of KVs seen by this scanner (includes some skipped KVs). */ public long getEstimatedNumberOfKvsScanned() {return this.kvsScanned; }
3.26
hbase_StoreScanner_m0_rdh
/** * Returns if top of heap has changed (and KeyValueHeap has to try the next KV) */ protected final boolean m0() throws IOException { // here we can make sure that we have a Store instance so no null check on store. Cell lastTop = heap.peek(); // When we have the scan object, should we not pass it to getScanners() to get a limited set of // scanners? We did so in the constructor and we could have done it now by storing the scan // object from the constructor List<KeyValueScanner> scanners; flushLock.lock(); try { List<KeyValueScanner> allScanners = new ArrayList<>(flushedstoreFileScanners.size() + memStoreScannersAfterFlush.size()); allScanners.addAll(flushedstoreFileScanners); allScanners.addAll(memStoreScannersAfterFlush); scanners = selectScannersFrom(store, allScanners); // Clear the current set of flushed store files scanners so that they don't get added again flushedstoreFileScanners.clear(); memStoreScannersAfterFlush.clear();} finally { flushLock.unlock(); } // Seek the new scanners to the last key seekScanners(scanners, lastTop, false, f1); // remove the older memstore scanner for (int i = currentScanners.size() - 1; i >= 0; i--) { if (!currentScanners.get(i).isFileScanner()) { scannersForDelayedClose.add(currentScanners.remove(i)); } else { // we add the memstore scanner to the end of currentScanners break;} } // add the newly created scanners on the flushed files and the current active memstore scanner addCurrentScanners(scanners); // Combine all seeked scanners with a heap resetKVHeap(this.currentScanners, store.getComparator()); resetQueryMatcher(lastTop); if ((heap.peek() == null) || (store.getComparator().compareRows(lastTop, this.heap.peek()) != 0)) { LOG.info((("Storescanner.peek() is changed where before = " + lastTop.toString()) + ",and after = ") + heap.peek()); topChanged = true; } else { topChanged = false; } return topChanged; }
3.26
hbase_StoreScanner_next_rdh
/** * Get the next row of values from this Store. * * @return true if there are more rows, false if scanner is done */ @Override public boolean next(List<Cell> outResult, ScannerContext scannerContext) throws IOException { if (scannerContext == null) { throw new IllegalArgumentException("Scanner context cannot be null"); } if (checkFlushed() && m0()) { return scannerContext.setScannerState(NextState.MORE_VALUES).hasMoreValues(); } // if the heap was left null, then the scanners had previously run out anyways, close and // return. if (this.heap == null) { // By this time partial close should happened because already heap is null close(false);// Do all cleanup except heap.close() return scannerContext.setScannerState(NextState.NO_MORE_VALUES).hasMoreValues(); } Cell cell = this.heap.peek(); if (cell == null) { close(false);// Do all cleanup except heap.close() return scannerContext.setScannerState(NextState.NO_MORE_VALUES).hasMoreValues(); } // only call setRow if the row changes; avoids confusing the query matcher // if scanning intra-row // If no limits exists in the scope LimitScope.Between_Cells then we are sure we are changing // rows. Else it is possible we are still traversing the same row so we must perform the row // comparison. if ((!scannerContext.hasAnyLimit(LimitScope.BETWEEN_CELLS)) || (matcher.currentRow() == null)) { this.f0 = 0; matcher.setToNewRow(cell); }// Clear progress away unless invoker has indicated it should be kept. if ((!scannerContext.getKeepProgress()) && (!scannerContext.getSkippingRow())) { scannerContext.clearProgress(); }Optional<RpcCall> rpcCall = (matcher.isUserScan()) ? RpcServer.getCurrentCall() : Optional.empty(); int count = 0; long totalBytesRead = 0; // track the cells for metrics only if it is a user read request. boolean onlyFromMemstore = matcher.isUserScan(); try { LOOP : do { // Update and check the time limit based on the configured value of cellsPerTimeoutCheck // Or if the preadMaxBytes is reached and we may want to return so we can switch to stream // in // the shipped method below. if (((kvsScanned % cellsPerHeartbeatCheck) == 0) || ((scanUsePread && (readType == ReadType.DEFAULT)) && (bytesRead > preadMaxBytes))) { if (scannerContext.checkTimeLimit(LimitScope.BETWEEN_CELLS)) { return scannerContext.setScannerState(NextState.TIME_LIMIT_REACHED).hasMoreValues();} } // Do object compare - we set prevKV from the same heap. if (prevCell != cell) { ++kvsScanned; } checkScanOrder(prevCell, cell, comparator); int cellSize = PrivateCellUtil.estimatedSerializedSizeOf(cell); bytesRead += cellSize; if ((scanUsePread && (readType == ReadType.DEFAULT)) && (bytesRead > preadMaxBytes)) { // return immediately if we want to switch from pread to stream. We need this because we // can // only switch in the shipped method, if user use a filter to filter out everything and // rpc // timeout is very large then the shipped method will never be called until the whole scan // is finished, but at that time we have already scan all the data... // See HBASE-20457 for more details. // And there is still a scenario that can not be handled. If we have a very large row, // which // have millions of qualifiers, and filter.filterRow is used, then even if we set the flag // here, we still need to scan all the qualifiers before returning... scannerContext.returnImmediately(); } heap.recordBlockSize(blockSize -> { if (rpcCall.isPresent()) { rpcCall.get().incrementBlockBytesScanned(blockSize); } scannerContext.incrementBlockProgress(blockSize); }); prevCell = cell; scannerContext.setLastPeekedCell(cell); topChanged = false; ScanQueryMatcher.MatchCode qcode = matcher.match(cell); switch (qcode) { case INCLUDE : case INCLUDE_AND_SEEK_NEXT_ROW : case INCLUDE_AND_SEEK_NEXT_COL : Filter f = matcher.getFilter(); if (f != null) { cell = f.transformCell(cell); } this.f0++; // add to results only if we have skipped #storeOffset kvs // also update metric accordingly if (this.f0 > storeOffset) { outResult.add(cell); // Update local tracking information count++; totalBytesRead += cellSize; /** * Increment the metric if all the cells are from memstore. If not we will account it * for mixed reads */ onlyFromMemstore = onlyFromMemstore && heap.isLatestCellFromMemstore(); // Update the progress of the scanner context scannerContext.incrementSizeProgress(cellSize, cell.heapSize()); scannerContext.incrementBatchProgress(1); if (matcher.isUserScan() && (totalBytesRead > maxRowSize)) { String message = (((((("Max row size allowed: " + maxRowSize) + ", but the row is bigger than that, the row info: ") + CellUtil.toString(cell, false)) + ", already have process row cells = ") + outResult.size()) + ", it belong to region = ") + store.getHRegion().getRegionInfo().getRegionNameAsString(); LOG.warn(message); throw new RowTooBigException(message); } if ((storeLimit > (-1)) && (this.f0 >= (storeLimit + storeOffset))) { // do what SEEK_NEXT_ROW does. if (!matcher.moreRowsMayExistAfter(cell)) { close(false);// Do all cleanup except heap.close() return scannerContext.setScannerState(NextState.NO_MORE_VALUES).hasMoreValues(); } matcher.clearCurrentRow(); seekToNextRow(cell); break LOOP; } } if (qcode == MatchCode.INCLUDE_AND_SEEK_NEXT_ROW) { if (!matcher.moreRowsMayExistAfter(cell)) { close(false);// Do all cleanup except heap.close() return scannerContext.setScannerState(NextState.NO_MORE_VALUES).hasMoreValues(); } matcher.clearCurrentRow(); seekOrSkipToNextRow(cell); } else if (qcode == MatchCode.INCLUDE_AND_SEEK_NEXT_COL) { seekOrSkipToNextColumn(cell); } else { this.heap.next(); } if (scannerContext.checkBatchLimit(LimitScope.BETWEEN_CELLS)) { break LOOP; } if (scannerContext.checkSizeLimit(LimitScope.BETWEEN_CELLS)) { break LOOP; } continue; case DONE : // Optimization for Gets! If DONE, no more to get on this row, early exit! if (get) { // Then no more to this row... exit. close(false);// Do all cleanup except heap.close() // update metric return scannerContext.setScannerState(NextState.NO_MORE_VALUES).hasMoreValues(); } matcher.clearCurrentRow(); return scannerContext.setScannerState(NextState.MORE_VALUES).hasMoreValues(); case DONE_SCAN : close(false);// Do all cleanup except heap.close() return scannerContext.setScannerState(NextState.NO_MORE_VALUES).hasMoreValues(); case SEEK_NEXT_ROW : // This is just a relatively simple end of scan fix, to short-cut end // us if there is an endKey in the scan. if (!matcher.moreRowsMayExistAfter(cell)) { close(false);// Do all cleanup except heap.close() return scannerContext.setScannerState(NextState.NO_MORE_VALUES).hasMoreValues(); }matcher.clearCurrentRow(); seekOrSkipToNextRow(cell); NextState stateAfterSeekNextRow = needToReturn(outResult); if (stateAfterSeekNextRow != null) { return scannerContext.setScannerState(stateAfterSeekNextRow).hasMoreValues(); } break; case SEEK_NEXT_COL : seekOrSkipToNextColumn(cell); NextState stateAfterSeekNextColumn = needToReturn(outResult); if (stateAfterSeekNextColumn != null) { return scannerContext.setScannerState(stateAfterSeekNextColumn).hasMoreValues(); } break; case SKIP : this.heap.next(); break; case SEEK_NEXT_USING_HINT : Cell nextKV = matcher.getNextKeyHint(cell); if (nextKV != null) { int difference = comparator.compare(nextKV, cell); if (((!scan.isReversed()) && (difference > 0)) || (scan.isReversed() && (difference < 0))) { seekAsDirection(nextKV); NextState stateAfterSeekByHint = needToReturn(outResult); if (stateAfterSeekByHint != null) { return scannerContext.setScannerState(stateAfterSeekByHint).hasMoreValues(); } break; } } heap.next(); break; default : throw new RuntimeException("UNEXPECTED"); } // One last chance to break due to size limit. The INCLUDE* cases above already check // limit and continue. For the various filtered cases, we need to check because block // size limit may have been exceeded even if we don't add cells to result list. if (scannerContext.checkSizeLimit(LimitScope.BETWEEN_CELLS)) { return scannerContext.setScannerState(NextState.MORE_VALUES).hasMoreValues(); } } while ((cell = this.heap.peek()) != null );if (count > 0) { return scannerContext.setScannerState(NextState.MORE_VALUES).hasMoreValues(); } // No more keys close(false);// Do all cleanup except heap.close() return scannerContext.setScannerState(NextState.NO_MORE_VALUES).hasMoreValues(); } finally { // increment only if we have some result if ((count > 0) && matcher.isUserScan()) { // if true increment memstore metrics, if not the mixed one updateMetricsStore(onlyFromMemstore); } } }
3.26
hbase_StoreScanner_trySkipToNextColumn_rdh
/** * See {@link org.apache.hadoop.hbase.regionserver.StoreScanner#trySkipToNextRow(Cell)} * * @param cell * current cell * @return true means skip to next column, false means not */ protected boolean trySkipToNextColumn(Cell cell) throws IOException { Cell nextCell = null; // used to guard against a changed next indexed key by doing a identity comparison // when the identity changes we need to compare the bytes again Cell previousIndexedKey = null; do {Cell v32 = getNextIndexedKey(); if (((v32 != null) && (v32 != KeyValueScanner.NO_NEXT_INDEXED_KEY)) && ((v32 == previousIndexedKey) || (matcher.compareKeyForNextColumn(v32, cell) >= 0))) { this.heap.next(); ++kvsScanned; previousIndexedKey = v32; } else { return false; } } while (((nextCell = this.heap.peek()) != null) && CellUtil.matchingRowColumn(cell, nextCell) ); // We need this check because it may happen that the new scanner that we get // during heap.next() is requiring reseek due of fake KV previously generated for // ROWCOL bloom filter optimization. See HBASE-19863 for more details if ((useRowColBloom && (nextCell != null)) && (cell.getTimestamp() == PrivateConstants.OLDEST_TIMESTAMP)) { return false; } return true; }
3.26
hbase_StoreScanner_needToReturn_rdh
/** * If the top cell won't be flushed into disk, the new top cell may be changed after * #reopenAfterFlush. Because the older top cell only exist in the memstore scanner but the * memstore scanner is replaced by hfile scanner after #reopenAfterFlush. If the row of top cell * is changed, we should return the current cells. Otherwise, we may return the cells across * different rows. * * @param outResult * the cells which are visible for user scan * @return null is the top cell doesn't change. Otherwise, the NextState to return */ private NextState needToReturn(List<Cell> outResult) { if ((!outResult.isEmpty()) && topChanged) { return heap.peek() == null ? NextState.NO_MORE_VALUES : NextState.MORE_VALUES; } return null; }
3.26
hbase_StoreScanner_checkScanOrder_rdh
/** * Check whether scan as expected order */ protected void checkScanOrder(Cell prevKV, Cell kv, CellComparator comparator) throws IOException { // Check that the heap gives us KVs in an increasing order. assert ((prevKV == null) || (comparator == null)) || (comparator.compare(prevKV, kv) <= 0) : (((("Key " + prevKV) + " followed by a smaller key ") + kv) + " in cf ") + store; }
3.26
hbase_StoreScanner_trySkipToNextRow_rdh
/** * See if we should actually SEEK or rather just SKIP to the next Cell (see HBASE-13109). * ScanQueryMatcher may issue SEEK hints, such as seek to next column, next row, or seek to an * arbitrary seek key. This method decides whether a seek is the most efficient _actual_ way to * get us to the requested cell (SEEKs are more expensive than SKIP, SKIP, SKIP inside the * current, loaded block). It does this by looking at the next indexed key of the current HFile. * This key is then compared with the _SEEK_ key, where a SEEK key is an artificial 'last possible * key on the row' (only in here, we avoid actually creating a SEEK key; in the compare we work * with the current Cell but compare as though it were a seek key; see down in * matcher.compareKeyForNextRow, etc). If the compare gets us onto the next block we *_SEEK, * otherwise we just SKIP to the next requested cell. * <p> * Other notes: * <ul> * <li>Rows can straddle block boundaries</li> * <li>Versions of columns can straddle block boundaries (i.e. column C1 at T1 might be in a * different block than column C1 at T2)</li> * <li>We want to SKIP if the chance is high that we'll find the desired Cell after a few * SKIPs...</li> * <li>We want to SEEK when the chance is high that we'll be able to seek past many Cells, * especially if we know we need to go to the next block.</li> * </ul> * <p> * A good proxy (best effort) to determine whether SKIP is better than SEEK is whether we'll * likely end up seeking to the next block (or past the next block) to get our next column. * Example: * * <pre> * | BLOCK 1 | BLOCK 2 | * | r1/c1, r1/c2, r1/c3 | r1/c4, r1/c5, r2/c1 | * ^ ^ * | | * Next Index Key SEEK_NEXT_ROW (before r2/c1) * * * | BLOCK 1 | BLOCK 2 | * | r1/c1/t5, r1/c1/t4, r1/c1/t3 | r1/c1/t2, r1/c1/T1, r1/c2/T3 | * ^ ^ * | | * Next Index Key SEEK_NEXT_COL * </pre> * * Now imagine we want columns c1 and c3 (see first diagram above), the 'Next Index Key' of r1/c4 * is > r1/c3 so we should seek to get to the c1 on the next row, r2. In second case, say we only * want one version of c1, after we have it, a SEEK_COL will be issued to get to c2. Looking at * the 'Next Index Key', it would land us in the next block, so we should SEEK. In other scenarios * where the SEEK will not land us in the next block, it is very likely better to issues a series * of SKIPs. * * @param cell * current cell * @return true means skip to next row, false means not */ protected boolean trySkipToNextRow(Cell cell) throws IOException { Cell nextCell = null; // used to guard against a changed next indexed key by doing a identity comparison // when the identity changes we need to compare the bytes again Cell previousIndexedKey = null; do { Cell nextIndexedKey = getNextIndexedKey(); if (((nextIndexedKey != null) && (nextIndexedKey != KeyValueScanner.NO_NEXT_INDEXED_KEY)) && ((nextIndexedKey == previousIndexedKey) || (matcher.compareKeyForNextRow(nextIndexedKey, cell) >= 0))) { this.heap.next(); ++kvsScanned; previousIndexedKey = nextIndexedKey; } else { return false; } } while (((nextCell = this.heap.peek()) != null) && CellUtil.matchingRows(cell, nextCell) ); return true; }
3.26
hbase_ModifyNamespaceProcedure_prepareModify_rdh
/** * Action before any real action of adding namespace. */ private boolean prepareModify(final MasterProcedureEnv env) throws IOException { if (!getTableNamespaceManager(env).doesNamespaceExist(newNsDescriptor.getName())) { setFailure("master-modify-namespace", new NamespaceNotFoundException(newNsDescriptor.getName())); return false; } getTableNamespaceManager(env).validateTableAndRegionCount(newNsDescriptor); // This is used for rollback oldNsDescriptor = getTableNamespaceManager(env).get(newNsDescriptor.getName()); if (!Objects.equals(oldNsDescriptor.getConfigurationValue(RSGroupInfo.NAMESPACE_DESC_PROP_GROUP), newNsDescriptor.getConfigurationValue(RSGroupInfo.NAMESPACE_DESC_PROP_GROUP))) {checkNamespaceRSGroup(env, newNsDescriptor); } return true; }
3.26
hbase_BinaryComparator_toByteArray_rdh
/** * Returns The comparator serialized using pb */ @Override public byte[] toByteArray() { ComparatorProtos.BinaryComparator.Builder v0 = ComparatorProtos.BinaryComparator.newBuilder(); v0.setComparable(ProtobufUtil.toByteArrayComparable(this.value)); return v0.build().toByteArray(); } /** * Parse a serialized representation of {@link BinaryComparator} * * @param pbBytes * A pb serialized {@link BinaryComparator} instance * @return An instance of {@link BinaryComparator}
3.26
hbase_BinaryComparator_areSerializedFieldsEqual_rdh
/** * Returns true if and only if the fields of the comparator that are serialized are equal to the * corresponding fields in other. Used for testing. */ @Override boolean areSerializedFieldsEqual(ByteArrayComparable other) { if (other == this) { return true; }if (!(other instanceof BinaryComparator)) { return false; } return super.areSerializedFieldsEqual(other); }
3.26
hbase_ServerRpcController_setFailedOn_rdh
/** * Sets an exception to be communicated back to the * {@link org.apache.hbase.thirdparty.com.google.protobuf.Service} client. * * @param ioe * the exception encountered during execution of the service method */ public void setFailedOn(IOException ioe) { serviceException = ioe; setFailed(StringUtils.stringifyException(ioe)); }
3.26
hbase_ServerRpcController_failedOnException_rdh
/** * Returns whether or not a server exception was generated in the prior RPC invocation. */ public boolean failedOnException() { return serviceException != null; }
3.26
hbase_ServerRpcController_checkFailed_rdh
/** * Throws an IOException back out if one is currently stored. */ public void checkFailed() throws IOException { if (failedOnException()) { throw getFailedOn(); } }
3.26
hbase_ServerRpcController_getFailedOn_rdh
/** * Returns any exception thrown during service method invocation, or {@code null} if no exception * was thrown. This can be used by clients to receive exceptions generated by RPC calls, even when * {@link RpcCallback}s are used and no * {@link org.apache.hbase.thirdparty.com.google.protobuf.ServiceException} is declared. */ public IOException getFailedOn() { return serviceException; }
3.26
hbase_AsyncAdminBuilder_setMaxRetries_rdh
/** * Set the max retry times for an admin operation. Usually it is the max attempt times minus 1. * Operation timeout and max attempt times(or max retry times) are both limitations for retrying, * we will stop retrying when we reach any of the limitations. * * @return this for invocation chaining */ default AsyncAdminBuilder setMaxRetries(int maxRetries) { return setMaxAttempts(retries2Attempts(maxRetries)); }
3.26
hbase_ZKSplitLogManagerCoordination_setIgnoreDeleteForTesting_rdh
/** * Temporary function that is used by unit tests only */ public void setIgnoreDeleteForTesting(boolean b) { ignoreZKDeleteForTesting = b; }
3.26
hbase_ZKSplitLogManagerCoordination_handleUnassignedTask_rdh
/** * It is possible for a task to stay in UNASSIGNED state indefinitely - say SplitLogManager wants * to resubmit a task. It forces the task to UNASSIGNED state but it dies before it could create * the RESCAN task node to signal the SplitLogWorkers to pick up the task. To prevent this * scenario the SplitLogManager resubmits all orphan and UNASSIGNED tasks at startup. */ private void handleUnassignedTask(String path) { if (ZKSplitLog.isRescanNode(watcher, path)) { return; } Task task = findOrCreateOrphanTask(path); if (task.isOrphan() && (task.incarnation.get() == 0)) { LOG.info("Resubmitting unassigned orphan task " + path); // ignore failure to resubmit. The timeout-monitor will handle it later // albeit in a more crude fashion resubmitTask(path, task, FORCE); } }
3.26
hbase_ZKSplitLogManagerCoordination_rescan_rdh
/** * signal the workers that a task was resubmitted by creating the RESCAN node. */ private void rescan(long retries) { // The RESCAN node will be deleted almost immediately by the // SplitLogManager as soon as it is created because it is being // created in the DONE state. This behavior prevents a buildup // of RESCAN nodes. But there is also a chance that a SplitLogWorker // might miss the watch-trigger that creation of RESCAN node provides. // Since the TimeoutMonitor will keep resubmitting UNASSIGNED tasks // therefore this behavior is safe. SplitLogTask slt = new SplitLogTask.Done(this.details.getServerName()); this.watcher.getRecoverableZooKeeper().getZooKeeper().create(ZKSplitLog.getRescanNode(watcher), slt.toByteArray(), Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL_SEQUENTIAL, new CreateRescanAsyncCallback(), Long.valueOf(retries)); }
3.26
hbase_AsyncAdmin_modifyTable_rdh
/** * Modify an existing table, more IRB friendly version. * * @param desc * modified description of the table */ default CompletableFuture<Void> modifyTable(TableDescriptor desc) { return modifyTable(desc, true); }
3.26
hbase_AsyncAdmin_splitSwitch_rdh
/** * Turn the Split switch on or off. * * @param enabled * enabled or not * @return Previous switch value wrapped by a {@link CompletableFuture} */ default CompletableFuture<Boolean> splitSwitch(boolean enabled) { return splitSwitch(enabled, false); }
3.26
hbase_AsyncAdmin_restoreSnapshot_rdh
/** * Restore the specified snapshot on the original table. (The table must be disabled) If * 'takeFailSafeSnapshot' is set to true, a snapshot of the current table is taken before * executing the restore operation. In case of restore failure, the failsafe snapshot will be * restored. If the restore completes without problem the failsafe snapshot is deleted. The * failsafe snapshot name is configurable by using the property * "hbase.snapshot.restore.failsafe.name". * * @param snapshotName * name of the snapshot to restore * @param takeFailSafeSnapshot * true if the failsafe snapshot should be taken */ default CompletableFuture<Void> restoreSnapshot(String snapshotName, boolean takeFailSafeSnapshot) { return restoreSnapshot(snapshotName, takeFailSafeSnapshot, false); }
3.26
hbase_AsyncAdmin_balancerSwitch_rdh
/** * Turn the load balancer on or off. * * @param on * Set to <code>true</code> to enable, <code>false</code> to disable. * @return Previous balancer value wrapped by a {@link CompletableFuture}. */ default CompletableFuture<Boolean> balancerSwitch(boolean on) { return balancerSwitch(on, false); }
3.26
hbase_AsyncAdmin_compact_rdh
/** * Compact a table. When the returned CompletableFuture is done, it only means the compact request * was sent to HBase and may need some time to finish the compact operation. Throws * {@link org.apache.hadoop.hbase.TableNotFoundException} if table not found. * * @param tableName * table to compact */ default CompletableFuture<Void> compact(TableName tableName) { return m2(tableName, CompactType.NORMAL); }
3.26
hbase_AsyncAdmin_getMasterCoprocessorNames_rdh
/** * Returns a list of master coprocessors wrapped by {@link CompletableFuture} */ default CompletableFuture<List<String>> getMasterCoprocessorNames() { return getClusterMetrics(EnumSet.of(Option.MASTER_COPROCESSORS)).thenApply(ClusterMetrics::getMasterCoprocessorNames); }
3.26
hbase_AsyncAdmin_cloneSnapshot_rdh
/** * Create a new table by cloning the snapshot content. * * @param snapshotName * name of the snapshot to be cloned * @param tableName * name of the table where the snapshot will be restored * @param restoreAcl * <code>true</code> to restore acl of snapshot */ default CompletableFuture<Void> cloneSnapshot(String snapshotName, TableName tableName, boolean restoreAcl) { return cloneSnapshot(snapshotName, tableName, restoreAcl, null); }
3.26
hbase_AsyncAdmin_m2_rdh
/** * Compact a column family within a table. When the returned CompletableFuture is done, it only * means the compact request was sent to HBase and may need some time to finish the compact * operation. Throws {@link org.apache.hadoop.hbase.TableNotFoundException} if table not found. * * @param tableName * table to compact * @param columnFamily * column family within a table. If not present, compact the table's all * column families. */ default CompletableFuture<Void> m2(TableName tableName, byte[] columnFamily) { return compact(tableName, columnFamily, CompactType.NORMAL); }
3.26
hbase_AsyncAdmin_snapshot_rdh
/** * Create typed snapshot of the table. Snapshots are considered unique based on <b>the name of the * snapshot</b>. Snapshots are taken sequentially even when requested concurrently, across all * tables. Attempts to take a snapshot with the same name (even a different type or with different * parameters) will fail with a {@link org.apache.hadoop.hbase.snapshot.SnapshotCreationException} * indicating the duplicate naming. Snapshot names follow the same naming constraints as tables in * HBase. See {@link org.apache.hadoop.hbase.TableName#isLegalFullyQualifiedTableName(byte[])}. * * @param snapshotName * name to give the snapshot on the filesystem. Must be unique from all other * snapshots stored on the cluster * @param tableName * name of the table to snapshot * @param type * type of snapshot to take */ default CompletableFuture<Void> snapshot(String snapshotName, TableName tableName, SnapshotType type) { return snapshot(new SnapshotDescription(snapshotName, tableName, type)); }
3.26
hbase_AsyncAdmin_getCompactionState_rdh
/** * Get the current compaction state of a table. It could be in a major compaction, a minor * compaction, both, or none. * * @param tableName * table to examine * @return the current compaction state wrapped by a {@link CompletableFuture} */ default CompletableFuture<CompactionState> getCompactionState(TableName tableName) { return getCompactionState(tableName, CompactType.NORMAL); }
3.26
hbase_AsyncAdmin_getRegionServers_rdh
/** * Returns current live region servers list wrapped by {@link CompletableFuture} */ default CompletableFuture<Collection<ServerName>> getRegionServers() { return getClusterMetrics(EnumSet.of(Option.SERVERS_NAME)).thenApply(ClusterMetrics::getServersName); }
3.26
hbase_AsyncAdmin_unassign_rdh
/** * Unassign a region from current hosting regionserver. Region will then be assigned to a * regionserver chosen at random. Region could be reassigned back to the same server. Use * {@link #move(byte[], ServerName)} if you want to control the region movement. * * @param regionName * Encoded or full name of region to unassign. Will clear any existing * RegionPlan if one found. * @param forcible * If true, force unassign (Will remove region from regions-in-transition too if * present. If results in double assignment use hbck -fix to resolve. To be used * by experts). * @deprecated since 2.4.0 and will be removed in 4.0.0. Use {@link #unassign(byte[])} instead. * @see <a href="https://issues.apache.org/jira/browse/HBASE-24875">HBASE-24875</a> */ @Deprecated default CompletableFuture<Void> unassign(byte[] regionName, boolean forcible) { return unassign(regionName); }
3.26
hbase_AsyncAdmin_hasUserPermissions_rdh
/** * Check if call user has specific permissions * * @param permissions * the specific permission list * @return True if user has the specific permissions */ default CompletableFuture<List<Boolean>> hasUserPermissions(List<Permission> permissions) { return hasUserPermissions(null, permissions); }
3.26
hbase_AsyncAdmin_m3_rdh
/** * Major compact a column family within a table. When the returned CompletableFuture is done, it * only means the compact request was sent to HBase and may need some time to finish the compact * operation. Throws {@link org.apache.hadoop.hbase.TableNotFoundException} if table not found for * normal compaction. type. * * @param tableName * table to major compact * @param columnFamily * column family within a table. If not present, major compact the table's all * column families. */ default CompletableFuture<Void> m3(TableName tableName, byte[] columnFamily) { return majorCompact(tableName, columnFamily, CompactType.NORMAL); }
3.26
hbase_AsyncAdmin_getReplicationPeerSyncReplicationState_rdh
/** * Get the current cluster state in a synchronous replication peer. * * @param peerId * a short name that identifies the peer * @return the current cluster state wrapped by a {@link CompletableFuture}. */ default CompletableFuture<SyncReplicationState> getReplicationPeerSyncReplicationState(String peerId) { CompletableFuture<SyncReplicationState> future = new CompletableFuture<>(); addListener(listReplicationPeers(Pattern.compile(peerId)), (peers, error) -> { if (error != null) { future.completeExceptionally(error); } else if (peers.isEmpty() || (!peers.get(0).getPeerId().equals(peerId))) { future.completeExceptionally(new IOException(("Replication peer " + peerId) + " does not exist")); } else { future.complete(peers.get(0).getSyncReplicationState()); } }); return future; }
3.26
hbase_AsyncAdmin_getMaster_rdh
/** * Returns current master server name wrapped by {@link CompletableFuture} */ default CompletableFuture<ServerName> getMaster() { return getClusterMetrics(EnumSet.of(Option.MASTER)).thenApply(ClusterMetrics::getMasterName); }
3.26
hbase_AsyncAdmin_listTableNames_rdh
/** * List all of the names of userspace tables. * * @return a list of table names wrapped by a {@link CompletableFuture}. * @see #listTableNames(Pattern, boolean) */ default CompletableFuture<List<TableName>> listTableNames() { return listTableNames(false); }
3.26
hbase_AsyncAdmin_getBackupMasters_rdh
/** * Returns current backup master list wrapped by {@link CompletableFuture} */ default CompletableFuture<Collection<ServerName>> getBackupMasters() { return getClusterMetrics(EnumSet.of(Option.BACKUP_MASTERS)).thenApply(ClusterMetrics::getBackupMasterNames); }
3.26
hbase_AsyncAdmin_m5_rdh
/** * Add a new replication peer for replicating data to slave cluster * * @param peerId * a short name that identifies the peer * @param peerConfig * configuration for the replication slave cluster */default CompletableFuture<Void> m5(String peerId, ReplicationPeerConfig peerConfig) { return addReplicationPeer(peerId, peerConfig, true); }
3.26
hbase_AsyncAdmin_getMasterInfoPort_rdh
/** * Get the info port of the current master if one is available. * * @return master info port */ default CompletableFuture<Integer> getMasterInfoPort() { return getClusterMetrics(EnumSet.of(Option.MASTER_INFO_PORT)).thenApply(ClusterMetrics::getMasterInfoPort); }
3.26
hbase_AsyncAdmin_listDeadServers_rdh
/** * List all the dead region servers. */default CompletableFuture<List<ServerName>> listDeadServers() { return this.getClusterMetrics(EnumSet.of(Option.DEAD_SERVERS)).thenApply(ClusterMetrics::getDeadServerNames); }
3.26
hbase_AsyncAdmin_balanceRSGroup_rdh
/** * Balance regions in the given RegionServer group * * @param groupName * the group name * @return BalanceResponse details about the balancer run */default CompletableFuture<BalanceResponse> balanceRSGroup(String groupName) { return balanceRSGroup(groupName, BalanceRequest.defaultInstance()); }
3.26
hbase_AsyncAdmin_replicationPeerModificationSwitch_rdh
/** * Enable or disable replication peer modification. * <p/> * This is especially useful when you want to change the replication peer storage. * * @param on * {@code true} means enable, otherwise disable * @return the previous enable/disable state wrapped by a {@link CompletableFuture} */ default CompletableFuture<Boolean> replicationPeerModificationSwitch(boolean on) {return replicationPeerModificationSwitch(on, false); }
3.26
hbase_AsyncAdmin_majorCompact_rdh
/** * Major compact a table. When the returned CompletableFuture is done, it only means the compact * request was sent to HBase and may need some time to finish the compact operation. Throws * {@link org.apache.hadoop.hbase.TableNotFoundException} if table not found. * * @param tableName * table to major compact */ default CompletableFuture<Void> majorCompact(TableName tableName) { return m3(tableName, CompactType.NORMAL); }
3.26
hbase_AsyncAdmin_listUnknownServers_rdh
/** * List all the unknown region servers. */ default CompletableFuture<List<ServerName>> listUnknownServers() { return this.getClusterMetrics(EnumSet.of(Option.UNKNOWN_SERVERS)).thenApply(ClusterMetrics::getUnknownServerNames); }
3.26