ctubbsii commented on a change in pull request #2086:
URL: https://github.com/apache/accumulo/pull/2086#discussion_r629659466



##########
File path: 
server/base/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java
##########
@@ -144,27 +144,37 @@ private static void update(ServerContext context, 
Mutation m, KeyExtent extent)
   public static void update(ServerContext context, ServiceLock zooLock, 
Mutation m,
       KeyExtent extent) {
     Writer t = extent.isMeta() ? getRootTable(context) : 
getMetadataTable(context);
-    update(context, t, zooLock, m);
+    update(context, t, zooLock, m, extent);
   }
 
   public static void update(ServerContext context, Writer t, ServiceLock 
zooLock, Mutation m) {
+    update(context, t, zooLock, m, null);
+  }
+
+  public static void update(ServerContext context, Writer t, ServiceLock 
zooLock, Mutation m,
+      KeyExtent extent) {
     if (zooLock != null)
       putLockID(context, zooLock, m);
     while (true) {
       try {
         t.update(m);
         return;
       } catch (AccumuloException | TableNotFoundException | 
AccumuloSecurityException e) {
-        log.error("{}", e.getMessage(), e);
+        logUpdateFailure(m, extent, e);
       } catch (ConstraintViolationException e) {
-        log.error("{}", e.getMessage(), e);
+        logUpdateFailure(m, extent, e);
         // retrying when a CVE occurs is probably futile and can cause 
problems, see ACCUMULO-3096
         throw new RuntimeException(e);
       }
       sleepUninterruptibly(1, TimeUnit.SECONDS);
     }
   }
 
+  private static void logUpdateFailure(Mutation m, KeyExtent extent, Exception 
e) {
+    String extentMsg = extent == null ? "" : " for extent: " + extent;
+    log.error("Failed to write metadata updates {} {}", extentMsg, 
m.prettyPrint(), e);

Review comment:
       This suggestion is superseded by my subsequent suggestion to remove this 
ternary logic, since extent never needs to be null.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to