YARN-9874.Remove unnecessary LevelDb write call in LeveldbConfigurationStore#confirmMutation (#4487)

Co-authored-by: Ashutosh Gupta <ashugpt@amazon.com>
This commit is contained in:
Ashutosh Gupta 2022-06-23 17:29:27 +01:00 committed by GitHub
parent 4abb2ba58c
commit 734b6f19ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -204,8 +204,8 @@ public void logMutation(LogMutation logMutation) throws IOException {
@Override @Override
public void confirmMutation(LogMutation pendingMutation, public void confirmMutation(LogMutation pendingMutation,
boolean isValid) { boolean isValid) {
WriteBatch updateBatch = db.createWriteBatch();
if (isValid) { if (isValid) {
WriteBatch updateBatch = db.createWriteBatch();
for (Map.Entry<String, String> changes : for (Map.Entry<String, String> changes :
pendingMutation.getUpdates().entrySet()) { pendingMutation.getUpdates().entrySet()) {
if (changes.getValue() == null || changes.getValue().isEmpty()) { if (changes.getValue() == null || changes.getValue().isEmpty()) {
@ -215,9 +215,9 @@ public void confirmMutation(LogMutation pendingMutation,
} }
} }
increaseConfigVersion(); increaseConfigVersion();
}
db.write(updateBatch); db.write(updateBatch);
} }
}
private byte[] serLogMutations(LinkedList<LogMutation> mutations) throws private byte[] serLogMutations(LinkedList<LogMutation> mutations) throws
IOException { IOException {