You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/01/05 03:35:14 UTC

[GitHub] [ozone] lamber-ken commented on pull request #1730: HDDS-4619. Intermittent error exporting same container to multiple datanodes

lamber-ken commented on pull request #1730:
URL: https://github.com/apache/ozone/pull/1730#issuecomment-754369202


   hi @adoroszlai the changes are hard to understand, may only use `writeLock` is ok, like 
   ```java
   @Override
   public void exportContainerData(OutputStream destination,
       ContainerPacker<KeyValueContainerData> packer) throws IOException {
     
     try {
       writeLock();
   
       // Closed/ Quasi closed containers are considered for replication by
       // replication manager if they are under-replicated.
       ContainerProtos.ContainerDataProto.State state =
           getContainerData().getState();
       if (!(state == ContainerProtos.ContainerDataProto.State.CLOSED ||
           state == ContainerDataProto.State.QUASI_CLOSED)) {
         throw new IllegalStateException(
             "Only closed/quasi closed containers could be exported: " +
                 "Where as ContainerId="
                 + getContainerData().getContainerID() + " is in state " + state);
       }
       compactDB();
       // Close DB (and remove from cache) to avoid concurrent modification while
       // packing it.
       BlockUtils.removeDB(containerData, config);
       packer.pack(this, destination);
       
     } finally {
       writeUnlock();
     }
     
   }
   ```
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org