Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ private void readBlock() throws IOException {
in.getInt(); // TODO: verify this content checksum
return;
} else if (blockSize > maxBlockSize) {
throw new IOException(String.format("Block size %s exceeded max: %s", blockSize, maxBlockSize));
throw new IOException(String.format("Block size %d exceeded max: %d", blockSize, maxBlockSize));
}

if (in.remaining() < blockSize) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ public Retry(Time time, long retryBackoffMs, long retryBackoffMaxMs) {
this.retryBackoffMaxMs = retryBackoffMaxMs;

if (this.retryBackoffMs < 0)
throw new IllegalArgumentException(String.format("retryBackoffMs value (%s) must be non-negative", retryBackoffMs));
throw new IllegalArgumentException(String.format("retryBackoffMs value (%d) must be non-negative", retryBackoffMs));

if (this.retryBackoffMaxMs < 0)
throw new IllegalArgumentException(String.format("retryBackoffMaxMs value (%s) must be non-negative", retryBackoffMaxMs));
throw new IllegalArgumentException(String.format("retryBackoffMaxMs value (%d) must be non-negative", retryBackoffMaxMs));

if (this.retryBackoffMaxMs < this.retryBackoffMs)
throw new IllegalArgumentException(String.format("retryBackoffMaxMs value (%s) is less than retryBackoffMs value (%s)", retryBackoffMaxMs, retryBackoffMs));
throw new IllegalArgumentException(String.format("retryBackoffMaxMs value (%d) is less than retryBackoffMs value (%d)", retryBackoffMaxMs, retryBackoffMs));
}

public R execute(Retryable<R> retryable) throws ExecutionException {
Expand Down Expand Up @@ -88,7 +88,7 @@ public R execute(Retryable<R> retryable) throws ExecutionException {
if (waitMs <= 0)
break;

String message = String.format("Attempt %s to make call resulted in an error; sleeping %s ms before retrying",
String message = String.format("Attempt %d to make call resulted in an error; sleeping %d ms before retrying",
currAttempt, waitMs);
log.warn(message, e);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ void createSnapshotGenerator(long committedOffset, int committedEpoch, long comm
if (!snapshotRegistry.hasSnapshot(committedOffset)) {
throw new RuntimeException(
String.format(
"Cannot generate a snapshot at committed offset %s because it does not exists in the snapshot registry.",
"Cannot generate a snapshot at committed offset %d because it does not exists in the snapshot registry.",
committedOffset
)
);
Expand Down Expand Up @@ -857,7 +857,7 @@ public void handleSnapshot(SnapshotReader<ApiMessageAndVersion> reader) {
if (isActiveController()) {
throw new IllegalStateException(
String.format(
"Asked to load snapshot (%s) when it is the active controller (%s)",
"Asked to load snapshot (%s) when it is the active controller (%d)",
reader.snapshotId(),
curClaimEpoch
)
Expand Down
10 changes: 5 additions & 5 deletions raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ private void updateListenersProgress(long highWatermark) {
if (nextExpectedOffset < log.startOffset() && nextExpectedOffset < highWatermark) {
SnapshotReader<T> snapshot = latestSnapshot().orElseThrow(() -> new IllegalStateException(
String.format(
"Snapshot expected since next offset of %s is %s, log start offset is %s and high-watermark is %s",
"Snapshot expected since next offset of %s is %d, log start offset is %d and high-watermark is %d",
listenerContext.listenerName(),
nextExpectedOffset,
log.startOffset(),
Expand Down Expand Up @@ -1034,7 +1034,7 @@ private static OptionalInt optionalLeaderId(int leaderIdOrNil) {
}

private static String listenerName(Listener<?> listener) {
return String.format("%s@%s", listener.getClass().getTypeName(), System.identityHashCode(listener));
return String.format("%s@%d", listener.getClass().getTypeName(), System.identityHashCode(listener));
}

private boolean handleFetchResponse(
Expand Down Expand Up @@ -1261,7 +1261,7 @@ private FetchSnapshotResponseData handleFetchSnapshotRequest(
if (partitionSnapshot.position() > Integer.MAX_VALUE) {
throw new IllegalStateException(
String.format(
"Trying to fetch a snapshot with size (%s) and a position (%s) larger than %s",
"Trying to fetch a snapshot with size (%d) and a position (%d) larger than %d",
snapshotSize,
partitionSnapshot.position(),
Integer.MAX_VALUE
Expand Down Expand Up @@ -1373,7 +1373,7 @@ private boolean handleFetchSnapshotResponse(
if (snapshot.sizeInBytes() != partitionSnapshot.position()) {
throw new IllegalStateException(
String.format(
"Received fetch snapshot response with an invalid position. Expected %s; Received %s",
"Received fetch snapshot response with an invalid position. Expected %d; Received %d",
snapshot.sizeInBytes(),
partitionSnapshot.position()
)
Expand All @@ -1400,7 +1400,7 @@ private boolean handleFetchSnapshotResponse(
} else {
throw new IllegalStateException(
String.format(
"Full log truncation expected but didn't happen. Snapshot of %s, log end offset %s, last fetched %s",
"Full log truncation expected but didn't happen. Snapshot of %s, log end offset %s, last fetched %d",
snapshot.snapshotId(),
log.endOffset(),
log.lastFetchedEpoch()
Expand Down
4 changes: 2 additions & 2 deletions raft/src/main/java/org/apache/kafka/raft/LeaderState.java
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ else if (!that.endOffset.isPresent())
@Override
public String toString() {
return String.format(
"ReplicaState(nodeId=%s, endOffset=%s, lastFetchTimestamp=%s, hasAcknowledgedLeader=%s)",
"ReplicaState(nodeId=%d, endOffset=%s, lastFetchTimestamp=%s, hasAcknowledgedLeader=%s)",
nodeId,
endOffset,
lastFetchTimestamp,
Expand All @@ -372,7 +372,7 @@ public boolean canGrantVote(int candidateId, boolean isLogUpToDate) {
@Override
public String toString() {
return String.format(
"Leader(localId=%s, epoch=%s, epochStartOffset=%s, highWatermark=%s, voterStates=%s)",
"Leader(localId=%d, epoch=%d, epochStartOffset=%d, highWatermark=%s, voterStates=%s)",
localId,
epoch,
epochStartOffset,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public synchronized void handleCommit(BatchReader<Integer> reader) {
if (nextCommitted != committed + 1) {
throw new AssertionError(
String.format(
"Expected next committed value to be %s, but instead found %s on node %s",
"Expected next committed value to be %d, but instead found %d on node %d",
committed + 1,
nextCommitted,
nodeId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ private BatchBuilder<T> maybeAllocateBatch(
if (bytesNeeded.isPresent() && bytesNeeded.getAsInt() > maxBatchSize) {
throw new RecordBatchTooLargeException(
String.format(
"The total record(s) size of %s exceeds the maximum allowed batch size of %s",
"The total record(s) size of %d exceeds the maximum allowed batch size of %d",
bytesNeeded.getAsInt(),
maxBatchSize
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public Queue<StreamsException> missingSourceTopicExceptions() {

return new StreamsException(
new MissingSourceTopicException(String.format(
"Missing source topics %s for subtopology %s of topology %s",
"Missing source topics %s for subtopology %d of topology %s",
missingSourceTopics, subtopologyId, topologyName)),
new TaskId(subtopologyId, 0, topologyName));
}).collect(Collectors.toCollection(LinkedList::new));
Expand Down