name stringlengths 12 178 | code_snippet stringlengths 8 36.5k | score float64 3.26 3.68 |
|---|---|---|
hbase_ParseFilter_reduce_rdh | /**
* This function is called while parsing the filterString and an operator is parsed
* <p>
*
* @param operatorStack
* the stack containing the operators and parenthesis
* @param filterStack
* the stack containing the filters
* @param operator
* the operator foun... | 3.26 |
hbase_ParseFilter_parseComparator_rdh | /**
* Splits a column in comparatorType:comparatorValue form into separate byte arrays
* <p>
*
* @param comparator
* the comparator
* @return the parsed arguments of the comparator as a 2D byte array
*/
public static byte[][] parseComparator(byte[] comparator) {
final int index = Bytes.searchDelimiterIndex(c... | 3.26 |
hbase_ParseFilter_checkForWhile_rdh | /**
* Checks if the current index of filter string we are on is the beginning of the keyword 'WHILE'
* <p>
*
* @param filterStringAsByteArray
* filter string given by the user
* @param indexOfWhile
* index at which an 'W' was read
* @return true if the keyword 'WHILE' is at the current index
*/
public stat... | 3.26 |
hbase_ParseFilter_convertByteArrayToInt_rdh | /**
* Converts an int expressed in a byte array to an actual int
* <p>
* This doesn't use Bytes.toInt because that assumes that there will be {@link Bytes#SIZEOF_INT}
* bytes available.
* <p>
*
* @param numberAsByteArray
* the int value expressed as a byte array
* @return the int value
*/
public static int... | 3.26 |
hbase_ParseFilter_createUnescapdArgument_rdh | /**
* Removes the single quote escaping a single quote - thus it returns an unescaped argument
* <p>
*
* @param filterStringAsByteArray
* filter string given by user
* @param argumentStartIndex
* start index of the argument
* @param argumentEndIndex
* end index of the argument
* @return returns an unesc... | 3.26 |
hbase_ParseFilter_m0_rdh | /**
* Converts a boolean expressed in a byte array to an actual boolean
* <p>
* This doesn't used Bytes.toBoolean because Bytes.toBoolean(byte []) assumes that 1 stands for
* true and 0 for false. Here, the byte array representing "true" and "false" is parsed
* <p>
*
* @param booleanAsByteArray
* the boolean ... | 3.26 |
hbase_ParseFilter_isQuoteUnescaped_rdh | /**
* Returns a boolean indicating whether the quote was escaped or not
* <p>
*
* @param array
* byte array in which the quote was found
* @param quoteIndex
* index of the single quote
* @return returns true if the quote was unescaped
*/
public static boolean isQuoteUnescaped(byte[] array, int quoteIndex) ... | 3.26 |
hbase_ParseFilter_getSupportedFilters_rdh | /**
* Return a Set of filters supported by the Filter Language
*/
public Set<String> getSupportedFilters() {
return filterHashMap.keySet();
} | 3.26 |
hbase_ParseFilter_convertByteArrayToLong_rdh | /**
* Converts a long expressed in a byte array to an actual long
* <p>
* This doesn't use Bytes.toLong because that assumes that there will be {@link Bytes#SIZEOF_INT}
* bytes available.
* <p>
*
* @param numberAsByteArray
* the long valu... | 3.26 |
hbase_ParseFilter_checkForOr_rdh | /**
* Checks if the current index of filter string we are on is the beginning of the keyword 'OR'
* <p>
*
* @param filterStringAsByteArray
* filter string given by the user
* @param indexOfOr
* index at which an 'O' was read
* @return true if the keyword 'OR' is at the current index
*/
public static boolea... | 3.26 |
hbase_ParseFilter_hasHigherPriority_rdh | /**
* Returns which operator has higher precedence
* <p>
* If a has higher precedence than b, it returns true If they have the same precedence, it returns
* false
*/
public boolean hasHigherPriority(ByteBuffer a, ByteBuffer b) {
if ((operatorPrecedenceHashMap.get(a) - operatorPrecedenceHashMap.get(b)) < 0) {
... | 3.26 |
hbase_ParseFilter_extractFilterSimpleExpression_rdh | /**
* Extracts a simple filter expression from the filter string given by the user
* <p>
* A simpleFilterExpression is of the form: FilterName('arg', 'arg', 'arg') The user given filter
* string can have many simpleFilterExpressions combined using operators.
* <p>
* This function extracts a simpleFilterExpression... | 3.26 |
hbase_ParseFilter_popArguments_rdh | /**
* Pops an argument from the operator stack and the number of arguments required by the operator
* from the filterStack and evaluates them
* <p>
*
* @param operatorStack
* the stack containing the operators
* @param filterStack
* the stack containing the filters
*... | 3.26 |
hbase_ParseFilter_getFilterArguments_rdh | /**
* Returns the arguments of the filter from the filter string
* <p>
*
* @param filterStringAsByteArray
* filter string given by the user
* @return an ArrayList containing the arguments of the filter in the filter string
*/
public static ArrayList<byte[]> getFilterArguments(byte[] filterStringAsByteArray) {
... | 3.26 |
hbase_ParseFilter_getAllFilters_rdh | /**
* Returns all known filters
*
* @return an unmodifiable map of filters
*/
public static Map<String, String> getAllFilters() {return Collections.unmodifiableMap(filterHashMap);
} | 3.26 |
hbase_ParseFilter_parseFilterString_rdh | /**
* Parses the filterString and constructs a filter using it
* <p>
*
* @param filterStringAsByteArray
* filter string given by the user
* @return filter object we constructed
*/
public Filter parseFilterString(byte[] filterStringAsByteArray) throws CharacterCodingException {
// stack for the operators ... | 3.26 |
hbase_ParseFilter_checkForAnd_rdh | /**
* Checks if the current index of filter string we are on is the beginning of the keyword 'AND'
* <p>
*
* @param filterStringAsByteArray
* filter string given by the user
* @param indexOfAnd
* index at which an 'A' was read
* @return true if the keyword 'AND' is at the current index
*/
public static boo... | 3.26 |
hbase_ParseFilter_getFilterName_rdh | /**
* Returns the filter name given a simple filter expression
* <p>
*
* @param filterStringAsByteArray
* a simple filter expression
* @return name of filter in the simple filter expression
*/
public static byte[] getFilterName(byte[] filterStringAsByteArray) {
int filterNameStartIndex = 0;
int filterN... | 3.26 |
hbase_ParseFilter_checkForSkip_rdh | /**
* Checks if the current index of filter string we are on is the beginning of the keyword 'SKIP'
* <p>
*
* @param filterStringAsByteArray
* filter string given by the user
* @param indexOfSkip
* index at which an 'S' was read
* @return true if the keyword 'SKIP' is at the current index
*/
public static ... | 3.26 |
hbase_ParseFilter_parseSimpleFilterExpression_rdh | /**
* Constructs a filter object given a simple filter expression
* <p>
*
* @param filterStringAsByteArray
* filter string given by the user
* @return filter object we constructed
*/
public Filter parseSimpleFilterExpression(byte[] filterStringAsByteArray) throws CharacterCodingException {
String filterNam... | 3.26 |
hbase_ParseFilter_removeQuotesFromByteArray_rdh | /**
* Takes a quoted byte array and converts it into an unquoted byte array For example: given a byte
* array representing 'abc', it returns a byte array representing abc
* <p>
*
* @param quotedByteArray
* the quoted byte array
* @return Unquoted byte array
*/
public static byte[] removeQuotesFromByteArray(by... | 3.26 |
hbase_ParseFilter_createCompareOperator_rdh | /**
* Takes a compareOperator symbol as a byte array and returns the corresponding CompareOperator
*
* @param compareOpAsByteArray
* the comparatorOperator symbol as a byte array
* @return the Compare Operator
*/
public static CompareOperator createCompareOperator(byte[] compareOpAsByteArray) {
ByteBuffer c... | 3.26 |
hbase_Compressor_writeCompressed_rdh | /**
* Compresses and writes an array to a DataOutput
*
* @param data
* the array to write.
* @param out
* the DataOutput to write into
* @param dict
* the dictionary to use for compression
*/
@Deprecated
static void writeCompressed(byte[] data, int offset, int length, DataOutput out, Dictionary dict) t... | 3.26 |
hbase_Compressor_main_rdh | /**
* Command line tool to compress and uncompress WALs.
*/
public static void main(String[] args) throws IOException {
if (((args.length != 2) || args[0].equals("--help")) || args[0].equals("-h")) {
m0();
System.exit(-1);
}
Path inputPath = new Path(args[0]);
Path outputPath = new Pat... | 3.26 |
hbase_Compressor_uncompressIntoArray_rdh | /**
* Reads a compressed entry into an array. The output into the array ends up length-prefixed.
*
* @param to
* the array to write into
* @param offset
* array offset to start writing to
* @param in
* the DataInput to read from
* @param dict
* the dictionar... | 3.26 |
hbase_Compressor_readCompressed_rdh | /**
* Reads the next compressed entry and returns it as a byte array
*
* @param in
* the DataInput to read from
* @param dict
* the dictionary we use for our read.
* @return the uncompressed array.
*/
@Deprecated
static byte[] readCompressed(DataInput
in, Dictionary dict) throws IOException {
byte statu... | 3.26 |
hbase_MetricsMaster_setNumSpaceQuotas_rdh | /**
* Sets the number of space quotas defined.
*
* @see MetricsMasterQuotaSource#updateNumSpaceQuotas(long)
*/
public void setNumSpaceQuotas(final long numSpaceQuotas) {
masterQuotaSource.updateNumSpaceQuotas(numSpaceQuotas);
} | 3.26 |
hbase_MetricsMaster_incrementSnapshotObserverTime_rdh | /**
* Sets the execution time of a period of the {@code SnapshotQuotaObserverChore}.
*/
public void incrementSnapshotObserverTime(final long executionTime) {masterQuotaSource.incrementSnapshotObserverChoreTime(executionTime);
} | 3.26 |
hbase_MetricsMaster_incrementReadRequests_rdh | /**
*
* @param inc
* How much to add to read requests.
*/
public void incrementReadRequests(final long inc) {
masterSource.incReadRequests(inc);
} | 3.26 |
hbase_MetricsMaster_incrementRequests_rdh | /**
*
* @param inc
* How much to add to requests.
*/
public void incrementRequests(final long inc) {
masterSource.incRequests(inc);} | 3.26 |
hbase_MetricsMaster_getServerCrashProcMetrics_rdh | /**
* Returns Set of metrics for assign procedure
*/
public ProcedureMetrics getServerCrashProcMetrics() {
return serverCrashProcMetrics;
} | 3.26 |
hbase_MetricsMaster_incrementSnapshotFetchTime_rdh | /**
* Sets the execution time to fetch the mapping of snapshots to originating table.
*/
public void
incrementSnapshotFetchTime(long executionTime) {
masterQuotaSource.incrementSnapshotObserverSnapshotFetchTime(executionTime);
} | 3.26 |
hbase_MetricsMaster_convertToProcedureMetrics_rdh | /**
* This is utility function that converts {@link OperationMetrics} to {@link ProcedureMetrics}.
* NOTE: Procedure framework in hbase-procedure module accesses metrics common to most procedures
* through {@link ProcedureMetrics} interface. Metrics source classes in hbase-hadoop-compat
* module provides similar in... | 3.26 |
hbase_MetricsMaster_setNumRegionSizeReports_rdh | /**
* Sets the number of region size reports the master currently has in memory.
*
* @see MetricsMasterQuotaSource#updateNumCurrentSpaceQuotaRegionSizeReports(long)
*/
public void setNumRegionSizeReports(final long numRegionReports) {
masterQuotaSource.updateNumCurrentSpaceQuotaRegionSizeReports(numRegionReport... | 3.26 |
hbase_MetricsMaster_incrementQuotaObserverTime_rdh | /**
* Sets the execution time of a period of the QuotaObserverChore.
*
* @param executionTime
* The execution time in milliseconds.
* @see MetricsMasterQuotaSource#incrementSpaceQuotaObserverChoreTime(long)
*/
public void incrementQuotaObserverTime(final long executionTime) {masterQuotaSource.incrementSpaceQuot... | 3.26 |
hbase_MetricsMaster_m0_rdh | /**
*
* @param inc
* How much to add to write requests.
*/
public void m0(final long inc) {
masterSource.incWriteRequests(inc);
} | 3.26 |
hbase_MetricsMaster_setNumTableInSpaceQuotaViolation_rdh | /**
* Sets the number of table in violation of a space quota.
*
* @see MetricsMasterQuotaSource#updateNumTablesInSpaceQuotaViolation(long)
*/
public void
setNumTableInSpaceQuotaViolation(final long numTablesInViolation) {
masterQuotaSource.updateNumTablesInSpaceQuotaViolation(numTablesInViolation);
} | 3.26 |
hbase_MetricsMaster_incrementSnapshotSizeComputationTime_rdh | /**
* Sets the execution time to compute the size of a single snapshot.
*/
public void incrementSnapshotSizeComputationTime(final long executionTime) {
masterQuotaSource.incrementSnapshotObserverSnapshotComputationTime(executionTime);
} | 3.26 |
hbase_MetricsMaster_setNumNamespacesInSpaceQuotaViolation_rdh | /**
* Sets the number of namespaces in violation of a space quota.
*
* @see MetricsMasterQuotaSource#updateNumNamespacesInSpaceQuotaViolation(long)
*/
public void setNumNamespacesInSpaceQuotaViolation(final long numNamespacesInViolation) {
masterQuotaSource.updateNumNamespacesInSpaceQuotaViolation(numNamespaces... | 3.26 |
hbase_MetricsMaster_getMetricsSource_rdh | // for unit-test usage
public MetricsMasterSource getMetricsSource() {
return masterSource;
} | 3.26 |
hbase_AbstractViolationPolicyEnforcement_getFileSize_rdh | /**
* Computes the size of a single file on the filesystem. If the size cannot be computed for some
* reason, a {@link SpaceLimitingException} is thrown, as the file may violate a quota. If the
* provided path does not reference a file, an {@link IllegalArgumentException} is thrown.
*
* @param fs
* The FileSyst... | 3.26 |
hbase_AccessControlFilter_toByteArray_rdh | /**
* Returns The filter serialized using pb
*/
@Override
public byte[] toByteArray() {
// no implementation, server-side use only
throw new UnsupportedOperationException("Serialization not supported. Intended for server-side use only.");
} | 3.26 |
hbase_AccessControlFilter_parseFrom_rdh | /**
*
* @param pbBytes
* A pb serialized {@link AccessControlFilter} instance
* @return An instance of {@link AccessControlFilter} made from <code>bytes</code>
* @throws org.apache.hadoop.hbase.exceptions.DeserializationException
* @see #toByteArray()
*/
public static AccessControlFilter parseFrom(final byte[]... | 3.26 |
hbase_SnapshotManager_snapshotEnabledTable_rdh | /**
* Take a snapshot of an enabled table.
*
* @param snapshot
* description of the snapshot to take.
* @throws IOException
* if the snapshot could not be started or filesystem for snapshot temporary
* directory could not be determined
*/
private synchronized void snapshotEnabledTable(SnapshotDescription... | 3.26 |
hbase_SnapshotManager_deleteSnapshot_rdh | /**
* Delete the specified snapshot
*
* @throws SnapshotDoesNotExistException
* If the specified snapshot does not exist.
* @throws IOException
* For filesystem IOExceptions
*/
public void deleteSnapshot(SnapshotDescription snapshot) throws IOException {
// check to see if it is completed
if (!isSnap... | 3.26 |
hbase_SnapshotManager_restoreSnapshot_rdh | /**
* Restore the specified snapshot. The restore will fail if the destination table has a snapshot
* or restore in progress.
*
* @param snapshot
* Snapshot Descriptor
* @param tableDescriptor
* Table Descriptor
* @param nonceKey
* unique identifier to prevent duplicated RPC
* @param restoreAcl
* tru... | 3.26 |
hbase_SnapshotManager_sanityCheckBeforeSnapshot_rdh | /**
* Check if the snapshot can be taken. Currently we have some limitations, for zk-coordinated
* snapshot, we don't allow snapshot with same name or taking multiple snapshots of a table at the
* same time, for procedure-coordinated snapshot, we don't allow snapshot with same name.
*
* @param snapshot
* descri... | 3.26 |
hbase_SnapshotManager_checkSnapshotSupport_rdh | /**
* Called at startup, to verify if snapshot operation is supported, and to avoid starting the
* master if there're snapshots present but the cleaners needed are missing. Otherwise we can end
* up with snapshot data loss.
*
* @param conf
* The {@link Configuration} object to use
* @param mfs
* The MasterF... | 3.26 |
hbase_SnapshotManager_cleanupCompletedRestoreInMap_rdh | /**
* Remove the procedures that are marked as finished
*/
private synchronized void cleanupCompletedRestoreInMap() {
ProcedureExecutor<MasterProcedureEnv> procExec =
master.getMasterProcedureExecutor();
Iterator<Map.Entry<TableName, Long>> it = restoreTableToProcIdMap.entrySet().iterator();
while (it.hasNext()) ... | 3.26 |
hbase_SnapshotManager_isSnapshotDone_rdh | /**
* Check if the specified snapshot is done
*
* @return true if snapshot is ready to be restored, false if it is still being taken.
* @throws IOException
* IOException if error from HDFS or RPC
* @t... | 3.26 |
hbase_SnapshotManager_cloneSnapshot_rdh | /**
* Clone the specified snapshot into a new table. The operation will fail if the destination table
* has a snapshot or restore in progress.
*
* @param snapshot
* Snapshot Descriptor
* @param tableDescriptor
* Table Descriptor of the table to create
* @param nonceKey
* unique identifier to prevent dupl... | 3.26 |
hbase_SnapshotManager_cleanupSentinels_rdh | /**
* Remove the sentinels that are marked as finished and the completion time has exceeded the
* removal timeout.
*
* @param sentinels
* map of sentinels to clean
*/
private synchronized void cleanupSentinels(final Map<TableName, SnapshotSentinel> sentinels) {
long currentTime = EnvironmentEdgeManager.currentT... | 3.26 |
hbase_SnapshotManager_snapshotDisabledTable_rdh | /**
* Take a snapshot of a disabled table.
*
* @param snapshot
* description of the snapshot to take. Modified to be {@link Type#DISABLED}.
* @throws IOException
* if the snapshot could not be started or filesystem for snapshot temporary
* directory could not be determined
*/
private synchronized void sna... | 3.26 |
hbase_SnapshotManager_isRestoringTable_rdh | /**
* Verify if the restore of the specified table is in progress.
*
* @param tableName
* table under restore
* @return <tt>true</tt> if there is a restore in progress of the specified table.
*/
private synchronized boolean isRestoringTable(final TableName tableName) {
Long procId = this.restoreTableToProcId... | 3.26 |
hbase_SnapshotManager_restoreOrCloneSnapshot_rdh | /**
* Restore or Clone the specified snapshot
*
* @param nonceKey
* unique identifier to prevent duplicated RPC
*/
public long restoreOrCloneSnapshot(final SnapshotDescription reqSnapshot, final NonceKey nonceKey, final boolean restoreAcl, String customSFT) throws IOException {
FileSystem fs = master.getMasterF... | 3.26 |
hbase_SnapshotManager_removeSentinelIfFinished_rdh | /**
* Return the handler if it is currently live and has the same snapshot target name. The handler
* is removed from the sentinels map if completed.
*
* @param sentinels
* live handlers
* @param snapshot
* snapshot description
* @return null if doesn't match, else a live handler.
*/
private synchronized ... | 3.26 |
hbase_SnapshotManager_prepareWorkingDirectory_rdh | /**
* Check to make sure that we are OK to run the passed snapshot. Checks to make sure that we
* aren't already running a snapshot or restore on the requested table.
*
* @param snapshot
* description of the snapshot we want to start
* @throws HBaseSnapshotException
* if the filesystem could not be prepared ... | 3.26 |
hbase_SnapshotManager_cleanupCompletedSnapshotInMap_rdh | /**
* Remove the procedures that are marked as finished
*/
private synchronized void cleanupCompletedSnapshotInMap() {
ProcedureExecutor<MasterProcedureEnv> procExec = master.getMasterProcedureExecutor();
Iterator<Map.Entry<SnapshotDescription, Long>> it = snapshotToProcIdMap.entrySet().iterator();
while (it.hasNex... | 3.26 |
hbase_SnapshotManager_isTakingSnapshot_rdh | /**
* Check to see if the specified table has a snapshot in progress. Since we introduce the
* SnapshotProcedure, it is a little bit different from before. For zk-coordinated snapshot, we
* can just consider tables in snapshotHandlers only, but for
* {@link org.apache.hadoop.hbase.master.assignment.MergeTableRegion... | 3.26 |
hbase_SnapshotManager_getCompletedSnapshots_rdh | /**
* Gets the list of all completed snapshots.
*
* @param snapshotDir
* snapshot directory
* @param withCpCall
* Whether to call CP hooks
* @return list of SnapshotDescriptions
* @throws IOException
* File system exception
*/
private List<SnapshotDescription> getCompletedSnapshots(Path snapshotDir, boo... | 3.26 |
hbase_SnapshotManager_getCoordinator_rdh | /**
* Returns distributed commit coordinator for all running snapshots
*/
ProcedureCoordinator getCoordinator() {
return coordinator;
}
/**
* Check to see if the snapshot is one of the currently completed snapshots Returns true if the
* snapshot exists in the "completed snapshots folder".
... | 3.26 |
hbase_SnapshotManager_isTakingAnySnapshot_rdh | /**
* The snapshot operation processing as following: <br>
* 1. Create a Snapshot Handler, and do some initialization; <br>
* 2. Put the handler into snapshotHandlers <br>
* So when we consider if any snapshot is taking, we should consider both the takingSnapshotLock
* and snapshotHandlers;
*
* @return true to i... | 3.26 |
hbase_SnapshotManager_setSnapshotHandlerForTesting_rdh | /**
* Set the handler for the current snapshot
* <p>
* Exposed for TESTING
*
* @param handler
* handler the master should use TODO get rid of this if possible, repackaging,
* modify tests.
*/
public synchronized void setSnapshot... | 3.26 |
hbase_SnapshotManager_snapshotTable_rdh | /**
* Take a snapshot using the specified handler. On failure the snapshot temporary working
* directory is removed. NOTE: prepareToTakeSnapshot() called before this one takes care of the
* rejecting the snapshot request if the table is busy with another snapshot/restore operation.
*
* @param snapshot
* the sna... | 3.26 |
hbase_SnapshotManager_takeSnapshot_rdh | /**
* Take a snapshot based on the enabled/disabled state of the table.
*
* @throws HBaseSnapshotException
* when a snapshot specific exception occurs.
* @throws IOException
* when some sort of generic IO exception occurs.
*/
public void takeSnapshot(SnapshotDescription snapshot) throws IOException {
thi... | 3.26 |
hbase_SnapshotManager_stop_rdh | //
// Implementing Stoppable interface
//
@Override
public void stop(String why) {
// short circuit
if (this.stopped)
return;
// make sure we get stop
this.stopped = true;
// pass the stop onto take snapshot handlers
for (SnapshotSentinel snapshotHandler : this.snapshotHandlers.values()) {
snapshotHandler... | 3.26 |
hbase_SnapshotManager_resetTempDir_rdh | /**
* Cleans up any zk-coordinated snapshots in the snapshot/.tmp directory that were left from
* failed snapshot attempts. For unfinished procedure2-coordinated snapshots, keep the working
* directory.
*
* @throws IOException
* if we can't reach the filesystem
*/
private void resetTempDir() throws IOException... | 3.26 |
hbase_StreamSlowMonitor_checkProcessTimeAndSpeed_rdh | /**
* Check if the packet process time shows that the relevant datanode is a slow node.
*
* @param datanodeInfo
* the datanode that processed the packet
* @param packetDataLen
* the data length of the packet (in bytes)
* @param processTimeMs
* the process time (in ms) of the packet on the datanode,
* @pa... | 3.26 |
hbase_HBCKServerCrashProcedure_getRegionsOnCrashedServer_rdh | /**
* If no Regions found in Master context, then we will search hbase:meta for references to the
* passed server. Operator may have passed ServerName because they have found references to
* 'Unknown Servers'. They are using HBCKSCP to clear them out.
*/
@Override
@SuppressWarnings(value = "NP_NULL_ON_SOME_PATH_EXC... | 3.26 |
hbase_HBCKServerCrashProcedure_isMatchingRegionLocation_rdh | /**
* The RegionStateNode will not have a location if a confirm of an OPEN fails. On fail, the
* RegionStateNode regionLocation is set to null. This is 'looser' than the test done in the
* superclass. The HBCKSCP has been scheduled by an operator via hbck2 probably at the behest of a
* report of an 'Unknown Server'... | 3.26 |
hbase_RegionSplitter_split2_rdh | /**
* Divide 2 numbers in half (for split algorithm)
*
* @param a
* number #1
* @param b
* number #2
* @return the midpoint of the 2 numbers
*/
public BigInteger split2(BigInteger a, BigInteger b) {
return a.add(b).divide(BigInteger.valueOf(2)).abs();
} | 3.26 |
hbase_RegionSplitter_convertToBytes_rdh | /**
* Returns an array of bytes corresponding to an array of BigIntegers
*
* @param bigIntegers
* numbers to convert
* @return bytes corresponding to the bigIntegers
*/
public byte[][] convertToBytes(BigInteger[] bigIntegers) {
byte[][] returnBytes = new byte[bigIntegers.length][];
for (int i = 0; i < ... | 3.26 |
hbase_RegionSplitter_convertToByte_rdh | /**
* Returns the bytes corresponding to the BigInteger
*
* @param bigInteger
* number to convert
* @return corresponding bytes
*/
public byte[] convertToByte(BigInteger bigInteger) {
return convertToByte(bigInteger, rowComparisonLength);
} | 3.26 |
hbase_RegionSplitter_getTableDirAndSplitFile_rdh | /**
*
* @return A Pair where first item is table dir and second is the split file.
* @throws IOException
* if a remote or network exception occurs
*/
private static Pair<Path, Path> getTableDirAndSplitFile(final Configuration conf, final TableName tableName) throws IOException {
Path hbDir = CommonFSUtils.ge... | 3.26 |
hbase_RegionSplitter_getRegionServerCount_rdh | /**
* Alternative getCurrentNrHRS which is no longer available.
*
* @return Rough count of regionservers out on cluster.
* @throws IOException
* if a remote or network exception occurs
*/
private static int getRegionServerCount(final Connection connection) throws IOException {
try (Admin admin = connection... | 3.26 |
hbase_RegionSplitter_main_rdh | /**
* The main function for the RegionSplitter application. Common uses:
* <p>
* <ul>
* <li>create a table named 'myTable' with 60 pre-split regions containing 2 column families
* 'test' & 'rs', assuming the keys are hex-encoded ASCII:
* <ul>
* <li>bin/hbase org.apache.hadoop.hbase.util.RegionSplitter -c 60 ... | 3.26 |
hbase_RegionSplitter_newSplitAlgoInstance_rdh | /**
*
* @throws IOException
* if the specified SplitAlgorithm class couldn't be instantiated
*/
public static SplitAlgorithm newSplitAlgoInstance(Configuration conf, String splitClassName) throws IOException {
Class<?> splitClass;
// For split algorithms builtin to RegionSplitter, the user can specify
... | 3.26 |
hbase_SnapshotScannerHDFSAclController_filterUsersToRemoveNsAccessAcl_rdh | /**
* Remove table user access HDFS acl from namespace directory if the user has no permissions of
* global, ns of the table or other tables of the ns, eg: Bob has 'ns1:t1' read permission, when
* delete 'ns1:t1', if Bob has global read permission, '@ns1' read permission or
* 'ns1:other_tables' read permission, the... | 3.26 |
hbase_SnapshotScannerHDFSAclController_isHdfsAclSet_rdh | /**
* Check if user global/namespace/table HDFS acls is already set
*/
private boolean isHdfsAclSet(Table aclTable, String userName, String namespace, TableName tableName) throws IOException {
boolean isSet = SnapshotScannerHDFSAclStorage.hasUserGlobalHdfsAcl(aclTable, use... | 3.26 |
hbase_AuthFilter_getConfiguration_rdh | /**
* Returns the configuration to be used by the authentication filter to initialize the
* authentication handler. This filter retrieves all HBase configurations and passes those started
* with REST_PREFIX to the authentication handler. It is useful to support plugging different
* authentication handlers.
*/
@Ove... | 3.26 |
hbase_AccessControlUtil_buildGrantRequest_rdh | /**
* Create a request to grant user global permissions.
*
* @param username
* the short user name who to grant permissions
* @param actions
* the permissions to be granted
* @return A {@link AccessControlProtos} GrantRequest
*/
public static GrantRequest buildGrantRequest(String username, boolean mergeExi... | 3.26 |
hbase_AccessControlUtil_m1_rdh | /**
* Converts a list of Permission.Action proto to an array of client Permission.Action objects.
*
* @param protoActions
* the list of protobuf Actions
* @return the converted array of Actions
*/
public static Action[] m1(List<AccessControlProtos.Permission.Action> protoActions) {
Permission[] actions = n... | 3.26 |
hbase_AccessControlUtil_revoke_rdh | /**
* A utility used to revoke a user's namespace permissions.
* <p>
* It's also called by the shell, in case you want to find references.
*
* @param controller
* RpcController
* @param protocol
* the AccessControlService protocol proxy
* @param userShortName
* the short name of the user to revoke permi... | 3.26 |
hbase_AccessControlUtil_toTablePermission_rdh | /**
* Converts a TablePermission proto to a client TablePermission object.
*
* @param proto
* the protobuf TablePermission
* @return the converted TablePermission
*/
public static TablePermission toTablePermission(AccessControlProtos.TablePermission proto) {
Permission[] actions = m1(proto.getActionList()... | 3.26 |
hbase_AccessControlUtil_toPermissionAction_rdh | /**
* Convert a client Permission.Action to a Permission.Action proto
*
* @param action
* the client Action
* @return the protobuf Action
*/
public static Action toPermissionAction(Permission.Action action) {switch
(action)
{
case READ :
return Action.READ;
case WRITE :
return Action.WRITE;case EXEC :
return... | 3.26 |
hbase_AccessControlUtil_getUserPermissions_rdh | /**
* A utility used to get permissions for selected namespace based on the specified user name.
*
* @param controller
* RpcController
* @param protocol
* the AccessControlService protocol proxy
* @param namespace
* name of the namespace
* @param userName
* User name, if empty then all user permission... | 3.26 |
hbase_AccessControlUtil_toUserPermission_rdh | /**
* Convert a protobuf UserTablePermissions to a ListMultimap<Username, UserPermission>
*
* @param proto
* the proto UsersAndPermissions
* @return a ListMultimap with user and its permissions
*/
public static ListMultimap<String, UserPermission> toUserPermission(AccessControlProtos.UsersAndPermissions p... | 3.26 |
hbase_AccessControlUtil_m0_rdh | /**
* Create a request to grant user namespace permissions.
*
* @param username
* the short user name who to grant permissions
* @param namespace
* optional table name the permissions apply
* @param actions
* the permissions to be granted
* @return A {@link AccessC... | 3.26 |
hbase_AccessControlUtil_toPermission_rdh | /**
* Convert a protobuf UserTablePermissions to a ListMultimap<Username, Permission>
*
* @param proto
* the proto UsersAndPermissions
* @return a ListMultimap with user and its permissions
*/
public static ListMultimap<String, Permission> toPermission(AccessControlProtos.UsersAndPermissions proto) {
Lis... | 3.26 |
hbase_AccessControlUtil_m2_rdh | /**
* A utility used to get permissions for selected namespace.
* <p>
* It's also called by the shell, in case you want to find references.
*
* @param controller
* RpcController
* @param protocol
* the AccessControlService protocol proxy
* @param namespace
* name of the namespace
* @deprecated Use {@li... | 3.26 |
hbase_AccessControlUtil_buildGetUserPermissionsResponse_rdh | /**
* Converts the permissions list into a protocol buffer GetUserPermissionsResponse
*/
public static GetUserPermissionsResponse buildGetUserPermissionsResponse(final List<UserPermission> permissions)
{
GetUserPermissionsResponse.Builder builder = GetUserPermissionsResponse.newBuilder();
for (UserPermission perm : p... | 3.26 |
hbase_AccessControlUtil_toUserTablePermissions_rdh | /**
* Convert a ListMultimap<String, TablePermission> where key is username to a protobuf
* UserPermission
*
* @param perm
* the list of user and table permissions
* @return the protobuf UserTablePermissions
*/
public static UsersAndPermissions toUserTablePermissions(ListMultimap<String, UserPermission> ... | 3.26 |
hbase_AccessControlUtil_buildRevokeRequest_rdh | /**
* Create a request to revoke user table permissions.
*
* @param username
* the short user name whose permissions to be revoked
* @param tableName
* optional table name the permissions apply
* @param family
* optional column family
* @param qualifier
* optional qualifier
* @param actions
* the ... | 3.26 |
hbase_AccessControlUtil_hasPermission_rdh | /**
* Validates whether specified user has permission to perform actions on the mentioned table,
* column family or column qualifier.
*
* @param controller
* RpcController
* @param protocol
* the AccessControlService protocol proxy
* @param tableName
* Table name, it shouldn't be null or empty.
* @param... | 3.26 |
hbase_AccessControlUtil_grant_rdh | /**
* A utility used to grant a user table permissions. The permissions will be for a table
* table/column family/qualifier.
* <p>
* It's also called by the shell, in case you want to find references.
*
* @param protocol
* the AccessControlService protocol proxy
* @param userShortName
* the short name of t... | 3.26 |
hbase_ProxyUserAuthenticationFilter_getDoasFromHeader_rdh | /**
* The purpose of this function is to get the doAs parameter of a http request case insensitively
*
* @return doAs parameter if exists or null otherwise
*/
public static String getDoasFromHeader(final HttpServletRequest request) {
String doas = null;
final Enumeration<String> headers = request.getHeaderNames();... | 3.26 |
hbase_HFileBlockDefaultEncodingContext_close_rdh | /**
* Releases the compressor this writer uses to compress blocks into the compressor pool.
*/
@Override
public void close() {
if (compressor != null) {
this.fileContext.getCompression().returnCompressor(compressor);
compressor = null;
}
} | 3.26 |
hbase_HFileBlockDefaultEncodingContext_prepareEncoding_rdh | /**
* prepare to start a new encoding.
*/
public void prepareEncoding(DataOutputStream out) throws IOException
{
if ((encodingAlgo != null) && (encodingAlgo != DataBlockEncoding.NONE)) {
encodingAlgo.writeIdInBytes(out);
}
} | 3.26 |
hbase_AbstractWALRoller_waitUntilWalRollFinished_rdh | /**
* Wait until all wals have been rolled after calling {@link #requestRollAll()}.
*/
public void
waitUntilWalRollFinished() throws InterruptedException {
while
(!walRollFinished()) {
Thread.sleep(100);
}
} | 3.26 |
hbase_AbstractWALRoller_checkLowReplication_rdh | /**
* we need to check low replication in period, see HBASE-18132
*/
private void checkLowReplication(long now) {
try {
for (Entry<WAL, RollController> entry : wals.entrySet()) {
WAL wal = entry.getKey();
boolean needRollAlready = entry.getValue().needsRoll(now);
... | 3.26 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.