From 5faba351c947b2f08d2e89d9521a2d81c23dc07d Mon Sep 17 00:00:00 2001 From: Nikhil Soni Date: Tue, 13 Aug 2024 17:38:43 +0530 Subject: [PATCH] Check last edit time only for authpoliy Without this check, policy download API check could take the Persona or Purpose update time to be last edit time for which it will not find a policy since no policy exist for this mistakenly considered timestamp. --- .../src/main/java/org/apache/atlas/web/rest/AuthREST.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/webapp/src/main/java/org/apache/atlas/web/rest/AuthREST.java b/webapp/src/main/java/org/apache/atlas/web/rest/AuthREST.java index ec0e5a9a54..69f1b29b98 100644 --- a/webapp/src/main/java/org/apache/atlas/web/rest/AuthREST.java +++ b/webapp/src/main/java/org/apache/atlas/web/rest/AuthREST.java @@ -207,14 +207,16 @@ private Long getLastEditTime(String serviceName, long lastUpdatedTime) { dsl.put("sort", sortList); parameters.setDsl(dsl); - Long lastEditTime = 0L; + Long lastEditTime = 0L; // this timestamp is used to verify if the found policies are synced with any policy create or update op on cassandra try { EntityAuditSearchResult result = auditRepository.searchEvents(parameters.getQueryString()); if (result != null) { if (!CollectionUtils.isEmpty(result.getEntityAudits())) { EntityAuditEventV2 lastAuditLog = result.getEntityAudits().get(0); - if (!EntityAuditEventV2.EntityAuditActionV2.getDeleteActions().contains(lastAuditLog.getAction())) { + if (!EntityAuditEventV2.EntityAuditActionV2.getDeleteActions().contains(lastAuditLog.getAction()) && + lastAuditLog.getTypeName().equals(POLICY_ENTITY_TYPE) + ) { lastEditTime = lastAuditLog.getTimestamp(); } else { LOG.info("ES_SYNC_FIX: {}: found delete action, so ignoring the last edit time: {}", serviceName, lastAuditLog.getTimestamp());