name stringlengths 12 178 | code_snippet stringlengths 8 36.5k | score float64 3.26 3.68 |
|---|---|---|
hbase_ByteBuffAllocator_createOnHeap_rdh | /**
* Initialize an {@link ByteBuffAllocator} which only allocate ByteBuffer from on-heap, it's
* designed for testing purpose or disabled reservoir case.
*
* @return allocator to allocate on-heap ByteBuffer.
*/
private static ByteBuffAllocator createOnHeap() {
return new ByteBuffAllocator(false, 0, DEFAULT_BU... | 3.26 |
hbase_ByteBuffAllocator_allocate_rdh | /**
* Allocate size bytes from the ByteBufAllocator, Note to call the {@link ByteBuff#release()} if
* no need any more, otherwise the memory leak happen in NIO ByteBuffer pool.
*
* @param size
* to allocate
* @return an ByteBuff with the desired size.
*/
public ByteBuff allocate(int size) {
if (size < 0)... | 3.26 |
hbase_ByteBuffAllocator_allocateOneBuffer_rdh | /**
* Allocate an buffer with buffer size from ByteBuffAllocator, Note to call the
* {@link ByteBuff#release()} if no need any more, otherwise the memory leak happen in NIO
* ByteBuffer pool.
*
* @return an ByteBuff with the buffer size.
*/public SingleByteBuff allocateOneBuffer() {if (isReservoirEnabled()) {
... | 3.26 |
hbase_ByteBuffAllocator_clean_rdh | /**
* Free all direct buffers if allocated, mainly used for testing.
*/
public void clean() {
while (!buffers.isEmpty()) {
ByteBuffer v21 = buffers.poll();
if (v21.isDirect()) {
UnsafeAccess.freeDirectBuffer(v21);
}
}
this.usedBufCount.set(0);
this.maxPoolSizeInfo... | 3.26 |
hbase_CoprocessorRpcUtils_setControllerException_rdh | /**
* Stores an exception encountered during RPC invocation so it can be passed back through to the
* client.
*
* @param controller
* the controller instance provided by the client when calling the service
* @param ioe
* the exception encountered
*/
public static void setControllerException(RpcController co... | 3.26 |
hbase_CoprocessorRpcUtils_run_rdh | /**
* Called on completion of the RPC call with the response object, or {@code null} in the case of
* an error.
*
* @param parameter
* the response object or {@code null} if an error occurred
*/
@Override
public void run(R parameter) {
synchronized(this) {
result = parameter;
resultSet = tr... | 3.26 |
hbase_CoprocessorRpcUtils_get_rdh | /**
* Returns the parameter passed to {@link #run(Object)} or {@code null} if a null value was
* passed. When used asynchronously, this method will block until the {@link #run(Object)}
* method has been called.
*
* @return the response object or {@code null} if no response was passed
*/public synchronized R get()... | 3.26 |
hbase_CoprocessorRpcUtils_getServiceName_rdh | /**
* Returns the name to use for coprocessor service calls. For core HBase services (in the hbase.pb
* protobuf package), this returns the unqualified name in order to provide backward compatibility
* across the package name change. For all other services, the fully-qualified service name is
* used.
*/
public sta... | 3.26 |
hbase_MasterMaintenanceModeTracker_start_rdh | /**
* Starts the tracking of whether master is in Maintenance Mode.
*/
public void start() {watcher.registerListener(this);
update();
} | 3.26 |
hbase_IPCUtil_wrapException_rdh | /**
* Takes an Exception, the address, and if pertinent, the RegionInfo for the Region we were trying
* to connect to and returns an IOException with the input exception as the cause. The new
* exception provides the stack trace of the place where the exception is thrown and some extra
* diagnostics information.
*... | 3.26 |
hbase_IPCUtil_getTotalSizeWhenWrittenDelimited_rdh | /**
* Returns Size on the wire when the two messages are written with writeDelimitedTo
*/
public static int getTotalSizeWhenWrittenDelimited(Message... messages) {
int totalSize = 0;
for (Message m : messages) {
if (m == null) {
continue;
}
totalSize += m.getSerializedSize... | 3.26 |
hbase_IPCUtil_createRemoteException_rdh | /**
*
* @param e
* exception to be wrapped
* @return RemoteException made from passed <code>e</code>
*/
static RemoteException createRemoteException(final ExceptionResponse e) {
String innerExceptionClassName = e.getExceptionClassName();
boolean doNotRetry = e.getDoNotRetry();
boolean serverOverload... | 3.26 |
hbase_IPCUtil_write_rdh | /**
* Write out header, param, and cell block if there is one.
*
* @param dos
* Stream to write into
* @param header
* to write
* @param param
* to write
* @param cellBlock
* to write
* @return Total number of bytes written.
* @throws IOException
* if write action fails
*/
public static int writ... | 3.26 |
hbase_ExplicitColumnTracker_reset_rdh | // Called between every row.
@Override
public void reset() {
this.index = 0;
this.f0 = this.columns[this.index];
for (ColumnCount col : this.columns) {
col.setCount(0);
}
resetTS();
} | 3.26 |
hbase_ExplicitColumnTracker_checkColumn_rdh | /**
* {@inheritDoc }
*/
@Overridepublic MatchCode checkColumn(Cell cell, byte type) {
// delete markers should never be passed to an
// *Explicit*ColumnTracker
assert !PrivateCellUtil.isDelete(type);
do {
// No more columns left, we are done with this query
... | 3.26 |
hbase_SnapshotSegmentScanner_getScannerOrder_rdh | /**
*
* @see KeyValueScanner#getScannerOrder()
*/
@Override
public long getScannerOrder() {
return 0;
} | 3.26 |
hbase_AsyncTableBuilder_setMaxRetries_rdh | /**
* Set the max retry times for an operation. Usually it is the max attempt times minus 1.
* <p>
* 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.
*
* @see #setMaxAttempts(int)
* @see #setOperationTimeo... | 3.26 |
hbase_BlockingRpcClient_createConnection_rdh | /**
* Creates a connection. Can be overridden by a subclass for testing.
*
* @param remoteId
* - the ConnectionId to use for the connection creation.
*/
@Override
protected BlockingRpcConnection createConnection(ConnectionId remoteId) throws IOException {
return new BlockingRpcConnection(this, remoteId);
} | 3.26 |
hbase_HbckRegionInfo_loadHdfsRegioninfo_rdh | /**
* Read the .regioninfo file from the file system. If there is no .regioninfo, add it to the
* orphan hdfs region list.
*/
public void loadHdfsRegioninfo(Configuration conf) throws IOException {
Path regionDir = getHdfsRegionDir();
if (regionDir == null) {
if (m0() == RegionInfo.DEFAULT_REPLICA_... | 3.26 |
hbase_RecoverLeaseFSUtils_getLogMessageDetail_rdh | /**
* Returns Detail to append to any log message around lease recovering.
*/
private static String getLogMessageDetail(final int nbAttempt, final Path p, final long startWaiting) {
return ((((("attempt=" + nbAttempt) + " on file=") + p) + " after ") + (EnvironmentEdgeManager.currentTime() - startWaiting)) + "ms";
} | 3.26 |
hbase_RecoverLeaseFSUtils_recoverFileLease_rdh | /**
* Recover the lease from HDFS, retrying multiple times.
*/
public static void recoverFileLease(FileSystem fs, Path p, Configuration conf, CancelableProgressable reporter) throws IOException {
if (fs instanceof FilterFileSystem)
{
fs =
((FilterFileSystem) (fs)).getRawFileSys... | 3.26 |
hbase_RecoverLeaseFSUtils_isFileClosed_rdh | /**
* Call HDFS-4525 isFileClosed if it is available.
*
* @return True if file is closed.
*/
private static boolean isFileClosed(final DistributedFileSystem dfs, final Method m, final Path p) {
try {
return ((Boolean) (m.invoke(dfs, p)));
} catch (SecurityException e) {
LOG.warn("No access", e);
} catch (E... | 3.26 |
hbase_RecoverLeaseFSUtils_recoverLease_rdh | /**
* Try to recover the lease.
*
* @return True if dfs#recoverLease came by true.
*/
private static boolean recoverLease(final DistributedFileSystem dfs, final int nbAttempt, final Path p, final long startWaiting) throws FileNotFoundException {
boolean v10 = false;
try {... | 3.26 |
hbase_IdentityTableMap_m1_rdh | /**
* Pass the key, value to reduce
*/
public void m1(ImmutableBytesWritable key,
Result value, OutputCollector<ImmutableBytesWritable, Result> output,
Reporter reporter) throws IOException {
// convert
output.collect(key, value);
} | 3.26 |
hbase_IdentityTableMap_m0_rdh | /**
* Use this before submitting a TableMap job. It will appropriately set up the JobConf.
*
* @param table
* table name
* @param columns
* columns to scan
* @param mapper
* mapper class
* @param job
* job configuration
*/
@SuppressWarnings("unchecked")
public static void m0(String table, String colu... | 3.26 |
hbase_Classes_extendedForName_rdh | /**
* Utilities for class manipulation.
*/
@InterfaceAudience.Privatepublic class Classes {
/**
* Equivalent of {@link Class#forName(String)} which also returns classes for primitives like
* <code>boolean</code>, etc. The name of the class to retrieve. Can be either a normal class or a
* primitive ... | 3.26 |
hbase_NamespaceQuotaSnapshotStore_getQuotaForNamespace_rdh | /**
* Fetches the namespace quota. Visible for mocking/testing.
*/
Quotas getQuotaForNamespace(String namespace) throws IOException
{
return QuotaTableUtil.getNamespaceQuota(conn, namespace);
} | 3.26 |
hbase_BackupManifest_addDependentImage_rdh | /**
* Add dependent backup image for this backup.
*
* @param image
* The direct dependent backup image
*/
public void addDependentImage(BackupImage image) {
this.backupImage.addAncestor(image);
} | 3.26 |
hbase_BackupManifest_getTableList_rdh | /**
* Get the table set of this image.
*
* @return The table set list
*/
public List<TableName> getTableList() {
return
backupImage.getTableNames();
} | 3.26 |
hbase_BackupManifest_setIncrTimestampMap_rdh | /**
* Set the incremental timestamp map directly.
*
* @param incrTimestampMap
* timestamp map
*/
public void setIncrTimestampMap(Map<TableName, Map<String, Long>> incrTimestampMap) {
this.backupImage.setIncrTimeRanges(incrTimestampMap);
} | 3.26 |
hbase_BackupManifest_getBackupImage_rdh | /**
* Get this backup image.
*
* @return the backup image.
*/
public BackupImage getBackupImage() {
return backupImage;
} | 3.26 |
hbase_BackupManifest_store_rdh | /**
* TODO: fix it. Persist the manifest file.
*
* @throws BackupException
* if an error occurred while storing the manifest file.
*/
public void store(Configuration conf) throws BackupException {
byte[] data = backupImage.toProto().toByteArray();
// write the file, overwrite if already exist
Path manifestFileP... | 3.26 |
hbase_BackupManifest_getDependentListByTable_rdh | /**
* Get the dependent image list for a specific table of this backup in time order from old to new
* if want to restore to this backup image level.
*
* @param table
* table
* @return the backup image list for a table in time order
*/
public ArrayList<BackupImage> getDependentListByTable(TableName table) {
A... | 3.26 |
hbase_BackupManifest_canCoverImage_rdh | /**
* Check whether backup image set could cover a backup image or not.
*
* @param fullImages
* The backup image set
* @param image
* The target backup image
* @return true if fullImages can cover image, otherwise false
*/
public static boolean canCoverImage(ArrayList<BackupImage> fullImages, BackupImage im... | 3.26 |
hbase_RSGroupInfoManagerImpl_getOnlineServers_rdh | /**
* Returns Set of online Servers named for their hostname and port (not ServerName).
*/
private Set<Address> getOnlineServers() {
return masterServices.getServerManager().getOnlineServers().keySet().stream().map(ServerName::getAddress).collect(Collectors.toSet());
} | 3.26 |
hbase_RSGroupInfoManagerImpl_getRegions_rdh | /**
* Returns List of Regions associated with this <code>server</code>.
*/private List<RegionInfo> getRegions(final Address server) {
LinkedList<RegionInfo> regions = new LinkedList<>();
for (Map.Entry<RegionInfo, ServerName> el : masterServices.getAssignmentManager().getRegionStates().getRegionAssignments().entrySe... | 3.26 |
hbase_RSGroupInfoManagerImpl_migrate_rdh | // Migrate the table rs group info from RSGroupInfo into the table descriptor
// Notice that we do not want to block the initialize so this will be done in background, and
// during the migrating, the rs group info maybe incomplete and cause region to be misplaced.
private void migrate() { Thread migrateThread = new Th... | 3.26 |
hbase_RSGroupInfoManagerImpl_updateCacheOfRSGroups_rdh | /**
* Update cache of rsgroups. Caller must be synchronized on 'this'.
*
* @param currentGroups
* Current list of Groups.
*/
private void updateCacheOfRSGroups(final Set<String> currentGroups) {
this.prevRSGroups.clear();
this.prevRSGroups.addAll(currentGroups);
} | 3.26 |
hbase_RSGroupInfoManagerImpl_resetRSGroupMap_rdh | /**
* Make changes visible. Caller must be synchronized on 'this'.
*/private void resetRSGroupMap(Map<String, RSGroupInfo> newRSGroupMap) {
this.holder = new RSGroupInfoHolder(newRSGroupMap);
} | 3.26 |
hbase_RSGroupInfoManagerImpl_getRSGroupAssignmentsByTable_rdh | /**
* This is an EXPENSIVE clone. Cloning though is the safest thing to do. Can't let out original
* since it can change and at least the load balancer wants to iterate this exported list. Load
* balancer should iterate over this list because cloned list will ignore disabled table and split
* parent region cases. T... | 3.26 |
hbase_RSGroupInfoManagerImpl_moveServerRegionsFromGroup_rdh | /**
* Move every region from servers which are currently located on these servers, but should not be
* located there.
*
* @param movedServers
* the servers that are moved to new group
* @param srcGrpServers
* all servers in the source group, excluding the movedServers
* @param targetGroupName
* the targe... | 3.26 |
hbase_RSGroupInfoManagerImpl_refresh_rdh | /**
* Read rsgroup info from the source of truth, the hbase:rsgroup table. Update zk cache. Called on
* startup of the manager.
*/
private synchronized void refresh(boolean forceOnline) throws IOException {
List<RSGroupInfo> groupList = new ArrayList<>();
// Overwrite anything read from zk, group table is ... | 3.26 |
hbase_RSGroupInfoManagerImpl_getDefaultServers_rdh | // Called by ServerEventsListenerThread. Presume it has lock on this manager when it runs.
private SortedSet<Address> getDefaultServers(List<RSGroupInfo> rsGroupInfoList) {
// Build a list of servers in other groups than default group, from rsGroupMap
Set<Address> serversInOtherGroup = new HashSet<>();
for (RSGroupInf... | 3.26 |
hbase_RSGroupInfoManagerImpl_checkForDeadOrOnlineServers_rdh | /**
* Check if the set of servers are belong to dead servers list or online servers list.
*
* @param servers
* servers to remove
*/
private void checkForDeadOrOnlineServers(Set<Address> servers) throws IOException {
// This ugliness is because we only have Address, not ServerName.
Set<Address> onlineServers = ne... | 3.26 |
hbase_DigestSaslServerAuthenticationProvider_handle_rdh | /**
* {@inheritDoc }
*/
@Override
public void handle(Callback[] callbacks) throws
InvalidToken,
UnsupportedCallbackException {
NameCallback nc = null;
PasswordCallback pc = null;
AuthorizeCallback ac = null;
for (Callback callback : callbacks) {
if (callback instanceof AuthorizeCallback) {
... | 3.26 |
hbase_BlockingRpcConnection_handleConnectionFailure_rdh | /**
* Handle connection failures If the current number of retries is equal to the max number of
* retries, stop retrying and throw the exception; Otherwise backoff N seconds and try connecting
* again. This Method is only called from inside setupIOstreams(), which is synchronized. Hence
* the sleep is synchronized;... | 3.26 |
hbase_BlockingRpcConnection_readResponse_rdh | /* Receive a response. Because only one receiver, so no synchronization on in. */
private void readResponse() {
Call call = null;
boolean v35 = false;
try {// See HBaseServer.Call.setResponse for where we write out the response.
// Total size of the response. Unused. But have to read it in anyways.
int totalSize = in.r... | 3.26 |
hbase_BlockingRpcConnection_m2_rdh | // close socket, reader, and clean up all pending calls.
private void m2(IOException e) {if (thread == null) {
return;
}
thread.interrupt();
thread = null;
m1();
if (callSender != null) {
callSender.cleanup(e);
}
for (Call call : calls.values()) {call.setException(e);
}
calls.clear();
} | 3.26 |
hbase_BlockingRpcConnection_shutdown_rdh | // release all resources, the connection will not be used any more.
@Override
public synchronized void shutdown() {
closed = true;
if (callSender != null) {
callSender.interrupt();
}
m2(new IOException(("connection to " + remoteId.getAddress()) + " closed"));
} | 3.26 |
hbase_BlockingRpcConnection_cleanup_rdh | /**
* Cleans the call not yet sent when we finish.
*/
public void cleanup(IOException e) {
IOException ie = new ConnectionClosingException(("Connection to " + remoteId.getAddress()) + " is closing.");
for (Call call : callsToWrite) {
call.setException(ie);
}
callsToWrite.clear();
} | 3.26 |
hbase_BlockingRpcConnection_m1_rdh | // just close socket input and output.
private void m1() {
IOUtils.closeStream(out);
IOUtils.closeStream(in);
IOUtils.closeSocket(socket);
out = null;
in = null;
socket = null;
} | 3.26 |
hbase_BlockingRpcConnection_setupConnection_rdh | // protected for write UT.
protected void setupConnection() throws IOException {
short ioFailures = 0;
short timeoutFailures = 0;
while (true) {
try {
this.socket = this.rpcClient.socketFactory.createSocket();
this.socket.setTcpNoDelay(this.rpcClient.isTcpNoDelay());this.soc... | 3.26 |
hbase_BlockingRpcConnection_run_rdh | /**
* Reads the call from the queue, write them on the socket.
*/
@Override
public void run() {
synchronized(BlockingRpcConnection.this) {
while (!closed) {
if (callsToWrite.isEmpty()) {
... | 3.26 |
hbase_BlockingRpcConnection_writeRequest_rdh | /**
* Initiates a call by sending the parameter to the remote server. Note: this is not called from
* the Connection thread, but by other threads.
*
* @see #readResponse()
*/
private void writeRequest(Call call) throws IOException {
ByteBuf cellBlock = null;
try {
cellBlock = this.rpcClient.cellBlockBuilder.buildC... | 3.26 |
hbase_BlockingRpcConnection_writeConnectionHeader_rdh | /**
* Write the connection header.
*/
private void writeConnectionHeader() throws IOException {
boolean isCryptoAesEnable = false;
// check if Crypto AES is enabled
if (saslRpcClient != null) {
boolean saslEncryptionEnabled = QualityOfProtection.PRIVACY.getSaslQop().equalsIgnoreCase(saslRpcClient.getSaslQOP());
isCry... | 3.26 |
hbase_BlockingRpcConnection_handleSaslConnectionFailure_rdh | /**
* If multiple clients with the same principal try to connect to the same server at the same time,
* the server assumes a replay attack is in progress. This is a feature of kerberos. In order to
* work around this, what is done is that the client backs off randomly and tries to initiate the
* connection again. T... | 3.26 |
hbase_SaslClientAuthenticationProvider_relogin_rdh | /**
* Executes any necessary logic to re-login the client. Not all implementations will have any
* logic that needs to be executed.
*/
default void relogin() throws IOException {
} | 3.26 |
hbase_SaslClientAuthenticationProvider_getRealUser_rdh | /**
* Returns the "real" user, the user who has the credentials being authenticated by the remote
* service, in the form of an {@link UserGroupInformation} object. It is common in the Hadoop
* "world" to have distinct notions of a "real" user and a "proxy" user. A "real" user is the user
* which actually has the cr... | 3.26 |
hbase_SaslClientAuthenticationProvider_canRetry_rdh | /**
* Returns true if the implementation is capable of performing some action which may allow a
* failed authentication to become a successful authentication. Otherwise, returns false
*/
default boolean canRetry() {
return false;
} | 3.26 |
hbase_LzmaCodec_getLevel_rdh | // Package private
static int getLevel(Configuration conf) {
return conf.getInt(LZMA_LEVEL_KEY, LZMA_LEVEL_DEFAULT);
} | 3.26 |
hbase_ZKVisibilityLabelWatcher_writeToZookeeper_rdh | /**
* Write a labels mirror or user auths mirror into zookeeper
*
* @param labelsOrUserAuths
* true for writing labels and false for user auths.
*/
public void writeToZookeeper(byte[] data, boolean labelsOrUserAuths) {
String znode = this.labelZnode;
if (!labelsOrUserAuths) {znode = this.userAuthsZnode;
... | 3.26 |
hbase_TableDescriptor_matchReplicationScope_rdh | /**
* Check if the table's cfs' replication scope matched with the replication state
*
* @param enabled
* replication state
* @return true if matched, otherwise false
*/
default boolean matchReplicationScope(boolean enabled) {
boolean hasEnabled = false;
boolean hasDisabled = false;
for (ColumnFamil... | 3.26 |
hbase_TableDescriptor_hasGlobalReplicationScope_rdh | /**
* Check if any of the table's cfs' replication scope are set to
* {@link HConstants#REPLICATION_SCOPE_GLOBAL}.
*
* @return {@code true} if we have, otherwise {@code false}.
*/
default boolean hasGlobalReplicationScope() {
return Stream.of(getColumnFamilies()).anyMatch(cf -> cf.getScope()
== HConstants.... | 3.26 |
hbase_OperationWithAttributes_getId_rdh | /**
* This method allows you to retrieve the identifier for the operation if one was set.
*
* @return the id or null if not set
*/
public String getId() {
byte[] attr = getAttribute(ID_ATRIBUTE);
return attr == null
?
null : Bytes.toString(attr);
} | 3.26 |
hbase_TimeoutExceptionInjector_trigger_rdh | /**
* Trigger the timer immediately.
* <p>
* Exposed for testing.
*/
public void trigger() {
synchronized(timerTask) {
if
(this.complete) {
LOG.warn("Timer already completed, not triggering.");
return;
}
LOG.debug("Triggering timer immediately!");
... | 3.26 |
hbase_TimeoutExceptionInjector_start_rdh | /**
* Start a timer to fail a process if it takes longer than the expected time to complete.
* <p>
* Non-blocking.
*
* @throws IllegalStateException
* if the timer has already been marked done via {@link #complete()}
* or {@link #trigger()}
*/
public synchronized void start() throws IllegalStateException {... | 3.26 |
hbase_TimeoutExceptionInjector_complete_rdh | /**
* For all time forward, do not throw an error because the process has completed.
*/
public void complete() {
synchronized(this.timerTask) {
if (this.complete) {
LOG.warn("Timer already marked completed, ignoring!");
return;}
if (LOG.isDebugEnabled()) {
LOG.d... | 3.26 |
hbase_WALProcedureMap_merge_rdh | /**
* Merge the given {@link WALProcedureMap} into this one. The {@link WALProcedureMap} passed in
* will be cleared after merging.
*/public void merge(WALProcedureMap other)
{
other.procMap.forEach(procMap::putIfAbsent);
maxModifiedProcId = Math.max(maxModifiedProcId, other.maxModifiedProcId);
minModi... | 3.26 |
hbase_HttpDoAsClient_bytes_rdh | // Helper to translate strings to UTF8 bytes
private byte[] bytes(String s) {
return Bytes.toBytes(s);
} | 3.26 |
hbase_AbstractRpcClient_configureRpcController_rdh | /**
* Configure an rpc controller
*
* @param controller
* to configure
* @return configured rpc controller
*/
protected HBaseRpcController configureRpcController(RpcController controller) {
HBaseRpcController hrc;
// TODO: Ideally we should not use an RpcController other than HBaseRpcController at clie... | 3.26 |
hbase_AbstractRpcClient_isTcpNoDelay_rdh | // for writing tests that want to throw exception when connecting.
protected boolean isTcpNoDelay() {
return tcpNoDelay;
} | 3.26 |
hbase_AbstractRpcClient_getConnection_rdh | /**
* Get a connection from the pool, or create a new one and add it to the pool. Connections to a
* given host/port are reused.
*/private T getConnection(ConnectionId remoteId) throws IOException {
if (failedServers.isFailedServer(remoteId.getAddress())) {
if (LOG.isDebugEnabled()) {
LOG.de... | 3.26 |
hbase_AbstractRpcClient_getCompressor_rdh | /**
* Encapsulate the ugly casting and RuntimeException conversion in private method.
*
* @param conf
* configuration
* @return The compressor to use on this client.
*/
private static CompressionCodec getCompressor(final Configuration conf) {
String className = conf.get("hbase.client.rpc.compressor", null... | 3.26 |
hbase_AbstractRpcClient_configureHBaseRpcController_rdh | /**
* Configure an hbase rpccontroller
*
* @param controller
* to configure
* @param channelOperationTimeout
* timeout for operation
* @return configured controller
*/
static HBaseRpcController configureHBaseRpcController(RpcController controller, int channelOperationTimeout) {
HBaseRpcController hrc;
... | 3.26 |
hbase_AbstractRpcClient_getCodec_rdh | /**
* Encapsulate the ugly casting and RuntimeException conversion in private method.
*
* @return Codec to use on this client.
*/
protected Codec getCodec()
{
// For NO CODEC, "hbase.client.rpc.codec" must be configured with empty string AND
// "hbase.client.default.rpc.codec" also -- because default is to ... | 3.26 |
hbase_AbstractRpcClient_cancelConnections_rdh | /**
* Interrupt the connections to the given ip:port server. This should be called if the server is
* known as actually dead. This will not prevent current operation to be retried, and, depending
* on their own behavior, they may retry on the same server. This can be a feature, for example at
* ... | 3.26 |
hbase_AbstractRpcClient_callBlockingMethod_rdh | /**
* Make a blocking call. Throws exceptions if there are network problems or if the remote code
* threw an exception.
*
* @param ticket
* Be careful which ticket you pass. A new user will mean a new Connection.
* {@link UserProvider#getCurrent()} makes a new instance of User each time so will
* be a new ... | 3.26 |
hbase_RegionReplicationSink_replicated_rdh | /**
* Should be called regardless of the result of the replicating operation. Unless you still want
* to reuse this entry, otherwise you must call this method to release the possible off heap
* memories.
*/
void
replicated() {
if (rpcCall != null) {
rpcCall.releaseByWAL();
}
} | 3.26 |
hbase_RegionReplicationSink_waitUntilStopped_rdh | /**
* Make sure that we have finished all the replicating requests.
* <p/>
* After returning, we can make sure there will be no new replicating requests to secondary
* replicas.
* <p/>
* This is used to keep the replicating order the same with the WAL edit order when writing.
*/
public void waitUntilStopped() th... | 3.26 |
hbase_RegionReplicationSink_stop_rdh | /**
* Stop the replication sink.
* <p/>
* Usually this should only be called when you want to close a region.
*/
public void stop() {
synchronized(entries) {
stopping
= true;
clearAllEntries();
if (!sending) {
stopped = true;
entries.notifyAll();
}... | 3.26 |
hbase_RegionReplicationSink_add_rdh | /**
* Add this edit to replication queue.
* <p/>
* The {@code rpcCall} is for retaining the cells if the edit is built within an rpc call and the
* rpc call has cell scanner, which is off heap.
*/
public void add(WALKeyImpl key, WALEdit edit, ServerCall<?> rpcCall) {if ((!tableDesc.hasRegionMemStoreReplication()) ... | 3.26 |
hbase_OrderedInt8_decodeByte_rdh | /**
* Read a {@code byte} value from the buffer {@code src}.
*
* @param src
* the {@link PositionedByteRange} to read the {@code byte} from
* @return the {@code byte} read from the buffer
*/
public byte decodeByte(PositionedByteRange src) {
return OrderedBytes.decodeInt8(src);
} | 3.26 |
hbase_OrderedInt8_encodeByte_rdh | /**
* Write instance {@code val} into buffer {@code dst}.
*
* @param dst
* the {@link PositionedByteRange} to write to
* @param val
* the value to write to {@code dst}
* @return the number of bytes written
*/
public int encodeByte(PositionedByteRange dst, byte val) {
return OrderedBytes.encodeInt8(dst... | 3.26 |
hbase_Addressing_createInetSocketAddressFromHostAndPortStr_rdh | /**
* Create a socket address
*
* @param hostAndPort
* Formatted as <code><hostname> ':' <port></code>
* @return An InetSocketInstance
*/
public static InetSocketAddress createInetSocketAddressFromHostAndPortStr(final String hostAndPort) {
return new InetSocketAddress(parseHostname(hostAndPort),... | 3.26 |
hbase_Addressing_parsePort_rdh | /**
* Parse the port portion of a host-and-port string
*
* @param hostAndPort
* Formatted as <code><hostname> ':' <port></code>
* @return The port portion of <code>hostAndPort</code>
*/
public static int parsePort(final String
hostAndPort) {
int v1 = hostAndPort.lastIndexOf(HOSTNAME_PORT_SEPARAT... | 3.26 |
hbase_Addressing_isLocalAddress_rdh | /**
* Given an InetAddress, checks to see if the address is a local address, by comparing the address
* with all the interfaces on the node.
*
* @param addr
* address to check if it is local node's address
* @return true if the address corresponds to the local node
*/
public static boolean isLocalAddress(InetA... | 3.26 |
hbase_Addressing_inetSocketAddress2String_rdh | /**
* Given an InetSocketAddress object returns a String represent of it. This is a util method for
* Java 17. The toString() function of InetSocketAddress will flag the unresolved address with a
* substring in the string, which will result in unexpected problem. We should use this util
* function to get the string... | 3.26 |
hbase_Addressing_parseHostname_rdh | /**
* Parse the hostname portion of a host-and-port string
*
* @param hostAndPort
* Formatted as <code><hostname> ':' <port></code>
* @return The hostname portion of <code>hostAndPort</code>
*/
public static String parseHostname(final String hostAndPort) {
int colonIndex = hostAndPort.lastIndexO... | 3.26 |
hbase_FlushPolicyFactory_create_rdh | /**
* Create the FlushPolicy configured for the given table.
*/
public static FlushPolicy create(HRegion region, Configuration conf) throws IOException {
Class<? extends FlushPolicy> clazz = m0(region.getTableDescriptor(), conf);
FlushPolicy policy = ReflectionUtils.newInstance(clazz, conf);
policy.conf... | 3.26 |
hbase_FavoredStochasticBalancer_getRandomGenerator_rdh | /**
* Returns any candidate generator in random
*/
@Override
protected CandidateGenerator getRandomGenerator() {return candidateGenerators.get(ThreadLocalRandom.current().nextInt(candidateGenerators.size()));
} | 3.26 |
hbase_FavoredStochasticBalancer_assignRegionToAvailableFavoredNode_rdh | /**
* Assign the region to primary if its available. If both secondary and tertiary are available,
* assign to the host which has less load. Else assign to secondary or tertiary whichever is
* available (in that order).
*/
private void assignRegionToAvailableFavoredNode(Map<ServerName, List<RegionInfo>> assignmentM... | 3.26 |
hbase_FavoredStochasticBalancer_retainAssignment_rdh | /**
* Reuse BaseLoadBalancer's retainAssignment, but generate favored nodes when its missing.
*/
@Override
@NonNull
public Map<ServerName, List<RegionInfo>> retainAssignment(Map<RegionInfo, ServerName> regions, List<ServerName> servers) throws HBaseIOException {
Map<ServerName, List<RegionInfo>> assignmentMap = Maps... | 3.26 |
hbase_FavoredStochasticBalancer_roundRobinAssignment_rdh | /**
* Round robin assignment: Segregate the regions into two types: 1. The regions that have favored
* node assignment where at least one of the favored node is still alive. In this case, try to
* adhere to the current favored nodes assignment as much as possible - i.e., if the current
* primary is gone, then make ... | 3.26 |
hbase_FavoredStochasticBalancer_generateFavoredNodesForMergedRegion_rdh | /**
* Generate favored nodes for a region during merge. Choose the FN from one of the sources to keep
* it simple.
*/
@Override
public void generateFavoredNodesForMergedRegion(RegionInfo merged, RegionInfo[] mergeParents) throws IOException {
updateFavoredNodesForRegion(merged, fnm.getFavoredNodes(mergeParents[0]));... | 3.26 |
hbase_FavoredStochasticBalancer_generateFavoredNodesForDaughter_rdh | /**
* Generate Favored Nodes for daughters during region split.
* <p/>
* If the parent does not have FN, regenerates them for the daughters.
* <p/>
* If the parent has FN, inherit two FN from parent for each daughter and generate the remaining.
* The primary FN for both the daughters should be the same as parent.... | 3.26 |
hbase_FavoredStochasticBalancer_randomAssignment_rdh | /**
* If we have favored nodes for a region, we will return one of the FN as destination. If favored
* nodes are not present for a region, we will generate and return one of the FN as destination.
* If we can't generate anything, lets fallback.
*/
@Override
public ServerName randomAssignment(RegionInfo regionInfo, ... | 3.26 |
hbase_FavoredStochasticBalancer_getOnlineFavoredNodes_rdh | /**
* Return list of favored nodes that are online.
*/
private List<ServerName>
getOnlineFavoredNodes(List<ServerName> onlineServers, List<ServerName> serversWithoutStartCodes) {
if (serversWithoutStartCodes == null) {
return null;
} else {
List<ServerName> result = Lists.newArrayList();
for (ServerName sn :
server... | 3.26 |
hbase_FavoredStochasticBalancer_segregateRegionsAndAssignRegionsWithFavoredNodes_rdh | /**
* Return a pair - one with assignments when favored nodes are present and another with regions
* without favored nodes.
*/
private Pair<Map<ServerName, List<RegionInfo>>, List<RegionInfo>> segregateRegionsAndAssignRegionsWithFavoredNodes(Collection<RegionInfo> regions, List<ServerName> onlineServers) throws HBas... | 3.26 |
hbase_FavoredStochasticBalancer_balanceTable_rdh | /**
* For all regions correctly assigned to favored nodes, we just use the stochastic balancer
* implementation. For the misplaced regions, we assign a bogus server to it and AM takes care.
*/
@Override
protected List<RegionPlan> balanceTable(TableName tableName, Map<ServerName, List<RegionInfo>> loadOfOneTable) {
... | 3.26 |
hbase_MasterProcedureUtil_getTablePriority_rdh | /**
* Return the priority for the given table. Now meta table is 3, other system tables are 2, and
* user tables are 1.
*/
public static int getTablePriority(TableName tableName) {
if (TableName.isMetaTableName(tableName)) {
return 3;
} else if (tableName.isSystemTable()) {
return 2;
} el... | 3.26 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.