anton-vinogradov commented on a change in pull request #9288:
URL: https://github.com/apache/ignite/pull/9288#discussion_r680969192



##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/consistency/GridNearReadRepairAbstractFuture.java
##########
@@ -228,4 +254,103 @@ else if (!canRemap)
      * Reduces fut's results.
      */
     protected abstract void reduce();
+
+    /**
+     * @param fixedEntries Fixed map.
+     */
+    protected void recordConsistencyViolation(
+        Set<KeyCacheObject> inconsistentKeys,
+        Map<KeyCacheObject, EntryGetResult> fixedEntries
+    ) {
+        GridEventStorageManager evtMgr = ctx.gridEvents();
+
+        if (!evtMgr.isRecordable(EVT_CONSISTENCY_VIOLATION))
+            return;
+
+        Map<Object, Map<ClusterNode, 
CacheConsistencyViolationEvent.EntryInfo>> originalMap = new HashMap<>();
+
+        for (Map.Entry<ClusterNode, GridPartitionedGetFuture<KeyCacheObject, 
EntryGetResult>> pair : futs.entrySet()) {
+            ClusterNode node = pair.getKey();
+
+            GridPartitionedGetFuture<KeyCacheObject, EntryGetResult> fut = 
pair.getValue();
+
+            for (Map.Entry<KeyCacheObject, EntryGetResult> entry : 
fut.result().entrySet()) {
+                KeyCacheObject key = entry.getKey();
+
+                if (inconsistentKeys.contains(key)) {
+                    EntryGetResult res = entry.getValue();
+                    CacheEntryVersion ver = res.version();
+
+                    Object val = ctx.unwrapBinaryIfNeeded(res.value(), false, 
false, null);
+
+                    Map<ClusterNode, CacheConsistencyViolationEvent.EntryInfo> 
map =
+                        originalMap.computeIfAbsent(
+                            ctx.unwrapBinaryIfNeeded(key, false, false, null), 
k -> new HashMap<>());
+
+                    boolean primary = primaries.get(key).equals(fut.affNode());

Review comment:
       `primaries.get(key)` MUST be not null in this code (because primary 
should be recorded for each key).
   `Objects#equals` overcomplicates the code without real need. 
   Let's keep it as is.




-- 
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]


Reply via email to