[ 
https://issues.apache.org/jira/browse/HDDS-1605?focusedWorklogId=254751&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-254751
 ]

ASF GitHub Bot logged work on HDDS-1605:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 05/Jun/19 23:09
            Start Date: 05/Jun/19 23:09
    Worklog Time Spent: 10m 
      Work Description: bharatviswa504 commented on 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:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 254751)
    Time Spent: 1h 10m  (was: 1h)

> Implement AuditLogging for OM HA Bucket write requests
> ------------------------------------------------------
>
>                 Key: HDDS-1605
>                 URL: https://issues.apache.org/jira/browse/HDDS-1605
>             Project: Hadoop Distributed Data Store
>          Issue Type: Sub-task
>            Reporter: Bharat Viswanadham
>            Assignee: Bharat Viswanadham
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 0.5.0
>
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> In this Jira, we shall implement audit logging for OM HA Bucket write 
> requests.
> As now we cannot use userName,  IpAddress from Server API's as these will be 
> null, because the requests are executed under GRPC context. So, in our 
> AuditLogger API's we need to pass username and remoteAddress which we can get 
> from OMRequest after HDDS-1600 and use these during audit logging.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to