From 41b2fb863b86a1fffdfe82bb3fa09fc65831cadb Mon Sep 17 00:00:00 2001 From: PRATHAM2002-DS Date: Wed, 11 Dec 2024 11:54:33 +0530 Subject: [PATCH] mesh-294: added batch in commiting changes --- .../v2/UniqueQNAttributeMigrationService.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/UniqueQNAttributeMigrationService.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/UniqueQNAttributeMigrationService.java index 52925970ef..a7e0fc46e7 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/UniqueQNAttributeMigrationService.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/UniqueQNAttributeMigrationService.java @@ -31,6 +31,7 @@ public UniqueQNAttributeMigrationService(EntityGraphRetriever entityRetriever, S public void migrateQN() throws Exception { try { int count = 0; + int totalUpdatedCount = 0; for (String entityGuid : entityGuids) { AtlasVertex entityVertex = entityRetriever.getEntityVertex(entityGuid); @@ -42,19 +43,25 @@ public void migrateQN() throws Exception { boolean isCommitRequired = migrateuniqueQnAttr(entityVertex); if (isCommitRequired){ count++; + totalUpdatedCount++; } else { LOG.info("No changes to commit for entity: {} as no migration needed", entityGuid); } + + if (count == 20) { + LOG.info("Committing batch of 20 entities..."); + commitChanges(); + count = 0; + } } if (count > 0) { - LOG.info("Total Vertex updated: {}", count); + LOG.info("Committing remaining {} entities...", count); commitChanges(); } - else { - LOG.info("No changes to commit for entities as no migration needed"); - } + + LOG.info("Total Vertex updated: {}", totalUpdatedCount); } catch (Exception e) { LOG.error("Error while migration unique qualifiedName attribute for entities: {}", entityGuids, e);