From a75f246ee8fb22ed213b4061c6ecc6605123a9fc Mon Sep 17 00:00:00 2001 From: Manyanda Chitimbo Date: Wed, 19 Apr 2023 10:26:57 +0200 Subject: [PATCH] MINOR: fix noticed typo in raft and metadata projects I noticed a few typos in the `raft` and `metadata` projects and I thought I could open a quick minor PR to fix them. --- .../java/org/apache/kafka/controller/QuorumController.java | 2 +- .../java/org/apache/kafka/image/writer/ImageWriter.java | 2 +- raft/src/main/java/org/apache/kafka/raft/Batch.java | 2 +- .../src/main/java/org/apache/kafka/raft/CandidateState.java | 2 +- .../main/java/org/apache/kafka/raft/ExpirationService.java | 2 +- .../main/java/org/apache/kafka/raft/KafkaRaftClient.java | 2 +- raft/src/main/java/org/apache/kafka/raft/RaftClient.java | 6 +++--- raft/src/main/java/org/apache/kafka/raft/ReplicatedLog.java | 4 ++-- .../java/org/apache/kafka/snapshot/RawSnapshotReader.java | 2 +- raft/src/main/java/org/apache/kafka/snapshot/Snapshots.java | 2 +- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/metadata/src/main/java/org/apache/kafka/controller/QuorumController.java b/metadata/src/main/java/org/apache/kafka/controller/QuorumController.java index f648278c4c676..cb7e55fcd9419 100644 --- a/metadata/src/main/java/org/apache/kafka/controller/QuorumController.java +++ b/metadata/src/main/java/org/apache/kafka/controller/QuorumController.java @@ -1583,7 +1583,7 @@ private void resetToEmptyState() { private int lastCommittedEpoch = -1; /** - * The timestamp in milliseconds of the last batch we have committed, or -1 if we have not commmitted any offset. + * The timestamp in milliseconds of the last batch we have committed, or -1 if we have not committed any offset. */ private long lastCommittedTimestamp = -1; diff --git a/metadata/src/main/java/org/apache/kafka/image/writer/ImageWriter.java b/metadata/src/main/java/org/apache/kafka/image/writer/ImageWriter.java index cfb840ea900a5..bc3489e313d8e 100644 --- a/metadata/src/main/java/org/apache/kafka/image/writer/ImageWriter.java +++ b/metadata/src/main/java/org/apache/kafka/image/writer/ImageWriter.java @@ -48,7 +48,7 @@ default void write(int version, ApiMessage message) { void write(ApiMessageAndVersion record); /** - * Close the image writer, dicarding all progress. Calling this function more than once has + * Close the image writer, discarding all progress. Calling this function more than once has * no effect. */ default void close() { diff --git a/raft/src/main/java/org/apache/kafka/raft/Batch.java b/raft/src/main/java/org/apache/kafka/raft/Batch.java index 353723166d95f..94c2b75c22b93 100644 --- a/raft/src/main/java/org/apache/kafka/raft/Batch.java +++ b/raft/src/main/java/org/apache/kafka/raft/Batch.java @@ -156,7 +156,7 @@ public int hashCode() { * @param epoch epoch of the leader that created this batch * @param appendTimestamp timestamp in milliseconds of when the batch was appended * @param sizeInBytes number of bytes used by this batch - * @param lastOffset offset of the last record of this batch + * @param records the list of records in this batch */ public static Batch control( long baseOffset, diff --git a/raft/src/main/java/org/apache/kafka/raft/CandidateState.java b/raft/src/main/java/org/apache/kafka/raft/CandidateState.java index f5724624c0f40..e4c68db61610f 100644 --- a/raft/src/main/java/org/apache/kafka/raft/CandidateState.java +++ b/raft/src/main/java/org/apache/kafka/raft/CandidateState.java @@ -39,7 +39,7 @@ public class CandidateState implements EpochState { private final Logger log; /** - * The life time of a candidate state is the following: + * The lifetime of a candidate state is the following: * * 1. Once started, it would keep record of the received votes. * 2. If majority votes granted, it can then end its life and will be replaced by a leader state; diff --git a/raft/src/main/java/org/apache/kafka/raft/ExpirationService.java b/raft/src/main/java/org/apache/kafka/raft/ExpirationService.java index e8e8b025a6996..f072e228e26f1 100644 --- a/raft/src/main/java/org/apache/kafka/raft/ExpirationService.java +++ b/raft/src/main/java/org/apache/kafka/raft/ExpirationService.java @@ -25,7 +25,7 @@ public interface ExpirationService { * the provided time limit expires. * * @param timeoutMs the duration in milliseconds before the future is completed exceptionally - * @param arbitrary future type (the service must set no expectation on the this type) + * @param arbitrary future type (the service must set no expectation on this type) * @return the completable future */ CompletableFuture failAfter(long timeoutMs); diff --git a/raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java b/raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java index 875ab64419fb8..2bb4ef9b0d2fa 100644 --- a/raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java +++ b/raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java @@ -396,7 +396,7 @@ public void register(Listener listener) { @Override public void unregister(Listener listener) { pendingRegistrations.add(Registration.unregister(listener)); - // No need to wakeup the polling thread. It is a removal so the updates can be + // No need to wake up the polling thread. It is a removal so the updates can be // delayed until the polling thread wakes up for other reasons. } diff --git a/raft/src/main/java/org/apache/kafka/raft/RaftClient.java b/raft/src/main/java/org/apache/kafka/raft/RaftClient.java index 9580567231183..84567c4efbd6b 100644 --- a/raft/src/main/java/org/apache/kafka/raft/RaftClient.java +++ b/raft/src/main/java/org/apache/kafka/raft/RaftClient.java @@ -105,7 +105,7 @@ default void beginShutdown() {} /** * Unregisters a listener. * - * To distinguish from events that happend before the call to {@code unregister} and a future + * To distinguish from events that happened before the call to {@code unregister} and a future * call to {@code register}, different {@code Listener} instances must be used. * * If the {@code Listener} provided was never registered then the unregistration is ignored. @@ -115,7 +115,7 @@ default void beginShutdown() {} void unregister(Listener listener); /** - * Returns the current high water mark, or OptionalLong.empty if it is not known. + * Returns the current high watermark, or OptionalLong.empty if it is not known. */ OptionalLong highWatermark(); @@ -226,7 +226,7 @@ default void beginShutdown() {} * @param snapshotId The ID of the new snapshot, which includes the (exclusive) last committed offset * and the last committed epoch. * @param lastContainedLogTime The append time of the highest record contained in this snapshot - * @return a writable snapshot if it doesn't already exists + * @return a writable snapshot if it doesn't already exist * @throws IllegalArgumentException if the committed offset is greater than the high-watermark * or less than the log start offset. */ diff --git a/raft/src/main/java/org/apache/kafka/raft/ReplicatedLog.java b/raft/src/main/java/org/apache/kafka/raft/ReplicatedLog.java index a8bc65af3a8c2..ba21f63b73e98 100644 --- a/raft/src/main/java/org/apache/kafka/raft/ReplicatedLog.java +++ b/raft/src/main/java/org/apache/kafka/raft/ReplicatedLog.java @@ -259,7 +259,7 @@ default long truncateToEndOffset(OffsetAndEpoch endOffset) { * the quorum leader. * * @param snapshotId the end offset and epoch that identifies the snapshot - * @return a writable snapshot if it doesn't already exists + * @return a writable snapshot if it doesn't already exist */ Optional storeSnapshot(OffsetAndEpoch snapshotId); @@ -287,7 +287,7 @@ default long truncateToEndOffset(OffsetAndEpoch endOffset) { /** * Returns the latest snapshot id if one exists. * - * @return an Optional snapshot id of the latest snashot if one exists, otherwise returns an + * @return an Optional snapshot id of the latest snapshot if one exists, otherwise returns an * empty Optional */ Optional latestSnapshotId(); diff --git a/raft/src/main/java/org/apache/kafka/snapshot/RawSnapshotReader.java b/raft/src/main/java/org/apache/kafka/snapshot/RawSnapshotReader.java index 1a51999aecfa3..9a718e58c1bce 100644 --- a/raft/src/main/java/org/apache/kafka/snapshot/RawSnapshotReader.java +++ b/raft/src/main/java/org/apache/kafka/snapshot/RawSnapshotReader.java @@ -35,7 +35,7 @@ public interface RawSnapshotReader { long sizeInBytes(); /** - * Creates a slize of unaligned records from the position up to a size. + * Creates a slice of unaligned records from the position up to a size. * * @param position the starting position of the slice in the snapshot * @param size the maximum size of the slice diff --git a/raft/src/main/java/org/apache/kafka/snapshot/Snapshots.java b/raft/src/main/java/org/apache/kafka/snapshot/Snapshots.java index c04f2190616f6..3d787c196c7b8 100644 --- a/raft/src/main/java/org/apache/kafka/snapshot/Snapshots.java +++ b/raft/src/main/java/org/apache/kafka/snapshot/Snapshots.java @@ -72,7 +72,7 @@ public static Path createTempFile(Path logDir, OffsetAndEpoch snapshotId) { Path dir = snapshotDir(logDir); try { - // Create the snapshot directory if it doesn't exists + // Create the snapshot directory if it doesn't exist Files.createDirectories(dir); String prefix = String.format("%s-", filenameFromSnapshotId(snapshotId)); return Files.createTempFile(dir, prefix, PARTIAL_SUFFIX);