This is an automated email from the ASF dual-hosted git repository.

sarath pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new db7a46b  ATLAS-3360: Duplicate audits in atlas when HMS and hive hook 
is enabled.
db7a46b is described below

commit db7a46b447ecb3c77162cccb545f0c94fb1a4fec
Author: Saqeeb Shaikh <[email protected]>
AuthorDate: Wed Aug 14 14:12:48 2019 -0700

    ATLAS-3360: Duplicate audits in atlas when HMS and hive hook is enabled.
    
    Signed-off-by: Sarath Subramanian <[email protected]>
    (cherry picked from commit 0a6d098c8f88bc6e51632901674b4d45dd472d5d)
---
 .../apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java  | 6 ++++++
 server-api/src/main/java/org/apache/atlas/RequestContext.java       | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git 
a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java
 
b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java
index 983d4fa..c495dcc 100644
--- 
a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java
+++ 
b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java
@@ -839,7 +839,13 @@ public class AtlasEntityStoreV2 implements 
AtlasEntityStore {
                 }
 
                 if (entitiesToSkipUpdate != null) {
+                    // remove entitiesToSkipUpdate from EntityMutationContext
                     
context.getUpdatedEntities().removeAll(entitiesToSkipUpdate);
+
+                    // remove entitiesToSkipUpdate from RequestContext
+                    for (AtlasEntity entity : entitiesToSkipUpdate) {
+                        RequestContext.get().removeEntityUpdate(entity);
+                    }
                 }
 
                 // Check if authorized to update entities
diff --git a/server-api/src/main/java/org/apache/atlas/RequestContext.java 
b/server-api/src/main/java/org/apache/atlas/RequestContext.java
index 62899b6..d518609 100644
--- a/server-api/src/main/java/org/apache/atlas/RequestContext.java
+++ b/server-api/src/main/java/org/apache/atlas/RequestContext.java
@@ -189,6 +189,12 @@ public class RequestContext {
         }
     }
 
+    public void removeEntityUpdate(AtlasEntity entity) {
+        if (entity != null && entity.getGuid() != null) {
+            updatedEntities.remove(entity.getGuid());
+        }
+    }
+
     public void recordEntityDelete(AtlasEntityHeader entity) {
         if (entity != null && entity.getGuid() != null) {
             deletedEntities.put(entity.getGuid(), entity);

Reply via email to