-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KAFKA-16717 support alter share group offsets
- Loading branch information
1 parent
239708f
commit f657a44
Showing
12 changed files
with
251 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,4 +39,4 @@ public KafkaFuture<Void> all() { | |
return result; | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
clients/src/main/java/org/apache/kafka/clients/admin/AlterShareGroupOffsetsOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.kafka.clients.admin; | ||
|
||
import org.apache.kafka.common.annotation.InterfaceStability; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* Options for the {@link Admin#alterShareGroupOffsets(String, Map, AlterShareGroupOffsetsOptions)} call. | ||
* <p> | ||
* The API of this class is evolving, see {@link Admin} for details. | ||
*/ | ||
@InterfaceStability.Evolving | ||
public class AlterShareGroupOffsetsOptions extends AbstractOptions<AlterShareGroupOffsetsOptions> { | ||
|
||
} |
55 changes: 55 additions & 0 deletions
55
clients/src/main/java/org/apache/kafka/clients/admin/AlterShareGroupOffsetsResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.kafka.clients.admin; | ||
|
||
import org.apache.kafka.common.KafkaFuture; | ||
import org.apache.kafka.common.TopicPartition; | ||
import org.apache.kafka.common.annotation.InterfaceStability; | ||
import org.apache.kafka.common.protocol.Errors; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* The result of the {@link Admin#alterShareGroupOffsets(String, Map, AlterShareGroupOffsetsOptions)} call. | ||
* <p> | ||
* The API of this class is evolving, see {@link Admin} for details. | ||
*/ | ||
@InterfaceStability.Evolving | ||
public class AlterShareGroupOffsetsResult { | ||
|
||
private final KafkaFuture<Map<TopicPartition, Errors>> future; | ||
|
||
AlterShareGroupOffsetsResult(KafkaFuture<Map<TopicPartition, Errors>> future) { | ||
this.future = future; | ||
} | ||
|
||
/** | ||
* Return a future which can be used to check the result for a given partition. | ||
*/ | ||
public KafkaFuture<Void> partitionResult(final TopicPartition partition) { | ||
return null; | ||
} | ||
|
||
/** | ||
* Return a future which succeeds if all the alter offsets succeed. | ||
*/ | ||
public KafkaFuture<Void> all() { | ||
return null; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
clients/src/main/java/org/apache/kafka/common/requests/AlterShareGroupOffsetsRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.apache.kafka.common.requests; | ||
|
||
import org.apache.kafka.common.message.AlterShareGroupOffsetsRequestData; | ||
import org.apache.kafka.common.protocol.ApiKeys; | ||
import org.apache.kafka.common.protocol.ByteBufferAccessor; | ||
|
||
import java.nio.ByteBuffer; | ||
|
||
public class AlterShareGroupOffsetsRequest extends AbstractRequest { | ||
|
||
private final AlterShareGroupOffsetsRequestData data; | ||
|
||
public AlterShareGroupOffsetsRequest(AlterShareGroupOffsetsRequestData data, short apiVersion) { | ||
super(ApiKeys.ALTER_PARTITION, apiVersion); | ||
this.data = data; | ||
} | ||
|
||
@Override | ||
public AlterShareGroupOffsetsRequestData data() { | ||
return data; | ||
} | ||
|
||
@Override | ||
public AbstractResponse getErrorResponse(int throttleTimeMs, Throwable e) { | ||
return null; | ||
} | ||
|
||
public static AlterShareGroupOffsetsRequest parse(ByteBuffer buffer, short version) { | ||
return new AlterShareGroupOffsetsRequest(new AlterShareGroupOffsetsRequestData(new ByteBufferAccessor(buffer), version), version); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
clients/src/main/resources/common/message/AlterShareGroupOffsetsRequest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one or more | ||
// contributor license agreements. See the NOTICE file distributed with | ||
// this work for additional information regarding copyright ownership. | ||
// The ASF licenses this file to You under the Apache License, Version 2.0 | ||
// (the "License"); you may not use this file except in compliance with | ||
// the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
{ | ||
"apiKey": 91, | ||
"type": "request", | ||
"listeners": ["broker"], | ||
"name": "AlterShareGroupOffsetsRequest", | ||
"validVersions": "0", | ||
"flexibleVersions": "0+", | ||
"fields": [ | ||
{ "name": "GroupId", "type": "string", "versions": "0+", "entityType": "groupId", | ||
"about": "The group identifier." }, | ||
{ "name": "Topics", "type": "[]AlterShareGroupOffsetsRequestTopic", "versions": "0+", | ||
"about": "The topics to alter offsets for.", "fields": [ | ||
{ "name": "TopicName", "type": "string", "versions": "0+", "entityType": "topicName", "mapKey": true, | ||
"about": "The topic name." }, | ||
{ "name": "Partitions", "type": "[]AlterShareGroupOffsetsRequestPartition", "versions": "0+", | ||
"about": "Each partition to alter offsets for.", "fields": [ | ||
{ "name": "PartitionIndex", "type": "int32", "versions": "0+", | ||
"about": "The partition index." }, | ||
{ "name": "StartOffset", "type": "int64", "versions": "0+", | ||
"about": "The share-partition start offset." } | ||
]} | ||
]} | ||
] | ||
} |
37 changes: 37 additions & 0 deletions
37
clients/src/main/resources/common/message/AlterShareGroupOffsetsResponse.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
{ | ||
"apiKey": 91, | ||
"type": "response", | ||
"name": "AlterShareGroupOffsetsResponse", | ||
"validVersions": "0", | ||
"flexibleVersions": "0+", | ||
// Supported errors: | ||
// - GROUP_AUTHORIZATION_FAILED (version 0+) | ||
// - NOT_COORDINATOR (version 0+) | ||
// - COORDINATOR_NOT_AVAILABLE (version 0+) | ||
// - COORDINATOR_LOAD_IN_PROGRESS (version 0+) | ||
// - GROUP_ID_NOT_FOUND (version 0+) | ||
// - GROUP_NOT_EMPTY (version 0+) | ||
// - KAFKA_STORAGE_ERROR (version 0+) | ||
// - INVALID_REQUEST (version 0+) | ||
// - UNKNOWN_SERVER_ERROR (version 0+) | ||
"fields": [ | ||
{ "name": "ThrottleTimeMs", "type": "int32", "versions": "0+", | ||
"about": "The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota." }, | ||
{ "name": "Responses", "type": "[]AlterShareGroupOffsetsResponseTopic", "versions": "0+", | ||
"about": "The results for each topic.", "fields": [ | ||
{ "name": "TopicName", "type": "string", "versions": "0+", "entityType": "topicName", | ||
"about": "The topic name." }, | ||
{ "name": "TopicId", "type": "uuid", "versions": "0+", | ||
"about": "The unique topic ID." }, | ||
{ "name": "Partitions", "type": "[]AlterShareGroupOffsetsResponsePartition", "versions": "0+", "fields": [ | ||
{ "name": "PartitionIndex", "type": "int32", "versions": "0+", | ||
"about": "The partition index." }, | ||
{ "name": "ErrorCode", "type": "int16", "versions": "0+", | ||
"about": "The error code, or 0 if there was no error." }, | ||
{ "name": "ErrorMessage", "type": "string", "versions": "0+", "nullableVersions": "0+", "default": "null", | ||
"about": "The error message, or null if there was no error." } | ||
]} | ||
]} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters