anoopsjohn commented on a change in pull request #528: HBASE-22890 Verify the 
files when RegionServer is starting and BucketCache is in file mode
URL: https://github.com/apache/hbase/pull/528#discussion_r321666510
 
 

 ##########
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java
 ##########
 @@ -1021,41 +1033,45 @@ void doDrain(final List<RAMQueueEntry> entries) throws 
InterruptedException {
 
   private void persistToFile() throws IOException {
     assert !cacheEnabled;
-    FileOutputStream fos = null;
-    ObjectOutputStream oos = null;
-    try {
+    try (ObjectOutputStream oos = new ObjectOutputStream(
+      new FileOutputStream(persistencePath, false))){
       if (!ioEngine.isPersistent()) {
         throw new IOException("Attempt to persist non-persistent cache 
mappings!");
       }
-      fos = new FileOutputStream(persistencePath, false);
-      oos = new ObjectOutputStream(fos);
+      oos.write(ProtobufUtil.PB_MAGIC);
+      byte[] checksum = 
PersistentIOEngineUtils.calculateChecksum(ioEngineName, algorithm);
 
 Review comment:
   I get ur view on placing this checksum info.. The persist really comes into 
BucketCache as it persists meta info like backingMap.  Here the adjustment is 
keeping the ioEngineName as instance variable and the file paths are again 
derived from it.    In case of verify step that is very evident.  The readback 
from persistent file has to happen in BucketCache. And then the verification 
should be in FileIOE.  
   How abt doing it this way?
   We have isPersistent() in IOEngine.  Can we have an extended interface 
PersistentIOEngine which will have methods to get the checksum to persist and 
also for verify?  Within BC we can call these methods at appropriate places.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to