Improve log compaction efficiency in AtomixConsistentMap.
Change-Id: I0d78df3e00e8253c9015504be77f026512bb4d08
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentMapCommands.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentMapCommands.java
index b83aa52..e64bbbf 100644
--- a/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentMapCommands.java
+++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentMapCommands.java
@@ -250,6 +250,11 @@
public TransactionPrepareAndCommit(MapTransaction<String, byte[]> mapTransaction) {
super(mapTransaction);
}
+
+ @Override
+ public CompactionMode compaction() {
+ return CompactionMode.QUORUM;
+ }
}
/**
@@ -287,6 +292,11 @@
}
@Override
+ public CompactionMode compaction() {
+ return CompactionMode.TOMBSTONE;
+ }
+
+ @Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
.add("transactionId", transactionId)
@@ -329,6 +339,11 @@
}
@Override
+ public CompactionMode compaction() {
+ return CompactionMode.TOMBSTONE;
+ }
+
+ @Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
.add("transactionId", transactionId)
@@ -393,7 +408,7 @@
@Override
public CompactionMode compaction() {
- return value == null ? CompactionMode.FULL : CompactionMode.QUORUM;
+ return value == null ? CompactionMode.TOMBSTONE : CompactionMode.QUORUM;
}
@Override
@@ -478,10 +493,9 @@
*/
@SuppressWarnings("serial")
public static class Clear extends MapCommand<MapEntryUpdateResult.Status> {
-
@Override
public CompactionMode compaction() {
- return CompactionMode.FULL;
+ return CompactionMode.TOMBSTONE;
}
}
@@ -497,6 +511,11 @@
@Override
public void readObject(BufferInput<?> buffer, Serializer serializer) {
}
+
+ @Override
+ public CompactionMode compaction() {
+ return CompactionMode.QUORUM;
+ }
}
/**
@@ -511,6 +530,11 @@
@Override
public void readObject(BufferInput<?> buffer, Serializer serializer) {
}
+
+ @Override
+ public CompactionMode compaction() {
+ return CompactionMode.TOMBSTONE;
+ }
}
/**
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentMapState.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentMapState.java
index 50db768..84cd53a 100644
--- a/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentMapState.java
+++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentMapState.java
@@ -401,7 +401,7 @@
}
}
}
- // No violations detected. Add to pendingTranctions and mark
+ // No violations detected. Add to pendingTransactions and mark
// modified keys as locked for updates.
pendingTransactions.put(transaction.transactionId(), commit);
transaction.updates().forEach(u -> preparedKeys.add(u.key()));