You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2021/12/28 10:46:04 UTC

[GitHub] [ignite] anton-vinogradov commented on a change in pull request #9661: IGNITE-15330 Read Repair should support strategies

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



##########
File path: modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerConsistencyTest.java
##########
@@ -187,36 +215,48 @@ public void testRepairNonExistentCache() throws Exception {
     /**
      *
      */
-    private void readRepairTx(AtomicInteger brokenParts, String cacheName) {
+    private void readRepair(AtomicInteger brokenParts, String cacheName, Integer fixesPerEntry) {
         for (int i = 0; i < PARTITIONS; i++) {
-            assertEquals(EXIT_CODE_OK, execute("--consistency", "repair", cacheName, String.valueOf(i)));
+            assertEquals(EXIT_CODE_OK, execute("--consistency", "repair", cacheName, String.valueOf(i), strategy.toString()));
             assertContains(log, testOut.toString(), CONSISTENCY_VIOLATIONS_FOUND);
-            assertContains(log, testOut.toString(), "[found=1, fixed=1");
+            assertContains(log, testOut.toString(), "[found=1, fixed=" + (fixesPerEntry != null ? fixesPerEntry.toString() : ""));
 
             assertEquals(EXIT_CODE_OK, execute("--cache", "idle_verify"));
 
-            brokenParts.decrementAndGet();
+            if (fixesPerEntry != null)
+                if (fixesPerEntry > 0) {
+                    brokenParts.decrementAndGet();
 
-            if (brokenParts.get() > 0)
-                assertContains(log, testOut.toString(),
-                    "conflict partitions has been found: [counterConflicts=0, hashConflicts=" + brokenParts);
-            else
-                assertContains(log, testOut.toString(), "no conflicts have been found");
+                    if (brokenParts.get() > 0)
+                        assertContains(log, testOut.toString(),
+                            "conflict partitions has been found: [counterConflicts=0, hashConflicts=" + brokenParts);
+                    else
+                        assertContains(log, testOut.toString(), "no conflicts have been found");
+                }
+                else
+                    assertContains(log, testOut.toString(),
+                        "conflict partitions has been found: [counterConflicts=0, hashConflicts=" + brokenParts); // Nothing fixed.
         }
     }
 
     /**
      *
      */
-    private void readRepaitAtomic(AtomicInteger brokenParts, String cacheName) {
-        for (int i = 0; i < PARTITIONS; i++) { // This may be a copy of previous (tx case), implement atomic repair to make this happen :)
-            assertEquals(EXIT_CODE_OK, execute("--consistency", "repair", cacheName, String.valueOf(i)));
-            assertContains(log, testOut.toString(), CONSISTENCY_VIOLATIONS_FOUND);
-            assertContains(log, testOut.toString(), "[found=1, fixed=0"); // Nothing fixed.
+    private Integer fixesPerEntry() {
+        switch (strategy) {
+            case PRIMARY:
+            case REMOVE:
+                return 1;
 
-            assertEquals(EXIT_CODE_OK, execute("--cache", "idle_verify"));
-            assertContains(log, testOut.toString(),
-                "conflict partitions has been found: [counterConflicts=0, hashConflicts=" + brokenParts); // Nothing fixed.
+            case CHECK_ONLY:
+                return 0;
+
+            case MAJORITY:
+            case LWW:
+                return null; // Who knows :)

Review comment:
       We have another test to do this.
   See `AbstractReadRepairTest#setDifferentValuesForSameKey` for details




-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org