private Pair < Boolean , BlockStoreLocation > requestSpaceInternal ( long blockId , long additionalBytes ) throws BlockDoesNotExistException { // NOTE: a temp block is supposed to be visible for its own writer, unnecessary to acquire // block lock here since no sharing try ( LockResource r = new LockResource ( mMetadataWriteLock ) ) { TempBlockMeta tempBlockMeta = mMetaManager . getTempBlockMeta ( blockId ) ; if ( tempBlockMeta . getParentDir ( ) . getAvailableBytes ( ) < additionalBytes ) { return new Pair <> ( false , tempBlockMeta . getBlockLocation ( ) ) ; } // Increase the size of this temp block try { mMetaManager . resizeTempBlockMeta ( tempBlockMeta , tempBlockMeta . getBlockSize ( ) + additionalBytes ) ; } catch ( InvalidWorkerStateException e ) { throw Throwables . propagate ( e ) ; // we shall never reach here } return new Pair <> ( true , null ) ; } }
Increases the temp block size only if this temp block s parent dir has enough available space .