bharatviswa504 commented on a change in pull request #949: HDDS-1672. Improve
locking in OzoneManager.
URL: https://github.com/apache/hadoop/pull/949#discussion_r295948310
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/volume/OMVolumeDeleteRequest.java
##########
@@ -104,37 +104,23 @@ public OMClientResponse
validateAndUpdateCache(OzoneManager ozoneManager,
OmVolumeArgs omVolumeArgs = null;
String owner = null;
-
+ IOException exception = null;
+ OzoneManagerProtocolProtos.VolumeList newVolumeList = null;
omMetadataManager.getLock().acquireVolumeLock(volume);
try {
owner = getVolumeInfo(omMetadataManager, volume).getOwnerName();
- } catch (IOException ex) {
- LOG.error("Volume deletion failed for volume:{}", volume, ex);
- omMetrics.incNumVolumeDeleteFails();
- auditLog(auditLogger, buildAuditMessage(OMAction.DELETE_VOLUME,
- buildVolumeAuditMap(volume), ex, userInfo));
- return new OMVolumeDeleteResponse(null, null, null,
- createErrorOMResponse(omResponse, ex));
- } finally {
- omMetadataManager.getLock().releaseVolumeLock(volume);
- }
- // Release and reacquire lock for now it will not be a problem for now, as
- // applyTransaction serializes the operation's.
- // TODO: Revisit this logic once HDDS-1672 checks in.
+ // Release and reacquire lock for now it will not be a problem for now,
as
+ // applyTransaction serializes the operation's.
- // We cannot acquire user lock holding volume lock, so released volume
- // lock, and acquiring user and volume lock.
+ // We cannot acquire user lock holding volume lock, so released volume
+ // lock, and acquiring user and volume lock.
- omMetadataManager.getLock().acquireUserLock(owner);
- omMetadataManager.getLock().acquireVolumeLock(volume);
+ omMetadataManager.getLock().acquireUserLock(owner);
Review comment:
That is why we checked in finally owner!=null and then only release the lock
in finally.
----------------------------------------------------------------
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]