idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
12,400 | public long getUsedBytes ( ) throws IOException { try ( CloseableResource < BlockMasterClient > blockMasterClientResource = mContext . acquireBlockMasterClientResource ( ) ) { return blockMasterClientResource . get ( ) . getUsedBytes ( ) ; } } | Gets the used bytes of Alluxio s BlockStore . |
12,401 | public static void addSwiftCredentials ( Configuration configuration ) { PropertyKey [ ] propertyNames = { PropertyKey . SWIFT_API_KEY , PropertyKey . SWIFT_TENANT_KEY , PropertyKey . SWIFT_USER_KEY , PropertyKey . SWIFT_AUTH_URL_KEY , PropertyKey . SWIFT_AUTH_METHOD_KEY , PropertyKey . SWIFT_PASSWORD_KEY , PropertyKey... | Adds Swift keys to the given Hadoop Configuration object if the user has specified them using System properties and they re not already set . |
12,402 | private static void setConfigurationFromSystemProperties ( Configuration configuration , PropertyKey [ ] propertyNames ) { for ( PropertyKey propertyName : propertyNames ) { setConfigurationFromSystemProperty ( configuration , propertyName . toString ( ) ) ; } } | Set the System properties into Hadoop configuration . |
12,403 | private static void setConfigurationFromSystemProperty ( Configuration configuration , String propertyName ) { String propertyValue = System . getProperty ( propertyName ) ; if ( propertyValue != null && configuration . get ( propertyName ) == null ) { configuration . set ( propertyName , propertyValue ) ; } } | Set the System property into Hadoop configuration . |
12,404 | public static void writeTarGz ( Path dirPath , OutputStream output ) throws IOException , InterruptedException { GzipCompressorOutputStream zipStream = new GzipCompressorOutputStream ( output ) ; TarArchiveOutputStream archiveStream = new TarArchiveOutputStream ( zipStream ) ; for ( Path subPath : Files . walk ( dirPat... | Creates a gzipped tar archive from the given path streaming the data to the give output stream . |
12,405 | public static void readTarGz ( Path dirPath , InputStream input ) throws IOException { InputStream zipStream = new GzipCompressorInputStream ( input ) ; TarArchiveInputStream archiveStream = new TarArchiveInputStream ( zipStream ) ; TarArchiveEntry entry ; while ( ( entry = ( TarArchiveEntry ) archiveStream . getNextEn... | Reads a gzipped tar archive from a stream and writes it to the given path . |
12,406 | protected void startMasters ( boolean isLeader ) { try { if ( isLeader ) { if ( ServerConfiguration . isSet ( PropertyKey . MASTER_JOURNAL_INIT_FROM_BACKUP ) ) { AlluxioURI backup = new AlluxioURI ( ServerConfiguration . get ( PropertyKey . MASTER_JOURNAL_INIT_FROM_BACKUP ) ) ; if ( mJournalSystem . isEmpty ( ) ) { ini... | Starts all masters including block master FileSystem master and additional masters . |
12,407 | protected void startServingWebServer ( ) { stopRejectingWebServer ( ) ; mWebServer = new MasterWebServer ( ServiceType . MASTER_WEB . getServiceName ( ) , mWebBindAddress , this ) ; mWebServer . addHandler ( mMetricsServlet . getHandler ( ) ) ; mWebServer . addHandler ( mPMetricsServlet . getHandler ( ) ) ; mWebServer ... | Starts serving web ui server resetting master web port adding the metrics servlet to the web server and starting web ui . |
12,408 | protected void startJvmMonitorProcess ( ) { if ( ServerConfiguration . getBoolean ( PropertyKey . MASTER_JVM_MONITOR_ENABLED ) ) { mJvmPauseMonitor = new JvmPauseMonitor ( ServerConfiguration . getMs ( PropertyKey . JVM_MONITOR_SLEEP_INTERVAL_MS ) , ServerConfiguration . getMs ( PropertyKey . JVM_MONITOR_INFO_THRESHOLD... | Starts jvm monitor process to monitor jvm . |
12,409 | private ObjectListing getObjectListingChunk ( ListObjectsRequest request ) { ObjectListing result ; try { result = mClient . listObjects ( request ) ; } catch ( CosClientException e ) { LOG . error ( "Failed to list path {}" , request . getPrefix ( ) , e ) ; result = null ; } return result ; } | Get next chunk of listing result |
12,410 | private void scanExtensions ( List < T > factories , String extensionsDir ) { LOG . info ( "Loading extension jars from {}" , extensionsDir ) ; scan ( Arrays . asList ( ExtensionUtils . listExtensions ( extensionsDir ) ) , factories ) ; } | Finds all factory from the extensions directory . |
12,411 | private void scanLibs ( List < T > factories , String libDir ) { LOG . info ( "Loading core jars from {}" , libDir ) ; List < File > files = new ArrayList < > ( ) ; try ( DirectoryStream < Path > stream = Files . newDirectoryStream ( Paths . get ( libDir ) , mExtensionPattern ) ) { for ( Path entry : stream ) { if ( en... | Finds all factory from the lib directory . |
12,412 | private void scan ( List < File > files , List < T > factories ) { for ( File jar : files ) { try { URL extensionURL = jar . toURI ( ) . toURL ( ) ; String jarPath = extensionURL . toString ( ) ; ClassLoader extensionsClassLoader = new ExtensionsClassLoader ( new URL [ ] { extensionURL } , ClassLoader . getSystemClassL... | Class - loads jar files that have not been loaded . |
12,413 | public static void writeCSVFile ( Collection < ? extends PropertyKey > defaultKeys , String filePath ) throws IOException { if ( defaultKeys . size ( ) == 0 ) { return ; } FileWriter fileWriter ; Closer closer = Closer . create ( ) ; String [ ] fileNames = { "user-configuration.csv" , "master-configuration.csv" , "work... | Writes property key to csv files . |
12,414 | public static void writeYMLFile ( Collection < ? extends PropertyKey > defaultKeys , String filePath ) throws IOException { if ( defaultKeys . size ( ) == 0 ) { return ; } FileWriter fileWriter ; Closer closer = Closer . create ( ) ; String [ ] fileNames = { "user-configuration.yml" , "master-configuration.yml" , "work... | Writes description of property key to yml files . |
12,415 | public static void main ( String [ ] args ) throws IOException { Collection < ? extends PropertyKey > defaultKeys = PropertyKey . defaultKeys ( ) ; defaultKeys . removeIf ( key -> key . isHidden ( ) ) ; String homeDir = new InstancedConfiguration ( ConfigurationUtils . defaults ( ) ) . get ( PropertyKey . HOME ) ; Stri... | Main entry for this util class . |
12,416 | public static void enableAutoRead ( Channel channel ) { if ( ! channel . config ( ) . isAutoRead ( ) ) { channel . config ( ) . setAutoRead ( true ) ; channel . read ( ) ; } } | Enables auto read for a netty channel . |
12,417 | public static int getConfKey ( String ... args ) { switch ( args . length ) { case 0 : printHelp ( "Missing argument." ) ; return 1 ; case 1 : String varName = args [ 0 ] . trim ( ) ; String propertyName = ENV_VIOLATORS . getOrDefault ( varName , varName . toLowerCase ( ) . replace ( "_" , "." ) ) ; if ( ! PropertyKey ... | Implements get configuration key . |
12,418 | public static void main ( String [ ] args ) { InstancedConfiguration conf = new InstancedConfiguration ( ConfigurationUtils . defaults ( ) ) ; if ( ! ConfigurationUtils . masterHostConfigured ( conf ) && args . length > 0 ) { System . out . println ( ConfigurationUtils . getMasterHostNotConfiguredMessage ( "Alluxio fsa... | Manage Alluxio file system . |
12,419 | public static void main ( String [ ] args ) { System . exit ( getConf ( ClientContext . create ( new InstancedConfiguration ( ConfigurationUtils . defaults ( ) ) ) , args ) ) ; } | Prints Alluxio configuration . |
12,420 | public static void prepareFilePath ( AlluxioURI alluxioPath , String ufsPath , FileSystem fs , UnderFileSystem ufs ) throws AlluxioException , IOException { AlluxioURI dstPath = new AlluxioURI ( ufsPath ) ; String parentPath = dstPath . getParent ( ) . getPath ( ) ; if ( ! ufs . isDirectory ( parentPath ) ) { Stack < P... | Creates parent directories for path with correct permissions if required . |
12,421 | private void evictIfOverLimit ( ) { int numToEvict = mCache . size ( ) - mSoftLimit ; if ( numToEvict <= 0 ) { return ; } if ( mEvictLock . tryLock ( ) ) { try { numToEvict = mCache . size ( ) - mSoftLimit ; while ( numToEvict > 0 ) { if ( ! mIterator . hasNext ( ) ) { mIterator = mCache . entrySet ( ) . iterator ( ) ;... | If the size of the cache exceeds the soft limit and no other thread is evicting entries start evicting entries . |
12,422 | public LockResource get ( K key , LockMode mode ) { ValNode valNode = getValNode ( key ) ; ReentrantReadWriteLock lock = valNode . mValue ; switch ( mode ) { case READ : return new RefCountLockResource ( lock . readLock ( ) , true , valNode . mRefCount ) ; case WRITE : return new RefCountLockResource ( lock . writeLock... | Locks the specified key in the specified mode . |
12,423 | public Optional < LockResource > tryGet ( K key , LockMode mode ) { ValNode valNode = getValNode ( key ) ; ReentrantReadWriteLock lock = valNode . mValue ; Lock innerLock ; switch ( mode ) { case READ : innerLock = lock . readLock ( ) ; break ; case WRITE : innerLock = lock . writeLock ( ) ; break ; default : throw new... | Attempts to take a lock on the given key . |
12,424 | public ReentrantReadWriteLock getRawReadWriteLock ( K key ) { return mCache . getOrDefault ( key , new ValNode ( new ReentrantReadWriteLock ( ) ) ) . mValue ; } | Get the raw readwrite lock from the cache . |
12,425 | public boolean containsKey ( K key ) { Preconditions . checkNotNull ( key , "key can not be null" ) ; return mCache . containsKey ( key ) ; } | Returns whether the cache contains a particular key . |
12,426 | private String calculateChecksum ( AlluxioURI filePath ) throws AlluxioException , IOException { OpenFilePOptions options = OpenFilePOptions . newBuilder ( ) . setReadType ( ReadPType . NO_CACHE ) . build ( ) ; try ( FileInStream fis = mFileSystem . openFile ( filePath , options ) ) { return DigestUtils . md5Hex ( fis ... | Calculates the md5 checksum for a file . |
12,427 | protected void checkVersion ( long clientVersion ) throws IOException { if ( mServiceVersion == Constants . UNKNOWN_SERVICE_VERSION ) { mServiceVersion = getRemoteServiceVersion ( ) ; if ( mServiceVersion != clientVersion ) { throw new IOException ( ExceptionMessage . INCOMPATIBLE_VERSION . getMessage ( getServiceName ... | Checks that the service version is compatible with the client . |
12,428 | public synchronized void connect ( ) throws AlluxioStatusException { if ( mConnected ) { return ; } disconnect ( ) ; Preconditions . checkState ( ! mClosed , "Client is closed, will not try to connect." ) ; IOException lastConnectFailure = null ; RetryPolicy retryPolicy = mRetryPolicySupplier . get ( ) ; while ( retryP... | Connects with the remote . |
12,429 | public synchronized void disconnect ( ) { if ( mConnected ) { Preconditions . checkNotNull ( mChannel , PreconditionMessage . CHANNEL_NULL_WHEN_CONNECTED ) ; LOG . debug ( "Disconnecting from the {} @ {}" , getServiceName ( ) , mAddress ) ; beforeDisconnect ( ) ; mChannel . shutdown ( ) ; mConnected = false ; afterDisc... | Closes the connection with the Alluxio remote and does the necessary cleanup . It should be used if the client has not connected with the remote for a while for example . |
12,430 | public static void main ( String [ ] args ) { if ( args . length != 0 ) { LOG . warn ( "java -cp {} {}" , RuntimeConstants . ALLUXIO_JAR , AlluxioMasterMonitor . class . getCanonicalName ( ) ) ; LOG . warn ( "ignoring arguments" ) ; } AlluxioConfiguration alluxioConf = new InstancedConfiguration ( ConfigurationUtils . ... | Starts the Alluxio master monitor . |
12,431 | public static String formatLsString ( boolean hSize , boolean acl , boolean isFolder , String permission , String userName , String groupName , long size , long lastModifiedTime , int inAlluxioPercentage , String persistenceState , String path , String dateFormatPattern ) { String inAlluxioState ; String sizeStr ; if (... | Formats the ls result string . |
12,432 | private void ls ( AlluxioURI path , boolean recursive , boolean forceLoadMetadata , boolean dirAsFile , boolean hSize , boolean pinnedOnly , String sortField , boolean reverse ) throws AlluxioException , IOException { URIStatus pathStatus = mFileSystem . getStatus ( path ) ; if ( dirAsFile ) { if ( pinnedOnly && ! path... | Displays information for all directories and files directly under the path specified in args . |
12,433 | public boolean isActivelySynced ( AlluxioURI path ) { for ( AlluxioURI syncedPath : mSyncPathList ) { try { if ( PathUtils . hasPrefix ( path . getPath ( ) , syncedPath . getPath ( ) ) ) { return true ; } } catch ( InvalidPathException e ) { return false ; } } return false ; } | Check if a URI is actively synced . |
12,434 | public void start ( ) throws IOException { for ( AlluxioURI syncPoint : mSyncPathList ) { MountTable . Resolution resolution = null ; long mountId = 0 ; try { resolution = mMountTable . resolve ( syncPoint ) ; mountId = resolution . getMountId ( ) ; } catch ( InvalidPathException e ) { LOG . info ( "Invalid Path encoun... | start the polling threads . |
12,435 | public void launchPollingThread ( long mountId , long txId ) { LOG . debug ( "launch polling thread for mount id {}, txId {}" , mountId , txId ) ; if ( ! mPollerMap . containsKey ( mountId ) ) { try ( CloseableResource < UnderFileSystem > ufsClient = mMountTable . getUfsClient ( mountId ) . acquireUfsResource ( ) ) { u... | Launches polling thread on a particular mount point with starting txId . |
12,436 | public void applyAndJournal ( Supplier < JournalContext > context , AddSyncPointEntry entry ) { try { apply ( entry ) ; context . get ( ) . append ( Journal . JournalEntry . newBuilder ( ) . setAddSyncPoint ( entry ) . build ( ) ) ; } catch ( Throwable t ) { ProcessUtils . fatalError ( LOG , t , "Failed to apply %s" , ... | Apply AddSyncPoint entry and journal the entry . |
12,437 | public void stopSyncForMount ( long mountId ) throws InvalidPathException , IOException { LOG . debug ( "Stop sync for mount id {}" , mountId ) ; if ( mFilterMap . containsKey ( mountId ) ) { List < Pair < AlluxioURI , MountTable . Resolution > > toBeDeleted = new ArrayList < > ( ) ; for ( AlluxioURI uri : mFilterMap .... | stop active sync on a mount id . |
12,438 | public MountTable . Resolution resolveSyncPoint ( AlluxioURI syncPoint ) throws InvalidPathException { if ( ! mSyncPathList . contains ( syncPoint ) ) { LOG . debug ( "syncPoint not found {}" , syncPoint . getPath ( ) ) ; return null ; } MountTable . Resolution resolution = mMountTable . resolve ( syncPoint ) ; return ... | Perform various checks of stopping a sync point . |
12,439 | public void stopSyncInternal ( AlluxioURI syncPoint , MountTable . Resolution resolution ) { try ( LockResource r = new LockResource ( mSyncManagerLock ) ) { LOG . debug ( "stop syncPoint {}" , syncPoint . getPath ( ) ) ; RemoveSyncPointEntry removeSyncPoint = File . RemoveSyncPointEntry . newBuilder ( ) . setSyncpoint... | stop active sync on a URI . |
12,440 | public List < SyncPointInfo > getSyncPathList ( ) { List < SyncPointInfo > returnList = new ArrayList < > ( ) ; for ( AlluxioURI uri : mSyncPathList ) { SyncPointInfo . SyncStatus status ; Future < ? > syncStatus = mSyncPathStatus . get ( uri ) ; if ( syncStatus == null ) { status = SyncPointInfo . SyncStatus . NOT_INI... | Get the sync point list . |
12,441 | public void stopSyncPostJournal ( AlluxioURI syncPoint ) throws InvalidPathException { MountTable . Resolution resolution = mMountTable . resolve ( syncPoint ) ; long mountId = resolution . getMountId ( ) ; Future < ? > syncFuture = mSyncPathStatus . remove ( syncPoint ) ; if ( syncFuture != null ) { syncFuture . cance... | Clean up tasks to stop sync point after we have journaled . |
12,442 | public void startSyncPostJournal ( AlluxioURI uri ) throws InvalidPathException { MountTable . Resolution resolution = mMountTable . resolve ( uri ) ; startInitSync ( uri , resolution ) ; launchPollingThread ( resolution . getMountId ( ) , SyncInfo . INVALID_TXID ) ; } | Continue to start sync after we have journaled the operation . |
12,443 | public void recoverFromStopSync ( AlluxioURI uri , long mountId ) { if ( mSyncPathStatus . containsKey ( uri ) ) { return ; } try { MountTable . Resolution resolution = mMountTable . resolve ( uri ) ; startInitSync ( uri , resolution ) ; launchPollingThread ( resolution . getMountId ( ) , SyncInfo . INVALID_TXID ) ; } ... | Recover from a stop sync operation . |
12,444 | public void recoverFromStartSync ( AlluxioURI uri , long mountId ) { if ( mSyncPathStatus . containsKey ( uri ) ) { Future < ? > syncFuture = mSyncPathStatus . remove ( uri ) ; if ( syncFuture != null ) { syncFuture . cancel ( true ) ; } } mFilterMap . remove ( mountId ) ; Future < ? > future = mPollerMap . remove ( mo... | Recover from start sync operation . |
12,445 | public static String convertByteArrayToStringWithoutEscape ( byte [ ] data , int offset , int length ) { StringBuilder sb = new StringBuilder ( length ) ; for ( int i = offset ; i < length && i < data . length ; i ++ ) { sb . append ( ( char ) data [ i ] ) ; } return sb . toString ( ) ; } | Converts a byte array to string . |
12,446 | public static String convertMsToShortClockTime ( long millis ) { Preconditions . checkArgument ( millis >= 0 , "Negative values are not supported" ) ; long days = millis / Constants . DAY_MS ; long hours = ( millis % Constants . DAY_MS ) / Constants . HOUR_MS ; long mins = ( millis % Constants . HOUR_MS ) / Constants .... | Converts milliseconds to short clock time . |
12,447 | List < AlluxioURI > checkConsistency ( AlluxioURI path , CheckConsistencyPOptions options ) throws IOException { FileSystemMasterClient client = mFsContext . acquireMasterClient ( ) ; try { return client . checkConsistency ( path , options ) ; } finally { mFsContext . releaseMasterClient ( client ) ; } } | Checks the consistency of Alluxio metadata against the under storage for all files and directories in a given subtree . |
12,448 | private void runConsistencyCheck ( AlluxioURI path , boolean repairConsistency ) throws AlluxioException , IOException { List < AlluxioURI > inconsistentUris = checkConsistency ( path , FileSystemOptions . checkConsistencyDefaults ( mFsContext . getPathConf ( path ) ) ) ; if ( inconsistentUris . isEmpty ( ) ) { System ... | Checks the inconsistent files and directories which exist in Alluxio but don t exist in the under storage repairs the inconsistent paths by deleting them if repairConsistency is true . |
12,449 | public boolean needPersistence ( long fileId ) { if ( isFilePersisting ( fileId ) || isFilePersisted ( fileId ) ) { return false ; } try { String ufsFingerprint = ufsFingerprint ( fileId ) ; if ( ufsFingerprint != null ) { addPersistedFile ( fileId , ufsFingerprint ) ; return false ; } } catch ( Exception e ) { LOG . w... | Checks if the given file needs persistence . |
12,450 | private synchronized String ufsFingerprint ( long fileId ) throws IOException { FileInfo fileInfo = mBlockWorker . getFileInfo ( fileId ) ; String dstPath = fileInfo . getUfsPath ( ) ; try ( CloseableResource < UnderFileSystem > ufsResource = mUfsManager . get ( fileInfo . getMountId ( ) ) . acquireUfsResource ( ) ) { ... | Returns the ufs fingerprint of the given file or null if the file doesn t exist . |
12,451 | public void lockBlocks ( long fileId , List < Long > blockIds ) throws IOException { Map < Long , Long > blockIdToLockId = new HashMap < > ( ) ; List < Throwable > errors = new ArrayList < > ( ) ; synchronized ( mLock ) { if ( mPersistingInProgressFiles . containsKey ( fileId ) ) { throw new IOException ( "the file " +... | Locks all the blocks of a given file Id . |
12,452 | public void persistFile ( long fileId , List < Long > blockIds ) throws AlluxioException , IOException { Map < Long , Long > blockIdToLockId ; synchronized ( mLock ) { blockIdToLockId = mPersistingInProgressFiles . get ( fileId ) ; if ( blockIdToLockId == null || ! blockIdToLockId . keySet ( ) . equals ( new HashSet < ... | Persists the blocks of a file into the under file system . |
12,453 | private String prepareUfsFilePath ( FileInfo fileInfo , UnderFileSystem ufs ) throws AlluxioException , IOException { AlluxioURI alluxioPath = new AlluxioURI ( fileInfo . getPath ( ) ) ; FileSystem fs = mFileSystemFactory . get ( ) ; URIStatus status = fs . getStatus ( alluxioPath ) ; String ufsPath = status . getUfsPa... | Prepares the destination file path of the given file id . Also creates the parent folder if it does not exist . |
12,454 | public static BlockWorkerInfo getWorkerWithMostBlocks ( List < BlockWorkerInfo > workers , List < FileBlockInfo > fileBlockInfos ) { IndexedSet < BlockWorkerInfo > addressIndexedWorkers = new IndexedSet < > ( WORKER_ADDRESS_INDEX ) ; addressIndexedWorkers . addAll ( workers ) ; ConcurrentMap < BlockWorkerInfo , Integer... | Returns whichever specified worker stores the most blocks from the block info list . |
12,455 | public static void loadBlock ( FileSystem fs , FileSystemContext context , String path , long blockId ) throws AlluxioException , IOException { AlluxioBlockStore blockStore = AlluxioBlockStore . create ( context ) ; String localHostName = NetworkAddressUtils . getConnectHost ( ServiceType . WORKER_RPC , ServerConfigura... | Loads a block into the local worker . If the block doesn t exist in Alluxio it will be read from the UFS . |
12,456 | public void stopAndJoin ( ) { interrupt ( ) ; if ( mServerSocket != null ) { try { mServerSocket . close ( ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } try { join ( 5 * Constants . SECOND_MS ) ; } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; } if ( isAlive ( ... | Stops the server and joins the server thread . |
12,457 | public void initializeRoot ( String owner , String group , Mode mode , JournalContext context ) throws UnavailableException { if ( mState . getRoot ( ) == null ) { MutableInodeDirectory root = MutableInodeDirectory . create ( mDirectoryIdGenerator . getNewDirectoryId ( context ) , NO_PARENT , ROOT_INODE_NAME , CreateDi... | Initializes the root of the inode tree . |
12,458 | public void setDirectChildrenLoaded ( Supplier < JournalContext > context , InodeDirectory dir ) { mState . applyAndJournal ( context , UpdateInodeDirectoryEntry . newBuilder ( ) . setId ( dir . getId ( ) ) . setDirectChildrenLoaded ( true ) . build ( ) ) ; } | Marks an inode directory as having its direct children loaded . |
12,459 | public InodePathPair lockInodePathPair ( AlluxioURI path1 , LockPattern lockPattern1 , AlluxioURI path2 , LockPattern lockPattern2 ) throws InvalidPathException { LockedInodePath lockedPath1 = null ; LockedInodePath lockedPath2 = null ; boolean valid = false ; try { if ( path1 . getPath ( ) . compareTo ( path2 . getPat... | Locks existing inodes on the two specified paths . The two paths will be locked in the correct order . The target inodes are not required to exist . |
12,460 | private void computePathForInode ( InodeView inode , StringBuilder builder ) throws FileDoesNotExistException { long id ; long parentId ; String name ; try ( LockResource lr = mInodeLockManager . lockInode ( inode , LockMode . READ ) ) { id = inode . getId ( ) ; parentId = inode . getParentId ( ) ; name = inode . getNa... | Appends components of the path from a given inode . |
12,461 | public AlluxioURI getPath ( InodeView inode ) throws FileDoesNotExistException { StringBuilder builder = new StringBuilder ( ) ; computePathForInode ( inode , builder ) ; return new AlluxioURI ( builder . toString ( ) ) ; } | Returns the path for a particular inode . The inode and the path to the inode must already be locked . |
12,462 | private static void inheritOwnerAndGroupIfEmpty ( MutableInode < ? > newInode , InodeDirectoryView ancestorInode ) { if ( ServerConfiguration . getBoolean ( PropertyKey . MASTER_METASTORE_INODE_INHERIT_OWNER_AND_GROUP ) && newInode . getOwner ( ) . isEmpty ( ) && newInode . getGroup ( ) . isEmpty ( ) ) { newInode . set... | Inherit owner and group from ancestor if both are empty |
12,463 | public void deleteInode ( RpcContext rpcContext , LockedInodePath inodePath , long opTimeMs ) throws FileDoesNotExistException { Preconditions . checkState ( inodePath . getLockPattern ( ) == LockPattern . WRITE_EDGE ) ; Inode inode = inodePath . getInode ( ) ; mState . applyAndJournal ( rpcContext , DeleteFileEntry . ... | Deletes a single inode from the inode tree by removing it from the parent inode . |
12,464 | public void setPinned ( RpcContext rpcContext , LockedInodePath inodePath , boolean pinned , long opTimeMs ) throws FileDoesNotExistException , InvalidPathException { Preconditions . checkState ( inodePath . getLockPattern ( ) . isWrite ( ) ) ; Inode inode = inodePath . getInode ( ) ; mState . applyAndJournal ( rpcCont... | Sets the pinned state of an inode . If the inode is a directory the pinned state will be set recursively . |
12,465 | public void syncPersistExistingDirectory ( Supplier < JournalContext > context , InodeDirectoryView dir ) throws IOException , InvalidPathException , FileDoesNotExistException { RetryPolicy retry = new ExponentialBackoffRetry ( PERSIST_WAIT_BASE_SLEEP_MS , PERSIST_WAIT_MAX_SLEEP_MS , PERSIST_WAIT_MAX_RETRIES ) ; while ... | Synchronously persists an inode directory to the UFS . If concurrent calls are made only one thread will persist to UFS and the others will wait until it is persisted . |
12,466 | public void syncPersistNewDirectory ( MutableInodeDirectory dir ) throws InvalidPathException , FileDoesNotExistException , IOException { dir . setPersistenceState ( PersistenceState . TO_BE_PERSISTED ) ; syncPersistDirectory ( dir ) . ifPresent ( status -> { dir . setOwner ( status . getOwner ( ) ) . setGroup ( status... | Synchronously persists an inode directory to the UFS . |
12,467 | private Optional < UfsStatus > syncPersistDirectory ( InodeDirectoryView dir ) throws FileDoesNotExistException , IOException , InvalidPathException { AlluxioURI uri = getPath ( dir ) ; MountTable . Resolution resolution = mMountTable . resolve ( uri ) ; String ufsUri = resolution . getUri ( ) . toString ( ) ; try ( Cl... | Persists the directory to the UFS returning the UFS status if the directory is found to already exist in the UFS . |
12,468 | public static void main ( String [ ] args ) { if ( args . length != 0 ) { LOG . info ( "java -cp {} {}" , RuntimeConstants . ALLUXIO_JAR , AlluxioJobWorker . class . getCanonicalName ( ) ) ; System . exit ( - 1 ) ; } if ( ! ConfigurationUtils . masterHostConfigured ( ServerConfiguration . global ( ) ) ) { System . out ... | Starts the Alluxio job worker . |
12,469 | private static void runApplicationMaster ( final CommandLine cliParser , AlluxioConfiguration alluxioConf ) throws Exception { int numWorkers = Integer . parseInt ( cliParser . getOptionValue ( "num_workers" , "1" ) ) ; String masterAddress = cliParser . getOptionValue ( "master_address" ) ; String resourcePath = cliPa... | Run the application master . |
12,470 | public void start ( ) throws IOException , YarnException { if ( UserGroupInformation . isSecurityEnabled ( ) ) { Credentials credentials = UserGroupInformation . getCurrentUser ( ) . getCredentials ( ) ; DataOutputBuffer credentialsBuffer = new DataOutputBuffer ( ) ; credentials . writeTokenStorageToStream ( credential... | Starts the application master . |
12,471 | public void requestAndLaunchContainers ( ) throws Exception { if ( masterExists ( ) ) { InetAddress address = InetAddress . getByName ( mMasterAddress ) ; mMasterContainerNetAddress = address . getHostAddress ( ) ; LOG . info ( "Found master already running on " + mMasterAddress ) ; } else { LOG . info ( "Configuring m... | Submits requests for containers until the master and all workers are launched . |
12,472 | public void stop ( ) { try { mRMClient . unregisterApplicationMaster ( FinalApplicationStatus . SUCCEEDED , "" , "" ) ; } catch ( YarnException e ) { LOG . error ( "Failed to unregister application" , e ) ; } catch ( IOException e ) { LOG . error ( "Failed to unregister application" , e ) ; } mRMClient . stop ( ) ; mYa... | Shuts down the application master unregistering it from Yarn and stopping its clients . |
12,473 | private boolean masterExists ( ) { String webPort = mAlluxioConf . get ( PropertyKey . MASTER_WEB_PORT ) ; try { URL myURL = new URL ( "http://" + mMasterAddress + ":" + webPort + Constants . REST_API_PREFIX + "/master/version" ) ; LOG . debug ( "Checking for master at: " + myURL . toString ( ) ) ; HttpURLConnection co... | Checks if an Alluxio master node is already running or not on the master address given . |
12,474 | private boolean gainPrimacy ( ) throws Exception { AtomicBoolean unstable = new AtomicBoolean ( false ) ; try ( Scoped scoped = mLeaderSelector . onStateChange ( state -> unstable . set ( true ) ) ) { if ( mLeaderSelector . getState ( ) != State . PRIMARY ) { unstable . set ( true ) ; } stopMasters ( ) ; LOG . info ( "... | Upgrades the master to primary mode . |
12,475 | public static long getNumSector ( String requestSize , String sectorSize ) { Double memSize = Double . parseDouble ( requestSize ) ; Double sectorBytes = Double . parseDouble ( sectorSize ) ; Double nSectors = memSize / sectorBytes ; Double memSizeKB = memSize / 1024 ; Double memSizeGB = memSize / ( 1024 * 1024 * 1024 ... | Converts the memory size to number of sectors . |
12,476 | public static void main ( String [ ] args ) { if ( args . length != 2 ) { System . exit ( - 1 ) ; } String mem = args [ 0 ] ; String sector = args [ 1 ] ; try { getNumSector ( mem , sector ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } | The main class to invoke the getNumSector . |
12,477 | private boolean processSinglePath ( AlluxioURI alluxioUri , MountInfo mountInfo ) { PathLock pathLock = new PathLock ( ) ; Lock writeLock = pathLock . writeLock ( ) ; Lock readLock = null ; try { writeLock . lock ( ) ; PathLock existingLock = mCurrentPaths . putIfAbsent ( alluxioUri . getPath ( ) , pathLock ) ; if ( ex... | Processes and checks the existence of the corresponding ufs path for the given Alluxio path . |
12,478 | private List < AlluxioURI > getNestedPaths ( AlluxioURI alluxioUri , int startComponentIndex ) { try { String [ ] fullComponents = PathUtils . getPathComponents ( alluxioUri . getPath ( ) ) ; String [ ] baseComponents = Arrays . copyOfRange ( fullComponents , 0 , startComponentIndex ) ; AlluxioURI uri = new AlluxioURI ... | Returns a sequence of Alluxio paths for a specified path starting from the path component at a specific index to the specified path . |
12,479 | private void copyWildcard ( List < AlluxioURI > srcPaths , AlluxioURI dstPath , boolean recursive ) throws AlluxioException , IOException { URIStatus dstStatus = null ; try { dstStatus = mFileSystem . getStatus ( dstPath ) ; } catch ( FileDoesNotExistException e ) { } if ( dstStatus != null && ! dstStatus . isFolder ( ... | Copies a list of files or directories specified by srcPaths to the destination specified by dstPath . This method is used when the original source path contains wildcards . |
12,480 | private void copy ( AlluxioURI srcPath , AlluxioURI dstPath , boolean recursive ) throws AlluxioException , IOException { URIStatus srcStatus = mFileSystem . getStatus ( srcPath ) ; URIStatus dstStatus = null ; try { dstStatus = mFileSystem . getStatus ( dstPath ) ; } catch ( FileDoesNotExistException e ) { } if ( ! sr... | Copies a file or a directory in the Alluxio filesystem . |
12,481 | private void copyFile ( AlluxioURI srcPath , AlluxioURI dstPath ) throws AlluxioException , IOException { try ( Closer closer = Closer . create ( ) ) { FileInStream is = closer . register ( mFileSystem . openFile ( srcPath ) ) ; FileOutStream os = closer . register ( mFileSystem . createFile ( dstPath ) ) ; try { IOUti... | Copies a file in the Alluxio filesystem . |
12,482 | private void preserveAttributes ( AlluxioURI srcPath , AlluxioURI dstPath ) throws IOException , AlluxioException { if ( mPreservePermissions ) { URIStatus srcStatus = mFileSystem . getStatus ( srcPath ) ; mFileSystem . setAttribute ( dstPath , SetAttributePOptions . newBuilder ( ) . setOwner ( srcStatus . getOwner ( )... | Preserves attributes from the source file to the target file . |
12,483 | private void createDstDir ( AlluxioURI dstPath ) throws AlluxioException , IOException { try { mFileSystem . createDirectory ( dstPath ) ; } catch ( FileAlreadyExistsException e ) { } URIStatus dstStatus = mFileSystem . getStatus ( dstPath ) ; if ( ! dstStatus . isFolder ( ) ) { throw new InvalidPathException ( Excepti... | Creates a directory in the Alluxio filesystem space . It will not throw any exception if the destination directory already exists . |
12,484 | private void asyncCopyLocalPath ( CopyThreadPoolExecutor pool , AlluxioURI srcPath , AlluxioURI dstPath ) throws InterruptedException { File src = new File ( srcPath . getPath ( ) ) ; if ( ! src . isDirectory ( ) ) { pool . submit ( ( ) -> { try { copyFromLocalFile ( srcPath , dstPath ) ; pool . succeed ( srcPath , dst... | Asynchronously copies a file or directory specified by srcPath from the local filesystem to dstPath in the Alluxio filesystem space assuming dstPath does not exist . |
12,485 | private void copyWildcardToLocal ( List < AlluxioURI > srcPaths , AlluxioURI dstPath ) throws AlluxioException , IOException { File dstFile = new File ( dstPath . getPath ( ) ) ; if ( dstFile . exists ( ) && ! dstFile . isDirectory ( ) ) { throw new InvalidPathException ( ExceptionMessage . DESTINATION_CANNOT_BE_FILE .... | Copies a list of files or directories specified by srcPaths from the Alluxio filesystem to dstPath in the local filesystem . This method is used when the input path contains wildcards . |
12,486 | private void copyToLocal ( AlluxioURI srcPath , AlluxioURI dstPath ) throws AlluxioException , IOException { URIStatus srcStatus = mFileSystem . getStatus ( srcPath ) ; File dstFile = new File ( dstPath . getPath ( ) ) ; if ( srcStatus . isFolder ( ) ) { if ( ! dstFile . exists ( ) ) { if ( ! dstFile . mkdirs ( ) ) { t... | Copies a file or a directory from the Alluxio filesystem to the local filesystem . |
12,487 | private void copyFileToLocal ( AlluxioURI srcPath , AlluxioURI dstPath ) throws AlluxioException , IOException { File dstFile = new File ( dstPath . getPath ( ) ) ; String randomSuffix = String . format ( ".%s_copyToLocal_" , RandomStringUtils . randomAlphanumeric ( 8 ) ) ; File outputFile ; if ( dstFile . isDirectory ... | Copies a file specified by argv from the filesystem to the local filesystem . This is the utility function . |
12,488 | public long lockBlock ( long sessionId , long blockId , BlockLockType blockLockType ) { ClientRWLock blockLock = getBlockLock ( blockId ) ; Lock lock ; if ( blockLockType == BlockLockType . READ ) { lock = blockLock . readLock ( ) ; } else { if ( sessionHoldsLock ( sessionId , blockId ) ) { throw new IllegalStateExcept... | Locks a block . Note that even if this block does not exist a lock id is still returned . |
12,489 | private ClientRWLock getBlockLock ( long blockId ) { while ( true ) { ClientRWLock blockLock ; synchronized ( mSharedMapsLock ) { blockLock = mLocks . get ( blockId ) ; if ( blockLock != null ) { blockLock . addReference ( ) ; return blockLock ; } } blockLock = mLockPool . acquire ( 1 , TimeUnit . SECONDS ) ; if ( bloc... | Returns the block lock for the given block id acquiring such a lock if it doesn t exist yet . |
12,490 | public void validateLock ( long sessionId , long blockId , long lockId ) throws BlockDoesNotExistException , InvalidWorkerStateException { synchronized ( mSharedMapsLock ) { LockRecord record = mLockIdToRecordMap . get ( lockId ) ; if ( record == null ) { throw new BlockDoesNotExistException ( ExceptionMessage . LOCK_R... | Validates the lock is hold by the given session for the given block . |
12,491 | public void cleanupSession ( long sessionId ) { synchronized ( mSharedMapsLock ) { Set < Long > sessionLockIds = mSessionIdToLockIdsMap . get ( sessionId ) ; if ( sessionLockIds == null ) { return ; } for ( long lockId : sessionLockIds ) { LockRecord record = mLockIdToRecordMap . get ( lockId ) ; if ( record == null ) ... | Cleans up the locks currently hold by a specific session . |
12,492 | public Set < Long > getLockedBlocks ( ) { synchronized ( mSharedMapsLock ) { Set < Long > set = new HashSet < > ( ) ; for ( LockRecord lockRecord : mLockIdToRecordMap . values ( ) ) { set . add ( lockRecord . getBlockId ( ) ) ; } return set ; } } | Gets a set of currently locked blocks . |
12,493 | private void releaseBlockLockIfUnused ( long blockId ) { synchronized ( mSharedMapsLock ) { ClientRWLock lock = mLocks . get ( blockId ) ; if ( lock == null ) { return ; } if ( lock . dropReference ( ) == 0 ) { mLocks . remove ( blockId ) ; mLockPool . release ( lock ) ; } } } | Checks whether anyone is using the block lock for the given block id returning the lock to the lock pool if it is unused . |
12,494 | public void validate ( ) { synchronized ( mSharedMapsLock ) { ConcurrentMap < Long , AtomicInteger > blockLockReferenceCounts = new ConcurrentHashMap < > ( ) ; for ( LockRecord record : mLockIdToRecordMap . values ( ) ) { blockLockReferenceCounts . putIfAbsent ( record . getBlockId ( ) , new AtomicInteger ( 0 ) ) ; blo... | Checks the internal state of the manager to make sure invariants hold . |
12,495 | public int compareTo ( TtlBucket ttlBucket ) { long startTime1 = getTtlIntervalStartTimeMs ( ) ; long startTime2 = ttlBucket . getTtlIntervalStartTimeMs ( ) ; return Long . compare ( startTime1 , startTime2 ) ; } | Compares this bucket s TTL interval start time to that of another bucket . |
12,496 | private void createHdfsFilesystem ( Configuration conf ) throws Exception { mFileSystem = FileSystem . get ( URI . create ( conf . get ( "fs.defaultFS" ) ) , conf ) ; mOutputFilePath = new Path ( "./MapReduceOutputFile" ) ; if ( mFileSystem . exists ( mOutputFilePath ) ) { mFileSystem . delete ( mOutputFilePath , true ... | Creates the HDFS filesystem to store output files . |
12,497 | private int run ( String [ ] args ) throws Exception { Configuration conf = new Configuration ( ) ; String numMaps = new GenericOptionsParser ( conf , args ) . getRemainingArgs ( ) [ 0 ] ; conf . set ( MRJobConfig . NUM_MAPS , numMaps ) ; createHdfsFilesystem ( conf ) ; Job job = Job . getInstance ( conf , "MapReduceIn... | Implements MapReduce with Alluxio integration checker . |
12,498 | public static void main ( String [ ] args ) throws Exception { MapReduceIntegrationChecker checker = new MapReduceIntegrationChecker ( ) ; System . exit ( checker . run ( args ) ) ; } | Main function will be triggered via hadoop jar . |
12,499 | public void stop ( ) { Preconditions . checkState ( mJvmMonitorThread != null , "JVM monitor thread does not start" ) ; mJvmMonitorThread . interrupt ( ) ; try { mJvmMonitorThread . join ( ) ; } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; } reset ( ) ; } | Stops jvm monitor . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.