name stringlengths 12 178 | code_snippet stringlengths 8 36.5k | score float64 3.26 3.68 |
|---|---|---|
hadoop_TypedBytesInput_readRawBytes_rdh | /**
* Reads the raw bytes following a <code>Type.BYTES</code> code.
*
* @return the obtained bytes sequence
* @throws IOException
*/
public byte[] readRawBytes() throws IOException {
return readRawBytes(BYTES.code);
} | 3.26 |
hadoop_TypedBytesInput_m0_rdh | /**
* Reads the raw bytes following a <code>Type.BOOL</code> code.
*
* @return the obtained bytes sequence
* @throws IOException
*/
public byte[] m0() throws IOException {byte[] bytes = new byte[2];
bytes[0] = ((byte) (BOOL.code));
in.readFully(bytes, 1, 1);
return bytes;
} | 3.26 |
hadoop_TypedBytesInput_readRawDouble_rdh | /**
* Reads the raw bytes following a <code>Type.DOUBLE</code> code.
*
* @return the obtained bytes sequence
* @throws IOException
*/
public byte[] readRawDouble() throws
IOException {
byte[] bytes = new byte[9];
bytes[0] = ((byte) (DOUBLE.code));
in.readFully(bytes, 1, 8);
return
bytes;
} | 3.26 |
hadoop_TypedBytesInput_skipType_rdh | /**
* Skips a type byte.
*
* @return true iff the end of the file was not reached
* @throws IOException
*/
public boolean skipType() throws IOException {
try {
in.readByte();
return true;
} catch (EOFException eof) {
return false;
}
} | 3.26 |
hadoop_TypedBytesInput_readByte_rdh | /**
* Reads the byte following a <code>Type.BYTE</code> code.
*
* @return the obtained byte
* @throws IOException
*/
public byte readByte() throws IOException {
return in.readByte();
} | 3.26 |
hadoop_LimitInputStream_mark_rdh | // it's okay to mark even if mark isn't supported, as reset won't work
@Override
public synchronized void mark(int readLimit) {
in.mark(readLimit);
mark = left;
} | 3.26 |
hadoop_FederationMethodWrapper_getTypes_rdh | /**
* Get the calling types for this method.
*
* @return An array of calling types.
*/
public Class<?>[] getTypes() {
return Arrays.copyOf(this.types, this.types.length);
} | 3.26 |
hadoop_HsNavBlock_render_rdh | /* (non-Javadoc)
@see org.apache.hadoop.yarn.webapp.view.HtmlBlock#render(org.apache.hadoop.yarn.webapp.view.HtmlBlock.Block)
*/
@Override
protected void render(Block html) {
DIV<Hamlet> nav = html.div("#nav").h3("Application").ul().li().a(url("about"), "About").__().li().a(url("app"), "Jobs").__().__();
if (a... | 3.26 |
hadoop_SimpleBufferedOutputStream_size_rdh | // Get the size of internal buffer being used.
public int size() {
return count;
} | 3.26 |
hadoop_CrcComposer_newCrcComposer_rdh | /**
* Returns a CrcComposer which will collapse all ingested CRCs into a single
* value.
*
* @param type
* type.
* @param bytesPerCrcHint
* bytesPerCrcHint.
* @throws IOException
* raised on errors performing I/O.
* @return a CrcComposer which will collapse all ingested CRCs into a single value.
*/
pub... | 3.26 |
hadoop_CrcComposer_digest_rdh | /**
* Returns byte representation of composed CRCs; if no stripeLength was
* specified, the digest should be of length equal to exactly one CRC.
* Otherwise, the number of CRCs in the returned array is equal to the
* total sum bytesPerCrc divided by stripeLength. If the sum of bytesPerCrc
* is not a multiple of st... | 3.26 |
hadoop_CrcComposer_update_rdh | /**
* Updates with a single additional CRC which corresponds to an underlying
* data size of {@code bytesPerCrc}.
*
* @param crcB
* crcB.
* @param bytesPerCrc
* bytesPerCrc.
* @throws IOException
* raised on errors performing I/O.
*/public void update(int crcB, long bytesPerCrc) throws IOException {
... | 3.26 |
hadoop_BlockMovementStatus_getStatusCode_rdh | /**
*
* @return the status code.
*/
int getStatusCode() {
return code;
} | 3.26 |
hadoop_S3ABlockManager_read_rdh | /**
* Reads into the given {@code buffer} {@code size} bytes from the underlying file
* starting at {@code startOffset}.
*
* @param buffer
* the buffer to read data in to.
* @param startOffset
* the offset at which reading starts.
* @param size
* the number bytes to read.
* @return number of bytes read.... | 3.26 |
hadoop_RouterHeartbeatService_updateStateStore_rdh | /**
* Update the state of the Router in the State Store.
*/
@VisibleForTesting
synchronized void updateStateStore() {
String routerId = router.getRouterId();
if (routerId == null) {
LOG.error("Cannot heartbeat for router: unknown router id");
return;
... | 3.26 |
hadoop_RouterHeartbeatService_getStateStoreVersion_rdh | /**
* Get the version of the data in the State Store.
*
* @param clazz
* Class in the State Store.
* @return Version of the data.
*/
private <R extends BaseRecord, S extends RecordStore<R>> long getStateStoreVersion(final Class<S>
clazz) {
long version = -1;
try {
StateStoreService
stat... | 3.26 |
hadoop_RouterHeartbeatService_updateStateAsync_rdh | /**
* Trigger the update of the Router state asynchronously.
*/
protected void updateStateAsync() { Thread thread = new Thread(this::updateStateStore, "Router Heartbeat Async");
thread.setDaemon(true);
thread.start();
} | 3.26 |
hadoop_CachedSASToken_getExpiry_rdh | /**
* Parse the sasExpiry from the SAS token. The sasExpiry is the minimum
* of the ske and se parameters. The se parameter is required and the
* ske parameter is optional.
*
* @param token
* an Azure Storage SAS token
* @return the sasExpiry or OffsetDateTime.MIN if invalid.
... | 3.26 |
hadoop_CachedSASToken_get_rdh | /**
* Gets the token if still valid.
*
* @return the token or null if it is expired or near sasExpiry.
*/
public String get() {// quickly return null if not set
if (sasToken == null) {
return null;
}
String token;
OffsetDateTime exp;
synchronized(this) {
token = sasToken;
... | 3.26 |
hadoop_CachedSASToken_update_rdh | /**
* Updates the cached SAS token and expiry. If the token is invalid, the cached value
* is cleared by setting it to null and the expiry to MIN.
*
* @param token
* an Azure Storage SAS token
*/
public void update(String token)
{
// quickly return if token and cached sasToken are the same reference
//... | 3.26 |
hadoop_CachedSASToken_isNearExpiry_rdh | /**
* Checks if the SAS token is expired or near expiration.
*
* @param expiry
* @param minExpiryInSeconds
* @return true if the SAS is near sasExpiry; otherwise false
*/
private static boolean isNearExpiry(OffsetDateTime expiry, long minExpiryInSeconds) {
if (expiry == OffsetDateTime.MIN) {
return... | 3.26 |
hadoop_ResourceEstimatorServer_startResourceEstimatorServer_rdh | /**
* Start embedded Hadoop HTTP server.
*
* @return an instance of the started HTTP server.
* @throws IOException
* in case there is an error while starting server.
*/
static ResourceEstimatorServer startResourceEstimatorServer() throws IOException, InterruptedException {
Configuration config = new YarnCon... | 3.26 |
hadoop_ResourceEstimatorServer_shutdown_rdh | /**
* Stop embedded Hadoop HTTP server.
*
* @throws Exception
* in case the HTTP server fails to shut down.
*/public void shutdown() throws Exception {
LOGGER.info("Stopping resourceestimator service at: {}.", baseURI.toString());
webServer.stop();
} | 3.26 |
hadoop_RouterRMAdminService_finalize_rdh | /**
* Shutdown the chain of interceptors when the object is destroyed.
*/
@Override
protected void finalize() {
rootInterceptor.shutdown();
} | 3.26 |
hadoop_RouterRMAdminService_getPipelines_rdh | /**
* Gets the Request interceptor chains for all the users.
*
* @return the request interceptor chains.
*/
@VisibleForTesting
protected Map<String, RequestInterceptorChainWrapper> getPipelines() {
return this.userPipelineMap;
} | 3.26 |
hadoop_RouterRMAdminService_getRootInterceptor_rdh | /**
* Gets the root request interceptor.
*
* @return the root request interceptor
*/
public synchronized RMAdminRequestInterceptor getRootInterceptor() {
return rootInterceptor;
} | 3.26 |
hadoop_RouterRMAdminService_initializePipeline_rdh | /**
* Initializes the request interceptor pipeline for the specified user.
*
* @param user
*/
private RequestInterceptorChainWrapper initializePipeline(String user) {
synchronized(this.userPipelineMap) {
if (this.userPipelineMap.containsKey(user)) {
LOG.info("Request to start an already ex... | 3.26 |
hadoop_RouterRMAdminService_init_rdh | /**
* Initializes the wrapper with the specified parameters.
*
* @param interceptor
* the first interceptor in the pipeline
*/
public synchronized void init(RMAdminRequestInterceptor interceptor) {
this.rootInterceptor = interceptor;
} | 3.26 |
hadoop_RouterRMAdminService_createRequestInterceptorChain_rdh | /**
* This method creates and returns reference of the first interceptor in the
* chain of request interceptor instances.
*
* @return the reference of the first interceptor in the chain
*/@VisibleForTesting
protected RMAdminRequestInterceptor createRequestInterceptorChain() {
Configuration conf = getConfig();
... | 3.26 |
hadoop_AwsV1BindingSupport_createAWSV1CredentialProvider_rdh | /**
* Create an AWS credential provider from its class by using reflection. The
* class must implement one of the following means of construction, which are
* attempted in order:
*
* <ol>
* <li>a public constructor accepting java.net.URI and
* org.apache.hadoop.conf.Configuration</li>
* <li>a public constr... | 3.26 |
hadoop_AwsV1BindingSupport_isAwsV1SdkAvailable_rdh | /**
* Is the AWS v1 SDK available?
*
* @return true if it was found in the classloader
*/
public static synchronized boolean isAwsV1SdkAvailable() {
return SDK_V1_FOUND;
} | 3.26 |
hadoop_AwsV1BindingSupport_checkForAwsV1Sdk_rdh | /**
* Probe for the AWS v1 SDK being available by looking for
* the class {@link #CREDENTIAL_PROVIDER_CLASSNAME}.
*
* @return true if it was found in the classloader
*/
private static boolean checkForAwsV1Sdk() {
try {
ClassLoader cl = AwsV1BindingSupport.class.getClassLoader();
cl.loadClass(... | 3.26 |
hadoop_MutableGaugeLong_toString_rdh | /**
*
* @return the value of the metric
*/
public String toString() {
return value.toString();
} | 3.26 |
hadoop_MutableGaugeLong_set_rdh | /**
* Set the value of the metric
*
* @param value
* to set
*/
public void set(long value) {
this.value.set(value);
setChanged();
} | 3.26 |
hadoop_MutableGaugeLong_decr_rdh | /**
* decrement by delta
*
* @param delta
* of the decrement
*/
public void decr(long delta) {
value.addAndGet(-delta);
setChanged();
} | 3.26 |
hadoop_MutableGaugeLong_incr_rdh | /**
* Increment by delta
*
* @param delta
* of the increment
*/
public void incr(long delta) {
value.addAndGet(delta);
setChanged();
} | 3.26 |
hadoop_DeletionService_isTerminated_rdh | /**
* Determine if the service has completely stopped.
* Used only by unit tests
*
* @return true if service has completely stopped
*/
@Private
public boolean isTerminated() {
return (getServiceState() == STATE.STOPPED) &&
sched.isTerminated();
} | 3.26 |
hadoop_IOStatisticsStoreImpl_lookupQuietly_rdh | /**
* Get a reference to the map type providing the
* value for a specific key, returning null if it not found.
*
* @param <T>
* type of map/return type.
* @param map
* map to look up
* @param key
* statistic name
* @return the value
*/
private static <T> T lookupQuietly(final Map<String, T> map, Stri... | 3.26 |
hadoop_IOStatisticsStoreImpl_addTimedOperation_rdh | /**
* Add a duration to the min/mean/max statistics, using the
* given prefix and adding a suffix for each specific value.
* <p>
* The update is non -atomic, even though each individual statistic
* is updated thread-safely. If two threads update the values
* simultaneously, at the end of each operation the state ... | 3.26 |
hadoop_IOStatisticsStoreImpl_getMaximumReference_rdh | /**
* Get a reference to the atomic instance providing the
* value for a specific maximum. This is useful if
* the value is passed around.
*
* @param key
* statistic name
* @return the reference
* @throws NullPointerException
* if there is no entry of that name
*/
@Override
public AtomicLong getMaximumRef... | 3.26 |
hadoop_IOStatisticsStoreImpl_getCounterReference_rdh | /**
* Get a reference to the atomic instance providing the
* value for a specific counter. This is useful if
* the value is passed around.
*
* @param key
* statistic name
* @return the reference
* @throws NullPointerException
* if there is no entry of that name
*/
@Override
public AtomicLong getCounterR... | 3.26 |
hadoop_IOStatisticsStoreImpl_setAtomicLong_rdh | /**
* Set an atomic long to a value.
*
* @param aLong
* atomic long; may be null
* @param value
* value to set to
*/
private void setAtomicLong(final AtomicLong aLong, final long value) {
if (aLong != null) {
aLong.set(value);
}
} | 3.26 |
hadoop_IOStatisticsStoreImpl_getGaugeReference_rdh | /**
* Get a reference to the atomic instance providing the
* value for a specific gauge. This is useful if
* the value is passed around.
*
* @param key
* statistic name
* @return the reference
* @throws NullPointerException
* if there is no entry of that name
*/
@Override
public AtomicLong getGaugeRefere... | 3.26 |
hadoop_IOStatisticsStoreImpl_aggregate_rdh | /**
* Aggregate those statistics which the store is tracking;
* ignore the rest.
*
* @param source
* statistics; may be null
* @return true if a statistics reference was supplied/aggregated.
*/
@Override
public synchronized boolean aggregate(@Nullable
final IOStatistics source) {
if (source == null) {
... | 3.26 |
hadoop_IOStatisticsStoreImpl_getMeanStatistic_rdh | /**
* Get a mean statistic.
*
* @param key
* statistic name
* @return the reference
* @throws NullPointerException
* if there is no entry of that name
*/
@Override
public MeanStatistic getMeanStatistic(String key) {
return lookup(f0, key);
} | 3.26 |
hadoop_IOStatisticsStoreImpl_lookup_rdh | /**
* Get a reference to the map type providing the
* value for a specific key, raising an exception if
* there is no entry for that key.
*
* @param <T>
* type of map/return type.
* @param map
* map to look up
* @param key
* statistic name
* @return the value
* @throws NullPointerException
* if the... | 3.26 |
hadoop_IOStatisticsStoreImpl_incAtomicLong_rdh | /**
* increment an atomic long and return its value;
* null long is no-op returning 0.
*
* @param aLong
* atomic long; may be null
* param increment amount to increment; negative for a decrement
* @return final value or 0 if the long is null
*/
private long incAtomicLong(final AtomicLong aLong, final long i... | 3.26 |
hadoop_IOStatisticsStoreImpl_trackDuration_rdh | /**
* If the store is tracking the given key, return the
* duration tracker for it. If not tracked, return the
* stub tracker.
*
* @param key
* statistic key prefix
* @param count
* #of times to increment the matching counter in this
* operation.
* @return a tracker.
*/
@Override
public DurationTracker... | 3.26 |
hadoop_IOStatisticsStoreImpl_getMinimumReference_rdh | /**
* Get a reference to the atomic instance providing the
* value for a specific minimum. This is useful if
* the value is passed around.
*
* @param key
* statistic name
* @return the reference
* @throws NullPointerException
* if there is no entry of that name
*/
@Overridepublic AtomicLong getMinimumRef... | 3.26 |
hadoop_IOStatisticsStoreImpl_reset_rdh | /**
* Reset all statistics.
*/
@Override
public synchronized void reset() {
counterMap.values().forEach(a -> a.set(0));
gaugeMap.values().forEach(a -> a.set(0));
minimumMap.values().forEach(a -> a.set(0));
maximumMap.values().forEach(a -> a.set(0));
f0.values().forEach(a -> a.clear());
} | 3.26 |
hadoop_RMAppKillByClientEvent_getCallerUGI_rdh | /**
* returns the {@link UserGroupInformation} information.
*
* @return UserGroupInformation
*/
public final UserGroupInformation getCallerUGI() {
return callerUGI;
} | 3.26 |
hadoop_RMAppKillByClientEvent_getIp_rdh | /**
* returns the ip address stored in this event.
*
* @return remoteIP
*/
public final InetAddress getIp() {
return ip;
} | 3.26 |
hadoop_DiskBalancerDataNode_getDataNodeIP_rdh | /**
* Returns the IP address of this Node.
*
* @return IP Address string
*/
public String getDataNodeIP() {
return dataNodeIP;
} | 3.26 |
hadoop_DiskBalancerDataNode_getNodeDataDensity_rdh | /**
* Returns NodeDataDensity Metric.
*
* @return float
*/public double getNodeDataDensity() {
return f0;
} | 3.26 |
hadoop_DiskBalancerDataNode_getVolumeSets_rdh | /**
* Returns the Volume sets on this node.
*
* @return a Map of VolumeSets
*/
public Map<String, DiskBalancerVolumeSet> getVolumeSets() {
return volumeSets;
} | 3.26 |
hadoop_DiskBalancerDataNode_getDataNodePort_rdh | /**
* Returns the Port of this DataNode.
*
* @return Port Number
*/
public int getDataNodePort() {
return dataNodePort;
} | 3.26 |
hadoop_DiskBalancerDataNode_hashCode_rdh | /**
* Returns a hash code value for the object. This method is supported for the
* benefit of hash tables such as those provided by {@link HashMap}.
*/
@Override
public int hashCode() {
return super.hashCode();
} | 3.26 |
hadoop_DiskBalancerDataNode_computeNodeDensity_rdh | /**
* Computes nodes data density.
*
* This metric allows us to compare different nodes and how well the data is
* spread across a set of volumes inside the node.
*/
public void computeNodeDensity() {
double sum = 0;
int volcount =... | 3.26 |
hadoop_DiskBalancerDataNode_setDataNodeUUID_rdh | /**
* Sets Datanode UUID.
*
* @param nodeID
* - Node ID.
*/
public void
setDataNodeUUID(String nodeID) {
this.dataNodeUUID = nodeID;
} | 3.26 |
hadoop_DiskBalancerDataNode_isBalancingNeeded_rdh | /**
* Computes if this node needs balancing at all.
*
* @param threshold
* - Percentage
* @return true or false
*/
public boolean isBalancingNeeded(double threshold) {
for (DiskBalancerVolumeSet vSet : getVolumeSets().values()) {if (vSet.isBalancingNeeded(threshold)) {
return true;
}
... | 3.26 |
hadoop_DiskBalancerDataNode_setDataNodeIP_rdh | /**
* Sets the IP address of this Node.
*
* @param ipaddress
* - IP Address
*/
public void setDataNodeIP(String ipaddress) {
this.dataNodeIP = ipaddress;
} | 3.26 |
hadoop_DiskBalancerDataNode_getDataNodeUUID_rdh | /**
* Returns datanode ID.
*/
public String getDataNodeUUID() {
return dataNodeUUID;
} | 3.26 |
hadoop_DiskBalancerDataNode_equals_rdh | /**
* Indicates whether some other object is "equal to" this one.
*/
@Override
public boolean equals(Object obj) {
if ((obj == null) || (obj.getClass() != getClass())) {
return false;
}
DiskBalancerDataNode that = ((DiskBalancerDataNode) (obj));
return dataNodeUUID.equals(that.getDataNodeUUID... | 3.26 |
hadoop_DiskBalancerDataNode_getDataNodeName_rdh | /**
* Get DataNode DNS name.
*
* @return name of the node
*/
public String getDataNodeName() {
return dataNodeName;
} | 3.26 |
hadoop_DiskBalancerDataNode_addVolume_rdh | /**
* Adds a volume to the DataNode.
*
* It is assumed that we have one thread per node hence this call is not
* synchronised neither is the map is protected.
*
* @param volume
* - volume
*/
public void addVolume(DiskBalancerVolume volume) throws Exception {
Preconditions.checkNotNull(volume, "volume cann... | 3.26 |
hadoop_DiskBalancerDataNode_setDataNodeName_rdh | /**
* Sets node's DNS name.
*
* @param name
* - Data node name
*/
public void setDataNodeName(String name) {
this.dataNodeName = name;
} | 3.26 |
hadoop_ServiceMetricsSink_putMetrics_rdh | /**
* Publishes service and component metrics to ATS.
*/@Override
public void putMetrics(MetricsRecord record) {
if (serviceTimelinePublisher.isStopped()) {
log.warn("ServiceTimelinePublisher has stopped. " + "Not publishing any more metrics to ATS.");
return;
}
boolean isServiceMetrics = false;
boolean is... | 3.26 |
hadoop_Anonymizer_main_rdh | /**
* The main driver program to use the anonymization utility.
*
* @param args
*/
public static void main(String[] args) {
Anonymizer instance = new Anonymizer();
int result = 0;
try {result = ToolRunner.run(instance, args);
} catch (Exception e) {
e.printStackTrace(System.err);
System.exit(-1);
}
if (re... | 3.26 |
hadoop_Anonymizer_run_rdh | /**
* Runs the actual anonymization tool.
*/
public int run() throws Exception {
try {
anonymizeTrace();
} catch (IOException ioe) {
System.err.println("Error running the trace anonymizer!");
ioe.printStackTrace();
System.out.println("\n\nAnonymization unsuccessful!");
... | 3.26 |
hadoop_Anonymizer_createJsonGenerator_rdh | // Creates a JSON generator
private JsonGenerator createJsonGenerator(Configuration conf, Path path) throws
IOException {
FileSystem outFS = path.getFileSystem(conf);
CompressionCodec codec = new CompressionCodecFactory(conf).getCodec(path);OutputStream output;
Compressor compressor = null;
if (codec ... | 3.26 |
hadoop_Anonymizer_anonymizeTrace_rdh | // anonymize the job trace file
private void anonymizeTrace() throws Exception {
if (anonymizeTrace) {
System.out.println("Anonymizing trace file: " + inputTracePath);
JobTraceReader reader = null;
JsonGenerator outGen = null;
Configuration conf = getConf();
try {
... | 3.26 |
hadoop_Anonymizer_anonymizeTopology_rdh | // anonymize the cluster topology file
private void anonymizeTopology() throws Exception {if (anonymizeTopology) {
System.out.println("Anonymizing topology file: " + f1);
ClusterTopologyReader reader = null;
JsonGenerator outGen = null;
Configuration conf = getConf();
try {
... | 3.26 |
hadoop_FsStatus_getCapacity_rdh | /**
* Return the capacity in bytes of the file system.
*
* @return capacity.
*/
public long getCapacity() {
return capacity;
} | 3.26 |
hadoop_FsStatus_getUsed_rdh | /**
* Return the number of bytes used on the file system.
*
* @return used.
*/
public long getUsed() {
return used;
} | 3.26 |
hadoop_FsStatus_m0_rdh | // ////////////////////////////////////////////////
// Writable
// ////////////////////////////////////////////////
@Override
public void m0(DataOutput out) throws IOException {out.writeLong(capacity);
out.writeLong(used);
out.writeLong(remaining);
} | 3.26 |
hadoop_FsStatus_getRemaining_rdh | /**
* Return the number of remaining bytes on the file system.
*
* @return remaining.
*/
public long getRemaining() {
return remaining;
} | 3.26 |
hadoop_OBSBlockOutputStream_waitForAllPartUploads_rdh | /**
* Block awaiting all outstanding uploads to complete.
*
* @return list of results
* @throws IOException
* IO Problems
*/private List<PartEtag> waitForAllPartUploads() throws IOException {
LOG.debug("Waiting for {} uploads to complete", partETagsFutures.size());
try {
return Futures.allAsList(partETagsFuture... | 3.26 |
hadoop_OBSBlockOutputStream_createBlockIfNeeded_rdh | /**
* Demand create a destination block.
*
* @return the active block; null if there isn't one.
* @throws IOException
* on any failure to create
*/
private synchronized DataBlock createBlockIfNeeded() throws IOException {
if (activeBl... | 3.26 |
hadoop_OBSBlockOutputStream_uploadWriteBlocks_rdh | /**
* Upload block to obs.
*
* @param block
* block
* @param hasBlock
* jungle if has block
* @throws IOException
* io exception
*/
private synchronized void uploadWriteBlocks(final OBSDataBlocks.DataBlock block, final boolean hasBlock) throws IOException {
if (f1 == null) {
if (hasBlock) {
// no upl... | 3.26 |
hadoop_OBSBlockOutputStream_clearHFlushOrSync_rdh | /**
* Clear for hflush or hsync.
*/
private synchronized void clearHFlushOrSync() {
appendAble.set(true);
f1
= null;
} | 3.26 |
hadoop_OBSBlockOutputStream_appendFsFile_rdh | /**
* Append posix file.
*
* @throws IOException
* any problem
*/
private synchronized void
appendFsFile() throws IOException {
LOG.debug("bucket is posix, to append file. key is {}", key);
final OBSDataBlocks.DataBlock block = getActiveBlock();
WriteFileRequest writeFileReq;
if (block instanceof OBSDataBlocks... | 3.26 |
hadoop_OBSBlockOutputStream_abort_rdh | /**
* Abort a multi-part upload. Retries are attempted on failures.
* IOExceptions are caught; this is expected to be run as a cleanup
* process.
*/
void abort() {
String operation = String.format("Aborting multi-part upload for '%s', id '%s", writeOperationHelper, uploadId);
try {
LOG.debug(operation);
writeOperat... | 3.26 |
hadoop_OBSBlockOutputStream_m0_rdh | /**
* Close the stream.
*
* <p>This will not return until the upload is complete or the attempt to
* perform the upload has failed. Exceptions raised in this method are
* indicative that the write has failed and data is at risk of being lost.
*
* @throws IOException
* on any failure.
*/
@Override
public sync... | 3.26 |
hadoop_OBSBlockOutputStream_putObject_rdh | /**
* Upload the current block as a single PUT request; if the buffer is empty a
* 0-byte PUT will be invoked, as it is needed to create an entry at the far
* end.
*
* @throws IOException
* any problem.
*/
private synchronized void putObject() throws IOException {
LOG.debug("Executing regular upload for {}", ... | 3.26 |
hadoop_OBSBlockOutputStream_uploadBlockAsync_rdh | /**
* Upload a block of data asynchronously.
*
* @param block
* block to upload
* @throws IOException
* upload failure
*/
private void uploadBlockAsync(final OBSDataBlocks.DataBlock block) throws IOException {
LOG.debug("Queueing upload of {}", block);
final int size = block.dataSize();
final int currentPart... | 3.26 |
hadoop_OBSBlockOutputStream_complete_rdh | /**
* This completes a multipart upload. Sometimes it fails; here retries are
* handled to avoid losing all data on a transient failure.
*
* @param partETags
* list of partial uploads
* @return result for completing multipart upload
* @throws IOException
* on any problem
*/private CompleteMultipartUploadRe... | 3.26 |
hadoop_OBSBlockOutputStream_putObjectIfNeedAppend_rdh | /**
* If flush has take place, need to append file, else to put object.
*
* @throws IOException
* any problem in append or put object
*/
private synchronized void putObjectIfNeedAppend() throws IOException {
if (appendAble.get() && fs.exists(OBSCommonUtils.keyToQualifiedPath(fs, key))) {appendFsFile();} else... | 3.26 |
hadoop_OBSBlockOutputStream_clearActiveBlock_rdh | /**
* Clear the active block.
*/
private synchronized void clearActiveBlock() {
if
(activeBlock != null) {
LOG.debug("Clearing active block");
}
activeBlock = null;
} | 3.26 |
hadoop_OBSBlockOutputStream_mockPutPartError_rdh | /**
* Set mock error.
*
* @param isException
* mock error
*/
@VisibleForTesting
public void mockPutPartError(final boolean isException) {
this.mockUploadPartError = isException;
} | 3.26 |
hadoop_OBSBlockOutputStream_hasActiveBlock_rdh | /**
* Predicate to query whether or not there is an active block.
*
* @return true if there is an active block.
*/
private synchronized boolean hasActiveBlock() {
return activeBlock != null;
} | 3.26 |
hadoop_OBSBlockOutputStream_checkOpen_rdh | /**
* Check for the filesystem being open.
*
* @throws IOException
* if the filesystem is closed.
*/
private void checkOpen() throws IOException {
if (closed.get()) {
throw new IOException(("Filesystem " + writeOperationHelper.toString(key)) + " closed");
}
} | 3.26 |
hadoop_OBSBlockOutputStream_write_rdh | /**
* Writes a range of bytes from to the memory buffer. If this causes the
* buffer to reach its limit, the actual upload is submitted to the threadpool
* and the remainder of the array is written to memory (recursively).
*
* @param source
* byte array containing
* @param offset
* offset in array where to ... | 3.26 |
hadoop_OBSBlockOutputStream_flush_rdh | /**
* The flush operation does not trigger an upload; that awaits the next block
* being full. What it does do is call {@code flush()} on the current block,
* leaving it to choose how to react.
*
* @throws IOException
* Any IO problem.
*/
@Override
public synchronized void flush() throws IOException {
checkO... | 3.26 |
hadoop_OBSBlockOutputStream_flushOrSync_rdh | /**
* Flush local file or multipart to obs. focus: not posix bucket is not
* support
*
* @throws IOException
* io exception
*/
private synchronized void flushOrSync() throws IOException {
checkOpen();
if
(f0.get()) {
String flushWarning = String.format("flushOrSync has error. bs : pre write obs[%s] has error."... | 3.26 |
hadoop_OBSBlockOutputStream_uploadCurrentBlock_rdh | /**
* Start an asynchronous upload of the current block.
*
* @throws IOException
* Problems opening the destination for upload or
* initializing the upload.
*/
private synchronized void uploadCurrentBlock() throws IOException { Preconditions.checkState(hasActiveBlock(), "No active block");LOG.debug("Writing ... | 3.26 |
hadoop_OBSBlockOutputStream_getActiveBlock_rdh | /**
* Synchronized accessor to the active block.
*
* @return the active block; null if there isn't one.
*/
synchronized DataBlock getActiveBlock() {
return activeBlock;
} | 3.26 |
hadoop_SnappyDecompressor_setInput_rdh | /**
* Sets input data for decompression.
* This should be called if and only if {@link #needsInput()} returns
* <code>true</code> indicating that more input data is required.
* (Both native and non-native versions of various Decompressors require
* that the data passed in via <code>b[]</code> remain unmodified unt... | 3.26 |
hadoop_SnappyDecompressor_setDictionary_rdh | /**
* Does nothing.
*/
@Override
public void setDictionary(byte[] b, int off, int len) {
// do nothing
}
/**
* Returns true if the input data buffer is empty and
* {@link #setInput(byte[], int, int)} should be called to
* provide more input.
*
* @return <code>true</code> if the input data buffer is empty ... | 3.26 |
hadoop_SnappyDecompressor_m0_rdh | /**
* If a write would exceed the capacity of the direct buffers, it is set
* aside to be loaded by this function while the compressed data are
* consumed.
*/
void m0() {
compressedDirectBufLen = Math.min(userBufLen, directBufferSize);
// Reinitialize snappy's input direct buffer
compressedDirectBuf.re... | 3.26 |
hadoop_SnappyDecompressor_end_rdh | /**
* Resets decompressor and input and output buffers so that a new set of
* input data can be processed.
*/
@Override
public void end() {
// do nothing
} | 3.26 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.