arp7 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_r271971268
##########
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:
Same. Can we pass the userKey from start to apply?
----------------------------------------------------------------
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]