private void updateBlockWriter(long offset) throws IOException {
    if (mBlockWriter != null && offset > mBlockWriter.getPosition()) {
      cancelBlockWriter();
    }
    try {
      if (mBlockWriter == null && offset == 0 && !mBlockMeta.isNoCache()) {
        BlockStoreLocation loc = BlockStoreLocation.anyDirInTier(mStorageTierAssoc.getAlias(0));
        mLocalBlockStore.createBlock(mBlockMeta.getSessionId(), mBlockMeta.getBlockId(), loc,
            mInitialBlockSize);
        mBlockWriter = mLocalBlockStore.getBlockWriter(
            mBlockMeta.getSessionId(), mBlockMeta.getBlockId());
      }
    } catch (BlockAlreadyExistsException e) {
      // This can happen when there are concurrent UFS readers who are all trying to cache to block.
      LOG.debug(
          "Failed to update block writer for UFS block [blockId: {}, ufsPath: {}, offset: {}]."
              + "Concurrent UFS readers may be caching the same block.",
          mBlockMeta.getBlockId(), mBlockMeta.getUnderFileSystemPath(), offset, e);
      mBlockWriter = null;
    } catch (IOException | AlluxioException e) {
      LOG.warn(
          "Failed to update block writer for UFS block [blockId: {}, ufsPath: {}, offset: {}]: {}",
          mBlockMeta.getBlockId(), mBlockMeta.getUnderFileSystemPath(), offset, e.getMessage());
      mBlockWriter = null;
    }
  }
private void updateBlockWriter ( long offset ) throws IOException { if ( mBlockWriter != null && offset > mBlockWriter . getPosition ( ) ) { cancelBlockWriter ( ) ; } try { if ( mBlockWriter == null && offset == 0 && ! mBlockMeta . isNoCache ( ) ) { BlockStoreLocation loc = BlockStoreLocation . anyDirInTier ( mStorageTierAssoc . getAlias ( 0 ) ) ; mLocalBlockStore . createBlock ( mBlockMeta . getSessionId ( ) , mBlockMeta . getBlockId ( ) , loc , mInitialBlockSize ) ; mBlockWriter = mLocalBlockStore . getBlockWriter ( mBlockMeta . getSessionId ( ) , mBlockMeta . getBlockId ( ) ) ; } } catch ( BlockAlreadyExistsException e ) { LOG . debug ( "Failed to update block writer for UFS block [blockId: {}, ufsPath: {}, offset: {}]." + "Concurrent UFS readers may be caching the same block." , mBlockMeta . getBlockId ( ) , mBlockMeta . getUnderFileSystemPath ( ) , offset , e ) ; mBlockWriter = null ; } catch ( IOException | AlluxioException e ) { LOG . warn ( "Failed to update block writer for UFS block [blockId: {}, ufsPath: {}, offset: {}]: {}" , mBlockMeta . getBlockId ( ) , mBlockMeta . getUnderFileSystemPath ( ) , offset , e . getMessage ( ) ) ; mBlockWriter = null ; } }
Updates the block writer given an offset to read. If the offset is beyond the current
position of the block writer, the block writer will be aborted.

@param offset the read offset