Skip to content

Commit 6a4207f

Browse files
KAFKA-19158: Add SHARE_SESSION_LIMIT_REACHED error code (#19492)
Add the new `SHARE_SESSION_LIMIT_REACHED` error code which is used when an attempt is made to open a new share session when the share session limit of the broker has already been reached. Support in the client and broker will follow in subsequent PRs. Reviewers: Lianet Magrans <[email protected]>
1 parent 3d353eb commit 6a4207f

File tree

3 files changed

+36
-8
lines changed

3 files changed

+36
-8
lines changed

Diff for: clients/src/main/java/org/apache/kafka/common/errors/GroupMaxSizeReachedException.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package org.apache.kafka.common.errors;
1818

1919
/**
20-
* Indicates that a consumer group is already at its configured maximum capacity and cannot accommodate more members
20+
* Indicates that a group is already at its configured maximum capacity and cannot accommodate more members
2121
*/
2222
public class GroupMaxSizeReachedException extends ApiException {
2323
private static final long serialVersionUID = 1L;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package org.apache.kafka.common.errors;
18+
19+
/**
20+
* Indicates that a new share session could not be opened because the limit of share sessions has been reached.
21+
*/
22+
public class ShareSessionLimitReachedException extends RetriableException {
23+
24+
private static final long serialVersionUID = 1L;
25+
26+
public ShareSessionLimitReachedException(String message) {
27+
super(message);
28+
}
29+
}

Diff for: clients/src/main/java/org/apache/kafka/common/protocol/Errors.java

+6-7
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@
115115
import org.apache.kafka.common.errors.RetriableException;
116116
import org.apache.kafka.common.errors.SaslAuthenticationException;
117117
import org.apache.kafka.common.errors.SecurityDisabledException;
118+
import org.apache.kafka.common.errors.ShareSessionLimitReachedException;
118119
import org.apache.kafka.common.errors.ShareSessionNotFoundException;
119120
import org.apache.kafka.common.errors.SnapshotNotFoundException;
120121
import org.apache.kafka.common.errors.StaleBrokerEpochException;
@@ -357,7 +358,7 @@ public enum Errors {
357358
MemberIdRequiredException::new),
358359
PREFERRED_LEADER_NOT_AVAILABLE(80, "The preferred leader was not available.",
359360
PreferredLeaderNotAvailableException::new),
360-
GROUP_MAX_SIZE_REACHED(81, "The consumer group has reached its max size.", GroupMaxSizeReachedException::new),
361+
GROUP_MAX_SIZE_REACHED(81, "The group has reached its maximum size.", GroupMaxSizeReachedException::new),
361362
FENCED_INSTANCE_ID(82, "The broker rejected this static consumer since " +
362363
"another consumer with the same group.instance.id has registered with a different member.id.",
363364
FencedInstanceIdException::new),
@@ -383,10 +384,7 @@ public enum Errors {
383384
PRINCIPAL_DESERIALIZATION_FAILURE(97, "Request principal deserialization failed during forwarding. " +
384385
"This indicates an internal error on the broker cluster security setup.", PrincipalDeserializationException::new),
385386
SNAPSHOT_NOT_FOUND(98, "Requested snapshot was not found.", SnapshotNotFoundException::new),
386-
POSITION_OUT_OF_RANGE(
387-
99,
388-
"Requested position is not greater than or equal to zero, and less than the size of the snapshot.",
389-
PositionOutOfRangeException::new),
387+
POSITION_OUT_OF_RANGE(99, "Requested position is not greater than or equal to zero, and less than the size of the snapshot.", PositionOutOfRangeException::new),
390388
UNKNOWN_TOPIC_ID(100, "This server does not host this topic ID.", UnknownTopicIdException::new),
391389
DUPLICATE_BROKER_REGISTRATION(101, "This broker ID is already in use.", DuplicateBrokerRegistrationException::new),
392390
BROKER_ID_NOT_REGISTERED(102, "The given broker ID was not registered.", BrokerIdNotRegisteredException::new),
@@ -416,10 +414,11 @@ public enum Errors {
416414
DUPLICATE_VOTER(126, "The voter is already part of the set of voters.", DuplicateVoterException::new),
417415
VOTER_NOT_FOUND(127, "The voter is not part of the set of voters.", VoterNotFoundException::new),
418416
INVALID_REGULAR_EXPRESSION(128, "The regular expression is not valid.", InvalidRegularExpression::new),
419-
REBOOTSTRAP_REQUIRED(129, "Client metadata is stale, client should rebootstrap to obtain new metadata.", RebootstrapRequiredException::new),
417+
REBOOTSTRAP_REQUIRED(129, "Client metadata is stale. The client should rebootstrap to obtain new metadata.", RebootstrapRequiredException::new),
420418
STREAMS_INVALID_TOPOLOGY(130, "The supplied topology is invalid.", StreamsInvalidTopologyException::new),
421419
STREAMS_INVALID_TOPOLOGY_EPOCH(131, "The supplied topology epoch is invalid.", StreamsInvalidTopologyEpochException::new),
422-
STREAMS_TOPOLOGY_FENCED(132, "The supplied topology epoch is outdated.", StreamsTopologyFencedException::new);
420+
STREAMS_TOPOLOGY_FENCED(132, "The supplied topology epoch is outdated.", StreamsTopologyFencedException::new),
421+
SHARE_SESSION_LIMIT_REACHED(133, "The limit of share sessions has been reached.", ShareSessionLimitReachedException::new);
423422

424423
private static final Logger log = LoggerFactory.getLogger(Errors.class);
425424

0 commit comments

Comments
 (0)