idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
12,200
public synchronized void close ( ) throws IOException { if ( ! mClosed ) { mClosed = true ; if ( mCachingEnabled ) { Factory . FILESYSTEM_CACHE . remove ( new FileSystemKey ( mFsContext . getClientContext ( ) ) ) ; } mFsContext . close ( ) ; } }
Shuts down the FileSystem . Closes all thread pools and resources used to perform operations . If any operations are called after closing the context the behavior is undefined .
12,201
public void onNext ( CreateLocalBlockRequest request ) { final String methodName = request . getOnlyReserveSpace ( ) ? "ReserveSpace" : "CreateBlock" ; RpcUtils . streamingRPCAndLog ( LOG , new RpcUtils . StreamingRpcCallable < CreateLocalBlockResponse > ( ) { public CreateLocalBlockResponse call ( ) throws Exception {...
Handles request to create local block . No exceptions should be thrown .
12,202
public void handleBlockCompleteRequest ( boolean isCanceled ) { final String methodName = isCanceled ? "AbortBlock" : "CommitBlock" ; RpcUtils . streamingRPCAndLog ( LOG , new RpcUtils . StreamingRpcCallable < CreateLocalBlockResponse > ( ) { public CreateLocalBlockResponse call ( ) throws Exception { if ( mRequest == ...
Handles complete block request . No exceptions should be thrown .
12,203
public static Configuration createConfiguration ( UnderFileSystemConfiguration conf ) { Configuration wasbConf = HdfsUnderFileSystem . createConfiguration ( conf ) ; for ( Map . Entry < String , String > entry : conf . toMap ( ) . entrySet ( ) ) { String key = entry . getKey ( ) ; String value = entry . getValue ( ) ; ...
Prepares the configuration for this Wasb as an HDFS configuration .
12,204
public static < U > CompletableFuture < U > supplyAsync ( Supplier < U > supplier , Executor executor ) { return asyncSupplyStage ( screenExecutor ( executor ) , supplier ) ; }
Returns a new CompletableFuture that is asynchronously completed by a task running in the given executor with the value obtained by calling the given Supplier .
12,205
public static CompletableFuture < Void > runAsync ( Runnable runnable , Executor executor ) { return asyncRunStage ( screenExecutor ( executor ) , runnable ) ; }
Returns a new CompletableFuture that is asynchronously completed by a task running in the given executor after it runs the given action .
12,206
public static < U > CompletableFuture < U > completedFuture ( U value ) { return new CompletableFuture < U > ( ( value == null ) ? NIL : value ) ; }
Returns a new CompletableFuture that is already completed with the given value .
12,207
public static CompletableFuture < Object > anyOf ( CompletableFuture < ? > ... cfs ) { int n ; Object r ; if ( ( n = cfs . length ) <= 1 ) return ( n == 0 ) ? new CompletableFuture < Object > ( ) : ( CompletableFuture < Object > ) uniCopyStage ( cfs [ 0 ] ) ; for ( CompletableFuture < ? > cf : cfs ) if ( ( r = cf . res...
Returns a new CompletableFuture that is completed when any of the given CompletableFutures complete with the same result . Otherwise if it completed exceptionally the returned CompletableFuture also does so with a CompletionException holding this exception as its cause . If no CompletableFutures are provided returns an...
12,208
public static < U > CompletableFuture < U > failedFuture ( Throwable ex ) { return new CompletableFuture < U > ( new AltResult ( Objects . requireNonNull ( ex ) ) ) ; }
Returns a new CompletableFuture that is already completed exceptionally with the given exception .
12,209
final boolean tryPushStack ( Completion c ) { Completion h = stack ; lazySetNext ( c , h ) ; return U . compareAndSwapObject ( this , STACK , h , c ) ; }
Returns true if successfully pushed c onto stack .
12,210
final boolean completeValue ( T t ) { return U . compareAndSwapObject ( this , RESULT , null , ( t == null ) ? NIL : t ) ; }
Completes with a non - exceptional result unless already completed .
12,211
final void cleanStack ( ) { boolean unlinked = false ; Completion p ; while ( ( p = stack ) != null && ! p . isLive ( ) ) unlinked = casStack ( p , p . next ) ; if ( p != null && ! unlinked ) { for ( Completion q = p . next ; q != null ; ) { Completion s = q . next ; if ( q . isLive ( ) ) { p = q ; q = s ; } else { cas...
Traverses stack and unlinks one or more dead Completions if found .
12,212
final void unipush ( Completion c ) { if ( c != null ) { while ( ! tryPushStack ( c ) ) { if ( result != null ) { lazySetNext ( c , null ) ; break ; } } if ( result != null ) c . tryFire ( SYNC ) ; } }
Pushes the given completion unless it completes while trying . Caller should first check that result is null .
12,213
final void bipush ( CompletableFuture < ? > b , BiCompletion < ? , ? , ? > c ) { if ( c != null ) { while ( result == null ) { if ( tryPushStack ( c ) ) { if ( b . result == null ) b . unipush ( new CoCompletion ( c ) ) ; else if ( result != null ) c . tryFire ( SYNC ) ; return ; } } b . unipush ( c ) ; } }
Pushes completion to this and b unless both done . Caller should first check that either result or b . result is null .
12,214
final CompletableFuture < T > postFire ( CompletableFuture < ? > a , CompletableFuture < ? > b , int mode ) { if ( b != null && b . stack != null ) { Object r ; if ( ( r = b . result ) == null ) b . cleanStack ( ) ; if ( mode >= 0 && ( r != null || b . result != null ) ) b . postComplete ( ) ; } return postFire ( a , m...
Post - processing after successful BiCompletion tryFire .
12,215
final void orpush ( CompletableFuture < ? > b , BiCompletion < ? , ? , ? > c ) { if ( c != null ) { while ( ! tryPushStack ( c ) ) { if ( result != null ) { lazySetNext ( c , null ) ; break ; } } if ( result != null ) c . tryFire ( SYNC ) ; else b . unipush ( new CoCompletion ( c ) ) ; } }
Pushes completion to this and b unless either done . Caller should first check that result and b . result are both null .
12,216
public T get ( long timeout , TimeUnit unit ) throws InterruptedException , ExecutionException , TimeoutException { long nanos = unit . toNanos ( timeout ) ; Object r ; if ( ( r = result ) == null ) r = timedGet ( nanos ) ; return ( T ) reportGet ( r ) ; }
Waits if necessary for at most the given time for this future to complete and then returns its result if available .
12,217
public int getNumberOfDependents ( ) { int count = 0 ; for ( Completion p = stack ; p != null ; p = p . next ) ++ count ; return count ; }
Returns the estimated number of CompletableFutures whose completions are awaiting completion of this CompletableFuture . This method is designed for use in monitoring system state not for synchronization control .
12,218
public CompletableFuture < T > completeAsync ( Supplier < ? extends T > supplier , Executor executor ) { if ( supplier == null || executor == null ) throw new NullPointerException ( ) ; executor . execute ( new AsyncSupply < T > ( this , supplier ) ) ; return this ; }
Completes this CompletableFuture with the result of the given Supplier function invoked from an asynchronous task using the given executor .
12,219
public CompletableFuture < T > completeOnTimeout ( T value , long timeout , TimeUnit unit ) { Objects . requireNonNull ( unit ) ; if ( result == null ) whenComplete ( new Canceller ( Delayer . delay ( new DelayedCompleter < T > ( this , value ) , timeout , unit ) ) ) ; return this ; }
Completes this CompletableFuture with the given value if not otherwise completed before the given timeout .
12,220
public static void main ( String [ ] args ) { if ( args . length != 0 ) { LOG . info ( "java -cp {} {}" , RuntimeConstants . ALLUXIO_JAR , AlluxioProxy . class . getCanonicalName ( ) ) ; System . exit ( - 1 ) ; } if ( ! ConfigurationUtils . masterHostConfigured ( ServerConfiguration . global ( ) ) ) { ProcessUtils . fa...
Starts the Alluxio proxy .
12,221
public static String toDefault ( String stringEntry ) { if ( stringEntry == null ) { throw new IllegalArgumentException ( "Input acl string is null" ) ; } List < String > components = Arrays . stream ( stringEntry . split ( ":" ) ) . map ( String :: trim ) . collect ( Collectors . toList ( ) ) ; if ( components != null...
Convert a normal ACL to a string representing a default ACL .
12,222
public WorkerNetAddress getWorker ( GetWorkerOptions options ) { Set < WorkerNetAddress > eligibleAddresses = new HashSet < > ( ) ; for ( BlockWorkerInfo info : options . getBlockWorkerInfos ( ) ) { eligibleAddresses . add ( info . getNetAddress ( ) ) ; } WorkerNetAddress address = mBlockLocationCache . get ( options ....
The policy uses the first fetch of worker info list as the base and visits each of them in a round - robin manner in the subsequent calls . The policy doesn t assume the list of worker info in the subsequent calls has the same order from the first and it will skip the workers that are no longer active .
12,223
public static Inode wrap ( InodeView delegate ) { if ( delegate instanceof Inode ) { return ( Inode ) delegate ; } if ( delegate . isFile ( ) ) { Preconditions . checkState ( delegate instanceof InodeFileView ) ; return new InodeFile ( ( InodeFileView ) delegate ) ; } else { Preconditions . checkState ( delegate instan...
Wraps an InodeView providing read - only access . Modifications to the underlying inode will affect the created read - only inode .
12,224
private void validateReadRequest ( alluxio . grpc . ReadRequest request ) throws InvalidArgumentException { if ( request . getBlockId ( ) < 0 ) { throw new InvalidArgumentException ( String . format ( "Invalid blockId (%d) in read request." , request . getBlockId ( ) ) ) ; } if ( request . getOffset ( ) < 0 || request ...
Validates a read request .
12,225
public List < Container > allocateContainers ( ) throws Exception { for ( int attempt = 0 ; attempt < MAX_WORKER_CONTAINER_REQUEST_ATTEMPTS ; attempt ++ ) { LOG . debug ( "Attempt {} of {} to allocate containers" , attempt , MAX_WORKER_CONTAINER_REQUEST_ATTEMPTS ) ; int numContainersToRequest = mTargetNumContainers - m...
Allocates the containers specified by the constructor .
12,226
public static void sleepMs ( Logger logger , long timeMs ) { try { Thread . sleep ( timeMs ) ; } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; if ( logger != null ) { logger . warn ( e . getMessage ( ) , e ) ; } } }
Sleeps for the given number of milliseconds reporting interruptions using the given logger .
12,227
private static boolean validateRemote ( String node , String target , String name , CommandLine cmd ) throws InterruptedException { System . out . format ( "Validating %s environment on %s...%n" , target , node ) ; if ( ! Utils . isAddressReachable ( node , 22 ) ) { System . err . format ( "Unable to reach ssh port 22 ...
validates environment on remote node
12,228
private static boolean validateLocal ( String target , String name , CommandLine cmd ) throws InterruptedException { int validationCount = 0 ; Map < ValidationTask . TaskResult , Integer > results = new HashMap < > ( ) ; Map < String , String > optionsMap = new HashMap < > ( ) ; for ( Option opt : cmd . getOptions ( ) ...
runs validation tasks in local environment
12,229
public static int validate ( String ... argv ) throws InterruptedException { if ( argv . length < 1 ) { printHelp ( "Target not specified." ) ; return - 2 ; } String command = argv [ 0 ] ; String name = null ; String [ ] args ; int argsLength = 0 ; while ( argsLength < argv . length && ! argv [ argsLength ] . startsWit...
Validates environment .
12,230
public static boolean matches ( TieredIdentity . LocalityTier tier , TieredIdentity . LocalityTier otherTier , boolean resolveIpAddress ) { String otherTierName = otherTier . getTierName ( ) ; if ( ! tier . getTierName ( ) . equals ( otherTierName ) ) { return false ; } String otherTierValue = otherTier . getValue ( ) ...
Locality comparison for wire type locality tiers two locality tiers matches if both name and values are equal or for the node tier if the node names resolve to the same IP address .
12,231
public static void main ( String [ ] args ) throws IOException { if ( ! parseInputArgs ( args ) ) { usage ( ) ; System . exit ( EXIT_FAILED ) ; } if ( sHelp ) { usage ( ) ; System . exit ( EXIT_SUCCEEDED ) ; } dumpJournal ( ) ; }
Dumps a ufs journal in human - readable format .
12,232
public static void main ( String [ ] args ) { LOG . info ( "Validating configuration." ) ; try { new InstancedConfiguration ( ConfigurationUtils . defaults ( ) ) . validate ( ) ; LOG . info ( "Configuration is valid." ) ; } catch ( IllegalStateException e ) { LOG . error ( "Configuration is invalid: {}" , e . getMessag...
Console program that validates the configuration .
12,233
public static void main ( String [ ] args ) { ExtensionsShell extensionShell = new ExtensionsShell ( ServerConfiguration . global ( ) ) ; System . exit ( extensionShell . run ( args ) ) ; }
Manage Alluxio extensions .
12,234
public static void run ( JobConfig config , int attempts , AlluxioConfiguration alluxioConf ) throws InterruptedException { CountingRetry retryPolicy = new CountingRetry ( attempts ) ; while ( retryPolicy . attempt ( ) ) { long jobId ; try ( JobMasterClient client = JobMasterClient . Factory . create ( JobMasterClientC...
Runs the specified job and waits for it to finish . If the job fails it is retried the given number of times . If the job does not complete in the given number of attempts an exception is thrown .
12,235
public static Thread createProgressThread ( final long intervalMs , final PrintStream stream ) { Thread thread = new Thread ( new Runnable ( ) { public void run ( ) { while ( true ) { CommonUtils . sleepMs ( intervalMs ) ; if ( Thread . interrupted ( ) ) { return ; } stream . print ( "." ) ; } } } ) ; thread . setDaemo...
Creates a thread which will write . to the given print stream at the given interval . The created thread is not started by this method . The created thread will be daemonic and will halt when interrupted .
12,236
private int getNextAvailDirInTier ( StorageTierView tierView , long blockSize ) { int dirViewIndex = mTierAliasToLastDirMap . get ( tierView . getTierViewAlias ( ) ) ; for ( int i = 0 ; i < tierView . getDirViews ( ) . size ( ) ; i ++ ) { dirViewIndex = ( dirViewIndex + 1 ) % tierView . getDirViews ( ) . size ( ) ; if ...
Finds an available dir in a given tier for a block with blockSize .
12,237
private TempBlockMeta createBlockMetaInternal ( long sessionId , long blockId , BlockStoreLocation location , long initialBlockSize , boolean newBlock ) throws BlockAlreadyExistsException { try ( LockResource r = new LockResource ( mMetadataWriteLock ) ) { if ( newBlock ) { checkTempBlockIdAvailable ( blockId ) ; } Sto...
Creates a temp block meta only if allocator finds available space . This method will not trigger any eviction .
12,238
private Pair < Boolean , BlockStoreLocation > requestSpaceInternal ( long blockId , long additionalBytes ) throws BlockDoesNotExistException { try ( LockResource r = new LockResource ( mMetadataWriteLock ) ) { TempBlockMeta tempBlockMeta = mMetaManager . getTempBlockMeta ( blockId ) ; if ( tempBlockMeta . getParentDir ...
Increases the temp block size only if this temp block s parent dir has enough available space .
12,239
private void removeBlockInternal ( long sessionId , long blockId , BlockStoreLocation location ) throws InvalidWorkerStateException , BlockDoesNotExistException , IOException { long lockId = mLockManager . lockBlock ( sessionId , blockId , BlockLockType . WRITE ) ; try { String filePath ; BlockMeta blockMeta ; try ( Lo...
Removes a block .
12,240
public void updatePinnedInodes ( Set < Long > inodes ) { LOG . debug ( "updatePinnedInodes: inodes={}" , inodes ) ; synchronized ( mPinnedInodes ) { mPinnedInodes . clear ( ) ; mPinnedInodes . addAll ( Preconditions . checkNotNull ( inodes ) ) ; } }
Updates the pinned blocks .
12,241
public void removeDir ( StorageDir dir ) { try ( LockResource r = new LockResource ( mMetadataWriteLock ) ) { String tierAlias = dir . getParentTier ( ) . getTierAlias ( ) ; dir . getParentTier ( ) . removeStorageDir ( dir ) ; synchronized ( mBlockStoreEventListeners ) { for ( BlockStoreEventListener listener : mBlockS...
Removes a storage directory .
12,242
public void remove ( PropertyKey key ) { if ( mUserProps . containsKey ( key ) ) { mUserProps . remove ( key ) ; mSources . remove ( key ) ; } }
Remove the value set for key .
12,243
public boolean isSet ( PropertyKey key ) { if ( isSetByUser ( key ) ) { return true ; } return PropertyKey . fromString ( key . toString ( ) ) . getDefaultValue ( ) != null ; }
Checks if there is a value set for the given key .
12,244
public void forEach ( BiConsumer < ? super PropertyKey , ? super String > action ) { for ( Map . Entry < PropertyKey , String > entry : entrySet ( ) ) { action . accept ( entry . getKey ( ) , entry . getValue ( ) ) ; } }
Iterates over all the key value pairs and performs the given action .
12,245
public void setSource ( PropertyKey key , Source source ) { mSources . put ( key , source ) ; }
Sets the source for a given key .
12,246
public void record ( String metric , double value ) { mTimeSeries . compute ( metric , ( metricName , timeSeries ) -> { if ( timeSeries == null ) { timeSeries = new TimeSeries ( metricName ) ; } timeSeries . record ( value ) ; return timeSeries ; } ) ; }
Records a value for the given metric at the current time .
12,247
public void release ( InputStream inputStream ) throws IOException { if ( ! ( inputStream instanceof CachedSeekableInputStream ) || ! CACHE_ENABLED ) { inputStream . close ( ) ; return ; } synchronized ( mFileIdToInputStreamIds ) { if ( ! mFileIdToInputStreamIds . containsKey ( ( ( CachedSeekableInputStream ) inputStre...
Releases an input stream . The input stream is closed if it s already expired .
12,248
public void invalidate ( CachedSeekableInputStream inputStream ) throws IOException { mUnderFileInputStreamCache . invalidate ( inputStream . getResourceId ( ) ) ; release ( inputStream ) ; }
Invalidates an input stream from the cache .
12,249
public InputStream acquire ( UnderFileSystem ufs , String path , long fileId , OpenOptions openOptions ) throws IOException { return acquire ( ufs , path , fileId , openOptions , true ) ; }
Acquires an input stream . For seekable input streams if there is an available input stream in the cache reuse it and repositions the offset otherwise the manager opens a new input stream .
12,250
public InputStream acquire ( UnderFileSystem ufs , String path , long fileId , OpenOptions openOptions , boolean reuse ) throws IOException { if ( ! ufs . isSeekable ( ) || ! CACHE_ENABLED ) { return ufs . openExistingFile ( path , openOptions ) ; } mUnderFileInputStreamCache . cleanUp ( ) ; UfsInputStreamIdSet resourc...
Acquires an input stream . For seekable input streams if there is an available input stream in the cache and reuse mode is specified reuse it and repositions the offset otherwise the manager opens a new input stream .
12,251
public void heartbeat ( ) { MetaCommand command = null ; try { if ( mMasterId . get ( ) == UNINITIALIZED_MASTER_ID ) { setIdAndRegister ( ) ; } command = mMasterClient . heartbeat ( mMasterId . get ( ) ) ; handleCommand ( command ) ; } catch ( IOException e ) { if ( command == null ) { LOG . error ( "Failed to receive ...
Heartbeats to the leader master node .
12,252
private void handleCommand ( MetaCommand cmd ) throws IOException { if ( cmd == null ) { return ; } switch ( cmd ) { case MetaCommand_Nothing : break ; case MetaCommand_Register : setIdAndRegister ( ) ; break ; case MetaCommand_Unknown : LOG . error ( "Master heartbeat sends unknown command {}" , cmd ) ; break ; defaul...
Handles a leader master command .
12,253
private void setIdAndRegister ( ) throws IOException { mMasterId . set ( mMasterClient . getId ( mMasterAddress ) ) ; mMasterClient . register ( mMasterId . get ( ) , ConfigurationUtils . getConfiguration ( ServerConfiguration . global ( ) , Scope . MASTER ) ) ; }
Sets the master id and registers with the Alluxio leader master .
12,254
private StorageDirView getCandidateDirInTier ( StorageTierView tierView , long blockSize ) { StorageDirView candidateDirView = null ; long maxFreeBytes = blockSize - 1 ; for ( StorageDirView dirView : tierView . getDirViews ( ) ) { if ( dirView . getAvailableBytes ( ) > maxFreeBytes ) { maxFreeBytes = dirView . getAvai...
Finds a directory view in a tier view that has max free space and is able to store the block .
12,255
public void removeStorageDir ( StorageDir dir ) { if ( mDirs . remove ( dir ) ) { mCapacityBytes -= dir . getCapacityBytes ( ) ; } mLostStorage . add ( dir . getDirPath ( ) ) ; }
Removes a directory .
12,256
public static < T > Response call ( RestUtils . RestCallable < T > callable , AlluxioConfiguration alluxioConf ) { return call ( callable , alluxioConf , null ) ; }
Call response .
12,257
public static Response . ResponseBuilder makeCORS ( Response . ResponseBuilder responseBuilder , String returnMethod ) { Response . ResponseBuilder rb = responseBuilder . header ( "Access-Control-Allow-Origin" , "*" ) . header ( "Access-Control-Allow-Methods" , "GET, POST, OPTIONS" ) ; if ( ! "" . equals ( returnMethod...
Makes the responseBuilder CORS compatible .
12,258
private void startMaster ( ) throws IOException , ConnectionFailedException { mMaster = AlluxioJobMasterProcess . Factory . create ( ) ; ServerConfiguration . set ( PropertyKey . JOB_MASTER_RPC_PORT , String . valueOf ( mMaster . getRpcAddress ( ) . getPort ( ) ) ) ; Runnable runMaster = new Runnable ( ) { public void ...
Runs a master .
12,259
private void startWorker ( ) throws IOException , ConnectionFailedException { mWorker = JobWorkerProcess . Factory . create ( ) ; Runnable runWorker = new Runnable ( ) { public void run ( ) { try { mWorker . start ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e + " \n Start Worker Error \n" + e . getMess...
Runs a worker .
12,260
public void setEntry ( AclEntry entry ) { switch ( entry . getType ( ) ) { case NAMED_USER : mNamedUserActions . put ( entry . getSubject ( ) , entry . getActions ( ) ) ; return ; case NAMED_GROUP : mNamedGroupActions . put ( entry . getSubject ( ) , entry . getActions ( ) ) ; return ; case MASK : mMaskActions = entry ...
Sets an entry into the access control list . If an entry with the same type and subject already exists overwrites the existing entry ; Otherwise adds this new entry .
12,261
public void updateMask ( AclActions groupActions ) { AclActions result = new AclActions ( groupActions ) ; for ( Map . Entry < String , AclActions > kv : mNamedUserActions . entrySet ( ) ) { AclActions userAction = kv . getValue ( ) ; result . merge ( userAction ) ; for ( AclAction action : AclAction . values ( ) ) { i...
Update the mask to be the union of owning group entry named user entry and named group entry .
12,262
private Status run ( JavaSparkContext sc , PrintWriter reportWriter , AlluxioConfiguration conf ) { Status driverStatus = CheckerUtils . performIntegrationChecks ( ) ; String driverAddress = sc . getConf ( ) . get ( "spark.driver.host" ) ; switch ( driverStatus ) { case FAIL_TO_FIND_CLASS : reportWriter . printf ( "Spa...
Implements Spark with Alluxio integration checker .
12,263
private Status runSparkJob ( JavaSparkContext sc , PrintWriter reportWriter ) { List < Integer > nums = IntStream . rangeClosed ( 1 , mPartitions ) . boxed ( ) . collect ( Collectors . toList ( ) ) ; JavaRDD < Integer > dataSet = sc . parallelize ( nums , mPartitions ) ; JavaPairRDD < Status , String > extractedStatus ...
Spark job to check whether Spark executors can recognize Alluxio filesystem .
12,264
private void printConfigInfo ( SparkConf conf , PrintWriter reportWriter ) { if ( conf . contains ( "spark.master" ) ) { reportWriter . printf ( "Spark master is: %s.%n%n" , conf . get ( "spark.master" ) ) ; } if ( conf . contains ( "spark.submit.deployMode" ) ) { reportWriter . printf ( "spark-submit deploy mode is: %...
Saves related Spark and Alluxio configuration information .
12,265
private void printResultInfo ( Status resultStatus , PrintWriter reportWriter ) { switch ( resultStatus ) { case FAIL_TO_FIND_CLASS : reportWriter . println ( FAIL_TO_FIND_CLASS_MESSAGE ) ; reportWriter . println ( TEST_FAILED_MESSAGE ) ; break ; case FAIL_TO_FIND_FS : reportWriter . println ( FAIL_TO_FIND_FS_MESSAGE )...
Saves Spark with Alluixo integration checker results .
12,266
public static void main ( String [ ] args ) throws Exception { AlluxioConfiguration alluxioConf = new InstancedConfiguration ( ConfigurationUtils . defaults ( ) ) ; SparkIntegrationChecker checker = new SparkIntegrationChecker ( ) ; JCommander jCommander = new JCommander ( checker , args ) ; jCommander . setProgramName...
Main function will be triggered via spark - submit .
12,267
private static AlluxioFuseOptions parseOptions ( String [ ] args , AlluxioConfiguration alluxioConf ) { final Options opts = new Options ( ) ; final Option mntPoint = Option . builder ( "m" ) . hasArg ( ) . required ( true ) . longOpt ( "mount-point" ) . desc ( "Desired local mount point for alluxio-fuse." ) . build ( ...
Parses CLI options .
12,268
public void add ( T payload , List < T > parents ) { Preconditions . checkState ( ! contains ( payload ) , "the payload already exists in the DAG" ) ; DirectedAcyclicGraphNode < T > newNode = new DirectedAcyclicGraphNode < > ( payload ) ; mIndex . put ( payload , newNode ) ; if ( parents . isEmpty ( ) ) { mRoots . add ...
Adds a node to the DAG that takes the given payload and depends on the specified parents .
12,269
public void deleteLeaf ( T payload ) { Preconditions . checkState ( contains ( payload ) , "the node does not exist" ) ; DirectedAcyclicGraphNode < T > node = mIndex . get ( payload ) ; Preconditions . checkState ( node . getChildren ( ) . isEmpty ( ) , "the node is not a leaf" ) ; for ( DirectedAcyclicGraphNode < T > ...
Deletes a leaf DAG node that carries the given payload .
12,270
public List < T > getChildren ( T payload ) { List < T > children = new ArrayList < > ( ) ; if ( ! mIndex . containsKey ( payload ) ) { return children ; } DirectedAcyclicGraphNode < T > node = mIndex . get ( payload ) ; for ( DirectedAcyclicGraphNode < T > child : node . getChildren ( ) ) { children . add ( child . ge...
Gets the payloads for the children of the given node .
12,271
public List < T > getParents ( T payload ) { List < T > parents = new ArrayList < > ( ) ; if ( ! mIndex . containsKey ( payload ) ) { return parents ; } DirectedAcyclicGraphNode < T > node = mIndex . get ( payload ) ; for ( DirectedAcyclicGraphNode < T > parent : node . getParents ( ) ) { parents . add ( parent . getPa...
Gets the payloads for the given nodes parents .
12,272
public boolean isRoot ( T payload ) { if ( ! contains ( payload ) ) { return false ; } return mRoots . contains ( mIndex . get ( payload ) ) ; }
Checks if a given payload is in a root of the DAG .
12,273
public List < T > getRoots ( ) { List < T > roots = new ArrayList < > ( ) ; for ( DirectedAcyclicGraphNode < T > root : mRoots ) { roots . add ( root . getPayload ( ) ) ; } return roots ; }
Gets the payloads of all the root nodes of the DAG .
12,274
public List < T > sortTopologically ( Set < T > payloads ) { List < T > result = new ArrayList < > ( ) ; Set < T > input = new HashSet < > ( payloads ) ; Deque < DirectedAcyclicGraphNode < T > > toVisit = new ArrayDeque < > ( mRoots ) ; while ( ! toVisit . isEmpty ( ) ) { DirectedAcyclicGraphNode < T > visit = toVisit ...
Sorts a given set of payloads topologically based on the DAG . This method requires all the payloads to be in the DAG .
12,275
private < ReqT , RespT > boolean authenticateCall ( ServerCall < ReqT , RespT > call , Metadata headers ) { if ( call . isCancelled ( ) ) { LOG . debug ( "Server call has been cancelled: %s" , call . getMethodDescriptor ( ) . getFullMethodName ( ) ) ; return false ; } UUID channelId = headers . get ( ChannelIdInjector ...
Authenticates given call against auth - server state . Fails the call if it s not originating from an authenticated client channel . It sets thread - local authentication information for the call with the user information that is kept on auth - server .
12,276
public int run ( ) throws IOException { List < WorkerLostStorageInfo > workerLostStorageList = mBlockMasterClient . getWorkerLostStorage ( ) ; if ( workerLostStorageList . size ( ) == 0 ) { mPrintStream . println ( "All worker storage paths are in working state." ) ; return 0 ; } for ( WorkerLostStorageInfo info : work...
Runs doctor storage command .
12,277
private void setReplication ( AlluxioURI path , Integer replicationMax , Integer replicationMin , boolean recursive ) throws AlluxioException , IOException { SetAttributePOptions . Builder optionsBuilder = SetAttributePOptions . newBuilder ( ) . setRecursive ( recursive ) ; String message = "Changed the replication lev...
Changes the replication level of directory or file with the path specified in args .
12,278
public static void limitLife ( final long lifetimeMs ) { new Thread ( ( ) -> { CommonUtils . sleepMs ( lifetimeMs ) ; LOG . info ( "Process has timed out after {}ms, exiting now" , lifetimeMs ) ; System . exit ( - 1 ) ; } , "life-limiter" ) . start ( ) ; }
Launches a thread to terminate the current process after the specified period has elapsed .
12,279
public MasterWebUIMetrics setUfsOps ( Map < String , Map < String , Long > > UfsOps ) { mUfsOps = UfsOps ; return this ; }
Sets ufs ops .
12,280
private void catchUp ( JournalStateMachine stateMachine , CopycatClient client ) throws TimeoutException , InterruptedException { long startTime = System . currentTimeMillis ( ) ; CommonUtils . waitFor ( "snapshotting to finish" , ( ) -> ! stateMachine . isSnapshotting ( ) , WaitForOptions . defaults ( ) . setTimeoutMs...
Attempts to catch up . If the master loses leadership during this method it will return early .
12,281
public static void main ( String [ ] argv ) throws IOException { int ret ; InstancedConfiguration conf = new InstancedConfiguration ( ConfigurationUtils . defaults ( ) ) ; if ( ! ConfigurationUtils . masterHostConfigured ( conf ) && argv . length > 0 ) { System . out . println ( ConfigurationUtils . getMasterHostNotCon...
Main method starts a new JobShell .
12,282
private void lockInodeInternal ( Inode inode , LockMode mode ) { Preconditions . checkState ( ! endsInInode ( ) ) ; String lastEdgeName = ( ( EdgeEntry ) lastEntry ( ) ) . getEdge ( ) . getName ( ) ; Preconditions . checkState ( inode . getName ( ) . equals ( lastEdgeName ) , "Expected to lock inode %s but locked inode...
Locks the next inode without checking or updating the mode .
12,283
public void lockEdge ( String childName , LockMode mode ) { Preconditions . checkState ( endsInInode ( ) ) ; Preconditions . checkState ( mLockMode == LockMode . READ ) ; lockEdgeInternal ( childName , mode ) ; mLockMode = mode ; }
Locks an edge leading out of the last inode in the list .
12,284
public void lockEdgeInternal ( String childName , LockMode mode ) { Preconditions . checkState ( endsInInode ( ) ) ; Inode lastInode = get ( numLockedInodes ( ) - 1 ) ; Edge edge = new Edge ( lastInode . getId ( ) , childName ) ; mEntries . add ( new EdgeEntry ( mInodeLockManager . lockEdge ( edge , mode ) , edge ) ) ;...
Locks the next edge without checking or updating the mode .
12,285
public void lockRootEdge ( LockMode mode ) { Preconditions . checkState ( mEntries . isEmpty ( ) ) ; mEntries . add ( new EdgeEntry ( mInodeLockManager . lockEdge ( ROOT_EDGE , mode ) , ROOT_EDGE ) ) ; mLockMode = mode ; }
Locks the root edge in the specified mode .
12,286
public void pushWriteLockedEdge ( Inode inode , String childName ) { Preconditions . checkState ( ! endsInInode ( ) ) ; Preconditions . checkState ( mLockMode == LockMode . WRITE ) ; if ( mEntries . isEmpty ( ) ) { return ; } int edgeIndex = mEntries . size ( ) - 1 ; lockInodeInternal ( inode , LockMode . READ ) ; lock...
Leapfrogs the edge write lock forward reducing the lock list s write - locked scope .
12,287
public void unlockLastInode ( ) { Preconditions . checkState ( endsInInode ( ) ) ; Preconditions . checkState ( ! mEntries . isEmpty ( ) ) ; mLockedInodes . remove ( mLockedInodes . size ( ) - 1 ) ; mEntries . remove ( mEntries . size ( ) - 1 ) . mLock . close ( ) ; mLockMode = LockMode . READ ; }
Unlocks the last locked inode .
12,288
public void downgradeLastInode ( ) { Preconditions . checkState ( endsInInode ( ) ) ; Preconditions . checkState ( ! mEntries . isEmpty ( ) ) ; Preconditions . checkState ( mLockMode == LockMode . WRITE ) ; InodeEntry last = ( InodeEntry ) mEntries . get ( mEntries . size ( ) - 1 ) ; LockResource lock = mInodeLockManag...
Downgrades the last inode from a write lock to a read lock . The read lock is acquired before releasing the write lock .
12,289
public void downgradeLastEdge ( ) { Preconditions . checkNotNull ( ! endsInInode ( ) ) ; Preconditions . checkState ( ! mEntries . isEmpty ( ) ) ; Preconditions . checkState ( mLockMode == LockMode . WRITE ) ; downgradeEdge ( mEntries . size ( ) - 1 ) ; mLockMode = LockMode . READ ; }
Downgrades the last edge lock in the lock list from WRITE lock to READ lock .
12,290
public void downgradeEdgeToInode ( Inode inode , LockMode mode ) { Preconditions . checkState ( ! endsInInode ( ) ) ; Preconditions . checkState ( ! mEntries . isEmpty ( ) ) ; Preconditions . checkState ( mLockMode == LockMode . WRITE ) ; EdgeEntry last = ( EdgeEntry ) mEntries . get ( mEntries . size ( ) - 1 ) ; LockR...
Downgrades from edge write - locking to inode write - locking . This reduces the scope of the write lock by pushing it forward one entry .
12,291
private void downgradeEdge ( int edgeEntryIndex ) { EdgeEntry entry = ( EdgeEntry ) mEntries . get ( edgeEntryIndex ) ; LockResource lock = mInodeLockManager . lockEdge ( entry . mEdge , LockMode . READ ) ; entry . getLock ( ) . close ( ) ; mEntries . set ( edgeEntryIndex , new EdgeEntry ( lock , entry . getEdge ( ) ) ...
Downgrades the edge at the specified entry index .
12,292
public static boolean hasWindowsDrive ( String path , boolean slashed ) { int start = slashed ? 1 : 0 ; return path . length ( ) >= start + 2 && ( ! slashed || path . charAt ( 0 ) == '/' ) && path . charAt ( start + 1 ) == ':' && ( ( path . charAt ( start ) >= 'A' && path . charAt ( start ) <= 'Z' ) || ( path . charAt ...
Checks if the path is a windows path . This should be platform independent .
12,293
public boolean isAncestorOf ( AlluxioURI alluxioURI ) throws InvalidPathException { if ( ! Objects . equals ( getAuthority ( ) , alluxioURI . getAuthority ( ) ) ) { return false ; } if ( ! Objects . equals ( getScheme ( ) , alluxioURI . getScheme ( ) ) ) { return false ; } return PathUtils . hasPrefix ( PathUtils . nor...
Returns true if the current AlluxioURI is an ancestor of another AlluxioURI . otherwise return false .
12,294
private void ensureReserved ( long pos ) throws IOException { if ( pos <= mPosReserved ) { return ; } long toReserve = Math . max ( pos - mPosReserved , mFileBufferBytes ) ; CreateLocalBlockRequest request = mCreateRequest . toBuilder ( ) . setSpaceToReserve ( toReserve ) . setOnlyReserveSpace ( true ) . build ( ) ; mS...
Reserves enough space in the block worker .
12,295
public static void logLevel ( String [ ] args , AlluxioConfiguration alluxioConf ) throws ParseException , IOException { CommandLineParser parser = new DefaultParser ( ) ; CommandLine cmd = parser . parse ( OPTIONS , args , true ) ; List < TargetInfo > targets = parseOptTarget ( cmd , alluxioConf ) ; String logName = p...
Implements log level setting and getting .
12,296
public static void main ( String [ ] args ) { int exitCode = 1 ; try { logLevel ( args , new InstancedConfiguration ( ConfigurationUtils . defaults ( ) ) ) ; exitCode = 0 ; } catch ( ParseException e ) { printHelp ( "Unable to parse input args: " + e . getMessage ( ) ) ; } catch ( IOException e ) { e . printStackTrace ...
Sets or gets log level of master and worker through their REST API .
12,297
public void validate ( ) { Preconditions . checkState ( getMaxLogSize ( ) <= Integer . MAX_VALUE , "{} has value {} but must not exceed {}" , PropertyKey . MASTER_JOURNAL_LOG_SIZE_BYTES_MAX , getMaxLogSize ( ) , Integer . MAX_VALUE ) ; Preconditions . checkState ( getHeartbeatIntervalMs ( ) < getElectionTimeoutMs ( ) /...
Validates the configuration .
12,298
public List < String > getGroups ( String user ) throws IOException { if ( ! mCacheEnabled ) { return mService . getGroups ( user ) ; } try { return mCache . get ( user ) ; } catch ( ExecutionException e ) { throw new IOException ( e ) ; } }
Gets a list of groups for the given user .
12,299
public synchronized void registerNewConf ( Address address , List < ConfigProperty > configList ) { Preconditions . checkNotNull ( address , "address should not be null" ) ; Preconditions . checkNotNull ( configList , "configuration list should not be null" ) ; mConfMap . put ( address , configList . stream ( ) . map (...
Registers new configuration information .