You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2022/09/20 14:40:07 UTC

[GitHub] [accumulo] dlmarion commented on a diff in pull request #2935: Modify LogReader to print just the crypto params

dlmarion commented on code in PR #2935:
URL: https://github.com/apache/accumulo/pull/2935#discussion_r975454287


##########
server/tserver/src/main/java/org/apache/accumulo/tserver/logger/LogReader.java:
##########
@@ -172,6 +187,45 @@ public void execute(String[] args) throws Exception {
     }
   }
 
+  private void printCryptoParams(FSDataInputStream input, Path path) {
+    byte[] magic4 = DfsLogger.LOG_FILE_HEADER_V4.getBytes(UTF_8);
+    byte[] magic3 = DfsLogger.LOG_FILE_HEADER_V3.getBytes(UTF_8);
+    byte[] noCryptoBytes = new NoFileEncrypter().getDecryptionParameters();
+
+    if (magic4.length != magic3.length)
+      throw new AssertionError("Always expect log file headers to be same length : " + magic4.length
+          + " != " + magic3.length);
+
+    byte[] magicBuffer = new byte[magic4.length];
+    try {
+      input.readFully(magicBuffer);
+      if (Arrays.equals(magicBuffer, magic4)) {
+        byte[] cryptoParams = CryptoUtils.readParams(input);

Review Comment:
   I wonder if you should throw a CryptoException here instead of letting this fall through to a RuntimeException. If you caught the CryptoException in the call to this method, then you could continue processing the next file after logging the error.



-- 
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@accumulo.apache.org

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