Skip to content

Commit

Permalink
Merge pull request #3392 from atlanhq/ns/DG-1735-es-sync-delay
Browse files Browse the repository at this point in the history
DG-1735 | Check last edit time only for authpoliy
  • Loading branch information
krsoninikhil authored Aug 13, 2024
2 parents 69c781b + 5faba35 commit 8b51fda
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions webapp/src/main/java/org/apache/atlas/web/rest/AuthREST.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 8b51fda

Please sign in to comment.