From 734b6f19ad99c8145f50388aa34385431d4c199a Mon Sep 17 00:00:00 2001 From: Ashutosh Gupta Date: Thu, 23 Jun 2022 17:29:27 +0100 Subject: [PATCH] YARN-9874.Remove unnecessary LevelDb write call in LeveldbConfigurationStore#confirmMutation (#4487) Co-authored-by: Ashutosh Gupta --- .../scheduler/capacity/conf/LeveldbConfigurationStore.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/conf/LeveldbConfigurationStore.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/conf/LeveldbConfigurationStore.java index a351799872..6aa37f399e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/conf/LeveldbConfigurationStore.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/conf/LeveldbConfigurationStore.java @@ -204,8 +204,8 @@ public void logMutation(LogMutation logMutation) throws IOException { @Override public void confirmMutation(LogMutation pendingMutation, boolean isValid) { - WriteBatch updateBatch = db.createWriteBatch(); if (isValid) { + WriteBatch updateBatch = db.createWriteBatch(); for (Map.Entry changes : pendingMutation.getUpdates().entrySet()) { if (changes.getValue() == null || changes.getValue().isEmpty()) { @@ -215,8 +215,8 @@ public void confirmMutation(LogMutation pendingMutation, } } increaseConfigVersion(); + db.write(updateBatch); } - db.write(updateBatch); } private byte[] serLogMutations(LinkedList mutations) throws