You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2019/06/05 23:08:59 UTC
[GitHub] [hadoop] bharatviswa504 commented on a change in pull request #867:
HDDS-1605. Implement AuditLogging for OM HA Bucket write requests.
bharatviswa504 commented on a change in pull request #867: HDDS-1605. Implement AuditLogging for OM HA Bucket write requests.
URL: https://github.com/apache/hadoop/pull/867#discussion_r290969230
##########
File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/bucket/OMBucketCreateRequest.java
##########
@@ -152,27 +160,35 @@ public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager,
OMException.ResultCodes.BUCKET_ALREADY_EXISTS);
}
- LOG.debug("created bucket: {} in volume: {}", bucketName, volumeName);
- omMetrics.incNumBuckets();
-
// Update table cache.
metadataManager.getBucketTable().addCacheEntry(new CacheKey<>(bucketKey),
new CacheValue<>(Optional.of(omBucketInfo), transactionLogIndex));
- // return response.
+
+ } catch (IOException ex) {
+ exception = ex;
+ } finally {
+ metadataManager.getLock().releaseBucketLock(volumeName, bucketName);
+ metadataManager.getLock().releaseVolumeLock(volumeName);
+
+ // Performing audit logging outside of the lock.
+ auditLog(auditLogger, buildAuditMessage(OMAction.CREATE_BUCKET,
+ omBucketInfo.toAuditMap(), exception, userInfo));
+ }
Review comment:
Yes, it not to do logging/expensive things inside the lock. As after adding the response to cache, we can release the lock, so that other threads waiting for the lock can acquire it. (In future we don't see performance things because of audit log we are seeing some performance issues.)
More on a side note, doing audit logging outside lock will not cause any side effects in my view. Let me know if anything I am missing here.
----------------------------------------------------------------
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
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org