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


   hi @adoroszlai 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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to