apache kafka - why delete the checkpoint file after finish loading its stored offsets? -
in kafka 0.10.2.0,when finished init processorstatemanager,why delete checkpoint file:
// load checkpoint information offsetcheckpoint checkpoint = new offsetcheckpoint(new file(this.basedir, checkpoint_file_name)); this.checkpointedoffsets = new hashmap<>(checkpoint.read()); // delete checkpoint file after finish loading stored offsets checkpoint.delete();
if kill application forcefully, , restart it, not load checkpoint file because deleted, when restoring partition's state:
if (checkpointedoffsets.containskey(storepartition)) { restoreconsumer.seek(storepartition, checkpointedoffsets.get(storepartition)); } else { restoreconsumer.seektobeginning(singleton(storepartition)); }
as execute seektobeginning, consumer consume offset 0.
wiki
Comments
Post a Comment