This is an automated email from the ASF dual-hosted git repository.

jmanno pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo-testing.git


The following commit(s) were added to refs/heads/main by this push:
     new 44e1377  Refactor logging in Verify for RW Bulk (#254)
44e1377 is described below

commit 44e1377ccd79802d495c9cdca5278a4e2c7a9dd1
Author: Jeffrey Manno <jeffreymann...@gmail.com>
AuthorDate: Sun Nov 20 09:29:24 2022 -0500

    Refactor logging in Verify for RW Bulk (#254)
    
    * Refactor logging in Verify for RW Bulk to give more useful information to 
the user.
---
 .../accumulo/testing/randomwalk/bulk/Verify.java   | 30 +++++++++++++++-------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git 
a/src/main/java/org/apache/accumulo/testing/randomwalk/bulk/Verify.java 
b/src/main/java/org/apache/accumulo/testing/randomwalk/bulk/Verify.java
index d39ae10..8d61149 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/bulk/Verify.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/bulk/Verify.java
@@ -67,12 +67,14 @@ public class Verify extends Test {
     String user = env.getAccumuloClient().whoami();
     Authorizations auths = 
env.getAccumuloClient().securityOperations().getUserAuthorizations(user);
     RowIterator rowIter;
+    boolean errorFound = false;
     try (Scanner scanner = 
env.getAccumuloClient().createScanner(Setup.getTableName(), auths)) {
       scanner.fetchColumnFamily(BulkPlusOne.CHECK_COLUMN_FAMILY);
       for (Entry<Key,Value> entry : scanner) {
         byte[] value = entry.getValue().get();
         if (!Arrays.equals(value, zero)) {
-          throw new Exception("Bad key at " + entry);
+          log.error("Bad key found at {}", entry);
+          errorFound = true;
         }
       }
 
@@ -87,26 +89,36 @@ public class Verify extends Test {
         while (row.hasNext()) {
           Entry<Key,Value> entry = row.next();
 
-          if (rowText == null)
+          if (rowText == null) {
             rowText = entry.getKey().getRow();
+          }
 
           long curr = 
Long.parseLong(entry.getKey().getColumnQualifier().toString());
 
-          if (curr - 1 != prev)
-            throw new Exception(
-                "Bad marker count " + entry.getKey() + " " + entry.getValue() 
+ " " + prev);
+          if (curr - 1 != prev) {
+            log.error("Bad market count. Current row: {} {}, Previous row 
marker: {}",
+                entry.getKey(), entry.getValue(), prev);
+            errorFound = true;
+          }
 
-          if (!entry.getValue().toString().equals("1"))
-            throw new Exception("Bad marker value " + entry.getKey() + " " + 
entry.getValue());
+          if (!entry.getValue().toString().equals("1")) {
+            log.error("Bad marker value for row {} {}.\n Value expected to be 
one", entry.getKey(),
+                entry.getValue());
+            errorFound = true;
+          }
 
           prev = curr;
         }
 
         if (BulkPlusOne.counter.get() != prev) {
-          throw new Exception("Row " + rowText + " does not have all markers "
-              + BulkPlusOne.counter.get() + " " + prev);
+          log.error("Row {} does not have all markers. Current marker: {}, 
Previous marker:{}",
+              rowText, BulkPlusOne.counter.get(), prev);
+          errorFound = true;
         }
       }
+      if (errorFound) {
+        throw new Exception("Error found during Verify");
+      }
     }
 
     log.info("Test successful on table " + Setup.getTableName());

Reply via email to