IGNITE-8594 Make error messages in validate_indexes command report more 
informative - Fixes #4197.

Signed-off-by: Ivan Rakov <ira...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/594df607
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/594df607
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/594df607

Branch: refs/heads/ignite-8446
Commit: 594df607cfee2d94be76bc841bdb21711ca5f778
Parents: 46ff796
Author: vd-pyatkov <vpyat...@gridgain.com>
Authored: Mon Jun 25 17:04:15 2018 +0300
Committer: Ivan Rakov <ira...@apache.org>
Committed: Mon Jun 25 17:04:15 2018 +0300

----------------------------------------------------------------------
 .../visor/verify/ValidateIndexesClosure.java         | 15 +++++++++++++--
 .../ignite/util/GridCommandHandlerIndexingTest.java  |  3 +++
 2 files changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/594df607/modules/indexing/src/main/java/org/apache/ignite/internal/visor/verify/ValidateIndexesClosure.java
----------------------------------------------------------------------
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/visor/verify/ValidateIndexesClosure.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/visor/verify/ValidateIndexesClosure.java
index e01dca2..e3aebc3 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/visor/verify/ValidateIndexesClosure.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/visor/verify/ValidateIndexesClosure.java
@@ -505,12 +505,21 @@ public class ValidateIndexesClosure implements 
IgniteCallable<VisorValidateIndex
         long current = 0;
         long processedNumber = 0;
 
+        KeyCacheObject previousKey = null;
+
         while (!enoughIssues) {
             KeyCacheObject h2key = null;
 
             try {
-                if (!cursor.next())
-                    break;
+                try {
+                    if (!cursor.next())
+                        break;
+                }
+                catch (IllegalStateException e) {
+                    throw new IgniteCheckedException("Key is present in SQL 
index, but is missing in corresponding " +
+                        "data page. Previous successfully read key: " +
+                        
CacheObjectUtils.unwrapBinaryIfNeeded(ctx.cacheObjectContext(), previousKey, 
true, true), e);
+                }
 
                 GridH2Row h2Row = (GridH2Row)cursor.get();
 
@@ -541,6 +550,8 @@ public class ValidateIndexesClosure implements 
IgniteCallable<VisorValidateIndex
 
                 if (cacheDataStoreRow == null)
                     throw new IgniteCheckedException("Key is present in SQL 
index, but can't be found in CacheDataTree.");
+
+                previousKey = h2key;
             }
             catch (Throwable t) {
                 Object o = CacheObjectUtils.unwrapBinaryIfNeeded(

http://git-wip-us.apache.org/repos/asf/ignite/blob/594df607/modules/indexing/src/test/java/org/apache/ignite/util/GridCommandHandlerIndexingTest.java
----------------------------------------------------------------------
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/util/GridCommandHandlerIndexingTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/util/GridCommandHandlerIndexingTest.java
index ca9aa53..1a274e5 100644
--- 
a/modules/indexing/src/test/java/org/apache/ignite/util/GridCommandHandlerIndexingTest.java
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/util/GridCommandHandlerIndexingTest.java
@@ -110,6 +110,9 @@ public class GridCommandHandlerIndexingTest extends 
GridCommandHandlerTest {
                 "checkThrough", "10"));
 
         assertTrue(testOut.toString().contains("validate_indexes has finished 
with errors"));
+
+        assertTrue(testOut.toString().contains(
+            "Key is present in SQL index, but is missing in corresponding data 
page."));
     }
 
     /**

Reply via email to