cmccabe opened a new pull request #10857:
URL: https://github.com/apache/kafka/pull/10857


   Previously, we had an interface named
   org.apache.kafka.controller.SnapshotWriter and a concrete implementation
   class called org.apache.kafka.snapshot.SnapshotWriter.
   
   As part of unit tests, it is often helpful to be able to use an
   interface to mock snapshot writing and reading. Therefore, we should
   make the interface class part of the Raft package, not the controller
   package. This PR moves SnapshotWriter into that package and renames the
   concrete class to RaftSnapshotWriter.
   
   This PR also harmonizes the two classes. For example, "completeSnapshot"
   becomes "freeze" (since that's what it was in the raft package).
   Similarly, "writeBatch" becomes "append".  SnapshotWriter is now
   templated on the record type, in order to be generic, rather than
   specific to metadata.
   
   The controller code sometimes refers to the snapshot's end offset as its
   "epoch". This is confusing since there is also the concept of a raft log
   epoch. I have tried to remove most of these uses and replace them with
   "endOffset", which is more descriptive.
   
   I also fixed an off-by-one error where we advanced lastCommittedOffset
   to be just before a snapshot's endOffset, rather than at a snapshot end
   offset.
   
   Finally, I removed snapshotId from the reader and writer interface.
   Since snapshots are only ever taken (or indeed read) from committed
   offsets, there is no need for the controller or broker to supply this
   information to the raft layer. The end offset is sufficient. The raft
   layer can look up the relevant information if there is any need for it.


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


Reply via email to