public Long putIfAbsentChecksum ( Block blk , Long newChecksum ) throws IOException { Long oldChecksum = putIfAbsent ( blk , newChecksum ) ; if ( oldChecksum != null && ! oldChecksum . equals ( newChecksum ) ) { throw new IOException ( "Block " + blk . toString ( ) + " has different checksums " + oldChecksum + "(old) and " + newChecksum + "(new)" ) ; } return oldChecksum ; }
Save the checksum for a raided block into store and compare the old value with new value if different throw an exception