ctubbsii commented on a change in pull request #1127: fixes #1111 support 
reading unencrypted WALs from 1.9
URL: https://github.com/apache/accumulo/pull/1127#discussion_r278242085
 
 

 ##########
 File path: 
server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java
 ##########
 @@ -375,10 +380,19 @@ public static DFSLoggerInputStreams 
readHeaderAndReturnStream(FSDataInputStream
         log.debug("Using {} for decrypting WAL", 
cryptoService.getClass().getSimpleName());
         decryptingInput = cryptoService instanceof NoCryptoService ? input
             : new DataInputStream(decrypter.decryptStream(input));
-      } else {
-        log.error("Unsupported WAL version.");
-        input.seek(0);
+      } else if (Arrays.equals(magicBuffer, magic3)) {
+        // Read logs files from Accumulo 1.9
+        String cryptoModuleClassname = input.readUTF();
+        if (!cryptoModuleClassname.equals("NullCryptoModule")) {
+          throw new IllegalArgumentException(
+              "Old encryption modules not supported at this time.  Unsupported 
module : "
+                  + cryptoModuleClassname);
+        }
+
         decryptingInput = input;
+      } else {
+        throw new IllegalArgumentException(
 
 Review comment:
   I think that would be misleading to a user debugging the failure. The end of 
file hasn't been reached. Rather, the content in the file is unexpected. I 
think it would be better to simply update the message in the catch block, since 
there is more than one exception which could be caught there.

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


With regards,
Apache Git Services

Reply via email to