jsancio commented on a change in pull request #10786:
URL: https://github.com/apache/kafka/pull/10786#discussion_r651387879



##########
File path: raft/src/main/java/org/apache/kafka/raft/ReplicatedLog.java
##########
@@ -230,12 +230,18 @@ default long truncateToEndOffset(OffsetAndEpoch 
endOffset) {
      * Create a writable snapshot for the given snapshot id.
      *
      * See {@link RawSnapshotWriter} for details on how to use this object. 
The caller of
-     * this method is responsible for invoking {@link 
RawSnapshotWriter#close()}.
+     * this method is responsible for invoking {@link 
RawSnapshotWriter#close()}. If a
+     * snapshot already exists then return an {@link Optional#empty()}.
      *
      * @param snapshotId the end offset and epoch that identifies the snapshot
-     * @return a writable snapshot
+     * @param validate validate the snapshot id against the log
+     * @return a writable snapshot if it doesn't already exists
+     * @throws IllegalArgumentException if validate is true and end offset is 
greater than the
+     *         high-watermark
+     * @throws IllegalArgumentException if validate is true and end offset is 
less than the log
+     *         start offset
      */
-    RawSnapshotWriter createSnapshot(OffsetAndEpoch snapshotId);
+    Optional<RawSnapshotWriter> createSnapshot(OffsetAndEpoch snapshotId, 
boolean validate);

Review comment:
       Done. Used these suggestions. I couldn't think of better names.




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


Reply via email to