Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-17184

Improve BlockReceiver to throws DiskOutOfSpaceException when initialize

    XMLWordPrintableJSON

Details

    • Reviewed

    Description

      BlockReceiver class will receives a block and writes to its disk,
      in the constructor method, createTemporary and createRbw will execute chooseVolume, and DiskOutOfSpaceException may occur in chooseVolume.
      current in the processing logic, if the exception occurs will be cacth by BlockReceiver.java line_282 catch(IOException ioe) here, and cleanupBlock() will be executed here.

      since the replica of the current block has not been added to ReplicaMap, executing cleanupBlock will throw ReplicaNotFoundException.
      the ReplicaNotFoundException exception will overwrite the actual DiskOutOfSpaceException, resulting in inaccurate exception information.

      BlockReceiver(final ExtendedBlock block, final StorageType storageType,
            final DataInputStream in,
            final String inAddr, final String myAddr,
            final BlockConstructionStage stage, 
            final long newGs, final long minBytesRcvd, final long maxBytesRcvd, 
            final String clientname, final DatanodeInfo srcDataNode,
            final DataNode datanode, DataChecksum requestedChecksum,
            CachingStrategy cachingStrategy,
            final boolean allowLazyPersist,
            final boolean pinning,
            final String storageId) throws IOException {
          try{
            ...
           } catch (ReplicaAlreadyExistsException bae) {
             throw bae;
           } catch (ReplicaNotFoundException bne) {
             throw bne;
           } catch(IOException ioe) {
            if (replicaInfo != null) {
              replicaInfo.releaseAllBytesReserved();
            }
            IOUtils.closeStream(this); 
            cleanupBlock();// if ReplicaMap does not exist  replica  will throw ReplicaNotFoundException
            ...
            throw ioe;
          }
        }
      

      Attachments

        Issue Links

          Activity

            People

              haiyang Hu Haiyang Hu
              haiyang Hu Haiyang Hu
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: