anoopsjohn commented on a change in pull request #633: HBASE-22890 Verify the 
file integrity in persistent IOEngine
URL: https://github.com/apache/hbase/pull/633#discussion_r325763798
 
 

 ##########
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileIOEngine.java
 ##########
 @@ -59,6 +65,30 @@ public FileIOEngine(long capacity, String... filePaths) 
throws IOException {
     this.fileChannels = new FileChannel[filePaths.length];
     this.rafs = new RandomAccessFile[filePaths.length];
     this.channelLocks = new ReentrantLock[filePaths.length];
+    init();
+  }
+
+  @Override
+  public boolean verifyFileIntegrity(byte[] persistentChecksum, String 
algorithm)
+    throws IOException {
+    try {
+      byte[] calculateChecksum = calculateChecksum(algorithm);
+      if (!Bytes.equals(persistentChecksum, calculateChecksum)) {
+        throw new IOException("The persistent checksum is " + 
Bytes.toString(persistentChecksum) +
 
 Review comment:
   The response from this method is in 2 ways for IOE or mismatch of checksum. 
In caller place we check for boolean return value basically.  Can we just log 
the issue here and return boolean in any case?

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