bharatviswa504 commented on a change in pull request #689: HDDS-1379. Convert 
all OM Volume related operations to HA model.
URL: https://github.com/apache/hadoop/pull/689#discussion_r271975546
 
 

 ##########
 File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/VolumeManagerImpl.java
 ##########
 @@ -322,28 +409,56 @@ public void deleteVolume(String volume) throws 
IOException {
       Preconditions.checkState(volume.equals(volumeArgs.getVolume()));
       // delete the volume from the owner list
       // as well as delete the volume entry
-      try (BatchOperation batch = metadataManager.getStore()
-          .initBatchOperation()) {
-        delVolumeFromOwnerList(volume, volumeArgs.getOwnerName(), batch);
-        metadataManager.getVolumeTable().deleteWithBatch(batch, dbVolumeKey);
-        metadataManager.getStore().commitBatchOperation(batch);
+      VolumeList newVolumeList = delVolumeFromOwnerList(volume,
+          volumeArgs.getOwnerName());
+
+      if (!isRatisEnabled) {
+        deleteVolumeCommitToDB(newVolumeList,
+            volume, owner);
       }
-    } catch (RocksDBException| IOException ex) {
+      return new OmDeleteVolumeResponse(volume, owner, newVolumeList);
+    } catch (IOException ex) {
       if (!(ex instanceof OMException)) {
         LOG.error("Delete volume failed for volume:{}", volume, ex);
       }
-      if(ex instanceof RocksDBException) {
-        throw RocksDBStore.toIOException("Volume creation failed.",
-            (RocksDBException) ex);
-      } else {
-        throw (IOException) ex;
-      }
+      throw ex;
     } finally {
       metadataManager.getLock().releaseVolumeLock(volume);
       metadataManager.getLock().releaseUserLock(owner);
     }
   }
 
+  @Override
+  public void applyDeleteVolume(String volume, String owner,
+      VolumeList newVolumeList) throws IOException {
+    try {
+      deleteVolumeCommitToDB(newVolumeList, volume, owner);
+    } catch (IOException ex) {
+      LOG.error("Delete volume failed for volume:{}", volume,
+          ex);
+      throw ex;
+    }
+  }
+
+  private void deleteVolumeCommitToDB(VolumeList newVolumeList,
+      String volume, String owner) throws IOException {
+    try (BatchOperation batch = metadataManager.getStore()
+        .initBatchOperation()) {
+      String dbUserKey = metadataManager.getUserKey(owner);
 
 Review comment:
   This is not DB reading, this method applys, it returns the same user name 
which we have passed. I think this was added for future purpose I believe if we 
want to have a different key for user

----------------------------------------------------------------
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]


With regards,
Apache Git Services

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

Reply via email to