anoopsjohn commented on a change in pull request #626: HBASE-23017 Verify the
file integrity in persistent IOEngine
URL: https://github.com/apache/hbase/pull/626#discussion_r327725622
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java
##########
@@ -1053,6 +1065,12 @@ private void persistToFile() throws IOException {
}
try (FileOutputStream fos = new FileOutputStream(persistencePath, false)) {
fos.write(ProtobufMagic.PB_MAGIC);
+ byte[] checksum = ((PersistentIOEngine)
ioEngine).calculateChecksum(algorithm);
Review comment:
This is not correct.
In master we already have the PB_MAGIC and we are writing the meta info into
the persisting file in protobuf way. We can change the PB proto message to
include optional checksum also. If the checksum is there, write those bytes.
Marking it as optional so retrieving it back as bytes and check whether it was
there or not, all these work PB will help us. We dont have to have any extra
logic.
----------------------------------------------------------------
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