iamaleksey commented on code in PR #4360:
URL: https://github.com/apache/cassandra/pull/4360#discussion_r2362315385
##########
src/java/org/apache/cassandra/replication/UnreconciledMutations.java:
##########
@@ -197,4 +198,41 @@ else if (cmp > 0)
return collect(statesSet.subSet(start, end), tableId,
includePending, into);
}
}
+
+ @VisibleForTesting
+ boolean equalsForTesting(UnreconciledMutations other)
+ {
+ return this.statesMap.equals(other.statesMap) &&
this.statesSet.equals(other.statesSet);
+ }
+
+ @VisibleForTesting
+ void addForTesting(Mutation mutation)
+ {
+ Entry entry = Entry.create(mutation);
+ entry.visibility = Visibility.VISIBLE;
+ statesMap.put(entry.offset, entry);
+ statesSet.add(entry);
+ }
+
+ static UnreconciledMutations loadFromJournal(Node2OffsetsMap
witnessedOffsets, int localNodeId)
+ {
+ UnreconciledMutations result = new UnreconciledMutations();
+
+ Offsets.Mutable witnessed = witnessedOffsets.get(localNodeId);
+ Offsets.Mutable reconciled = witnessedOffsets.intersection();
+
+ // difference between locally witnessed offsets and fully reconciled
ones is all the ids
+ // that need to be loaded into UnreconciledMutations index
+ Offsets.RangeIterator iter =
Offsets.difference(witnessed.rangeIterator(), reconciled.rangeIterator());
+ while (iter.tryAdvance())
+ {
+ for (int offset = iter.start(), end = iter.end(); offset <= end;
offset++)
+ {
+ ShortMutationId id = new ShortMutationId(witnessed.logId,
offset);
+ result.addForTesting(MutationJournal.instance.read(id));
Review Comment:
That must've been a botched refactoring rename, clearly unintended. Thanks
for catching it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]