maedhroz commented on code in PR #4428:
URL: https://github.com/apache/cassandra/pull/4428#discussion_r2538958083
##########
src/java/org/apache/cassandra/service/reads/tracked/TrackedLocalReads.java:
##########
@@ -145,6 +149,30 @@ private void beginReadInternal(
ReadReconciliations.instance.acceptLocalSummary(readId,
secondarySummary, summaryNodes);
}
+ private static MutationSummary merge(Iterator<ShortMutationId>
activationIds, MutationSummary summary)
+ {
+ if (activationIds == null || !activationIds.hasNext())
+ return summary;
+
+ MutationSummary.Builder builder = new
MutationSummary.Builder(summary.tableId());
+
+ // TODO: Make faster without a copy
+ for (int i = 0; i < summary.size(); i++)
+ {
+ MutationSummary.CoordinatorSummary coordinatorSummary =
summary.get(i);
+ MutationSummary.CoordinatorSummary.Builder
coordinatorSummaryBuilder = builder.builderForLog(coordinatorSummary.logId());
+
coordinatorSummaryBuilder.unreconciled.addAll(coordinatorSummary.unreconciled);
+
coordinatorSummaryBuilder.reconciled.addAll(coordinatorSummary.reconciled);
+ }
+
+ while (activationIds.hasNext())
+ {
+ ShortMutationId id = activationIds.next();
+ builder.builderForLog(id).unreconciled.add(id.offset());
Review Comment:
What if we Just have `merge()` take a `Set` for `activationIds`? I'm not
sure the iterator buys us anything, and if we use a `Set`, we might also be
able to throw an `addAll()` method in `AbstractMutable` that correctly/exactly
expands the array size (since we're dealing with low-level array manipulation
in there).
--
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]