sk0x50 commented on code in PR #5153:
URL: https://github.com/apache/ignite-3/pull/5153#discussion_r1939244239
##########
modules/placement-driver/src/main/java/org/apache/ignite/internal/placementdriver/AssignmentsTracker.java:
##########
@@ -241,4 +241,87 @@ private static String
collectKeysFromEventAsString(WatchEvent event) {
.collect(Collectors.joining(","));
}
+ /**
+ * Prepares assignments for logging using the following structure:
+ * consistentId=[peers=[1_part_1, 1_part_2], learners=[2_part_0]].
+ *
+ * @param assignmentsMap assignments to be logged.
+ * @return String representation of assignments.
+ */
+ private static String prepareAssignmentsForLogging(Map<ReplicationGroupId,
TokenizedAssignments> assignmentsMap) {
+ class NodeAssignments {
+ private List<ReplicationGroupId> peers;
+ private List<ReplicationGroupId> learners;
+
+ private NodeAssignments() {
+ }
+
+ private void addReplicationGroupId(ReplicationGroupId
replicationGroupId, boolean isPeer) {
+ List<ReplicationGroupId> peersOrLearners;
+
+ if (isPeer) {
+ if (peers == null) {
Review Comment:
Yep, it was my explicit intention not to allocate objects until we know that
the collection is not empty, to avoid any GC pressure. IMHO, this does not in
any way impair the readability of the code.
--
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]