krummas commented on code in PR #4592:
URL: https://github.com/apache/cassandra/pull/4592#discussion_r2757738686
##########
src/java/org/apache/cassandra/tcm/ClusterMetadata.java:
##########
@@ -317,21 +319,72 @@ public Epoch nextEpoch()
return epoch.nextEpoch();
}
- public DataPlacement writePlacementAllSettled(KeyspaceMetadata ksm)
+ public RangesAtEndpoint localWriteRangesAllSettled(KeyspaceMetadata ksm)
{
- if (writePlacementAllSettled == null)
+ // Local strategy ranges are constant
+ if (ksm.params.replication.isLocal())
+ return localWriteRanges(ksm);
+
+ if (localRangesAllSettled != null)
+ return localRangesAllSettled.getOrDefault(ksm.params.replication,
EMPTY_LOCAL_RANGES);
+
+ ClusterMetadata metadata = this;
Review Comment:
don't think we need this?
or, if we do, we should probably only use `metadata` instead of `this` in
the synchronized block below
##########
src/java/org/apache/cassandra/tcm/ClusterMetadata.java:
##########
@@ -317,21 +319,72 @@ public Epoch nextEpoch()
return epoch.nextEpoch();
}
- public DataPlacement writePlacementAllSettled(KeyspaceMetadata ksm)
+ public RangesAtEndpoint localWriteRangesAllSettled(KeyspaceMetadata ksm)
{
- if (writePlacementAllSettled == null)
+ // Local strategy ranges are constant
+ if (ksm.params.replication.isLocal())
+ return localWriteRanges(ksm);
+
+ if (localRangesAllSettled != null)
+ return localRangesAllSettled.getOrDefault(ksm.params.replication,
EMPTY_LOCAL_RANGES);
+
+ ClusterMetadata metadata = this;
+ NodeId localId = metadata.myNodeId();
+ synchronized (this)
{
- ClusterMetadata metadata = this;
- Iterator<MultiStepOperation<?>> iter =
metadata.inProgressSequences.iterator();
- while (iter.hasNext())
+ if (localRangesAllSettled != null)
+ return localRangesAllSettled.get(ksm.params.replication);
Review Comment:
this should also use getOrDefault (same as outside the synchronized block)
--
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]