You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by gw...@apache.org on 2016/04/30 02:27:07 UTC
kafka git commit: KAFKA-3644; Use Boolean protocol type for StopReplicaRequest delete_p…
Repository: kafka
Updated Branches:
refs/heads/trunk 94d1878a9 -> 9eaf529ff
KAFKA-3644; Use Boolean protocol type for StopReplicaRequest delete_p…
…artitions
Author: Grant Henke <gr...@gmail.com>
Reviewers: Gwen Shapira
Closes #1296 from granthenke/stop-boolean
Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/9eaf529f
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/9eaf529f
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/9eaf529f
Branch: refs/heads/trunk
Commit: 9eaf529ffb168e44a461be24b666eee00fdaf497
Parents: 94d1878
Author: Grant Henke <gr...@gmail.com>
Authored: Fri Apr 29 17:27:02 2016 -0700
Committer: Gwen Shapira <cs...@gmail.com>
Committed: Fri Apr 29 17:27:02 2016 -0700
----------------------------------------------------------------------
.../java/org/apache/kafka/common/protocol/Protocol.java | 6 ++----
.../apache/kafka/common/requests/StopReplicaRequest.java | 4 ++--
.../kafka/common/requests/RequestResponseTest.java | 11 ++++++-----
3 files changed, 10 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kafka/blob/9eaf529f/clients/src/main/java/org/apache/kafka/common/protocol/Protocol.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/common/protocol/Protocol.java b/clients/src/main/java/org/apache/kafka/common/protocol/Protocol.java
index 99cdbf9..3644f9c 100644
--- a/clients/src/main/java/org/apache/kafka/common/protocol/Protocol.java
+++ b/clients/src/main/java/org/apache/kafka/common/protocol/Protocol.java
@@ -31,7 +31,6 @@ import static org.apache.kafka.common.protocol.types.Type.BYTES;
import static org.apache.kafka.common.protocol.types.Type.INT16;
import static org.apache.kafka.common.protocol.types.Type.INT32;
import static org.apache.kafka.common.protocol.types.Type.INT64;
-import static org.apache.kafka.common.protocol.types.Type.INT8;
import static org.apache.kafka.common.protocol.types.Type.STRING;
import static org.apache.kafka.common.protocol.types.Type.NULLABLE_STRING;
@@ -671,8 +670,7 @@ public class Protocol {
public static final Schema STOP_REPLICA_REQUEST_V0 = new Schema(new Field("controller_id", INT32, "The controller id."),
new Field("controller_epoch", INT32, "The controller epoch."),
- new Field("delete_partitions",
- INT8,
+ new Field("delete_partitions", BOOLEAN,
"Boolean which indicates if replica's partitions must be deleted."),
new Field("partitions",
new ArrayOf(STOP_REPLICA_REQUEST_PARTITION_V0)));
@@ -1008,4 +1006,4 @@ public class Protocol {
System.out.println(toHtml());
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/kafka/blob/9eaf529f/clients/src/main/java/org/apache/kafka/common/requests/StopReplicaRequest.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/common/requests/StopReplicaRequest.java b/clients/src/main/java/org/apache/kafka/common/requests/StopReplicaRequest.java
index 80223a1..bc63521 100644
--- a/clients/src/main/java/org/apache/kafka/common/requests/StopReplicaRequest.java
+++ b/clients/src/main/java/org/apache/kafka/common/requests/StopReplicaRequest.java
@@ -49,7 +49,7 @@ public class StopReplicaRequest extends AbstractRequest {
struct.set(CONTROLLER_ID_KEY_NAME, controllerId);
struct.set(CONTROLLER_EPOCH_KEY_NAME, controllerEpoch);
- struct.set(DELETE_PARTITIONS_KEY_NAME, deletePartitions ? (byte) 1 : (byte) 0);
+ struct.set(DELETE_PARTITIONS_KEY_NAME, deletePartitions);
List<Struct> partitionDatas = new ArrayList<>(partitions.size());
for (TopicPartition partition : partitions) {
@@ -80,7 +80,7 @@ public class StopReplicaRequest extends AbstractRequest {
controllerId = struct.getInt(CONTROLLER_ID_KEY_NAME);
controllerEpoch = struct.getInt(CONTROLLER_EPOCH_KEY_NAME);
- deletePartitions = ((byte) struct.get(DELETE_PARTITIONS_KEY_NAME)) != 0;
+ deletePartitions = struct.getBoolean(DELETE_PARTITIONS_KEY_NAME);
}
@Override
http://git-wip-us.apache.org/repos/asf/kafka/blob/9eaf529f/clients/src/test/java/org/apache/kafka/common/requests/RequestResponseTest.java
----------------------------------------------------------------------
diff --git a/clients/src/test/java/org/apache/kafka/common/requests/RequestResponseTest.java b/clients/src/test/java/org/apache/kafka/common/requests/RequestResponseTest.java
index 345de3f..043582d 100644
--- a/clients/src/test/java/org/apache/kafka/common/requests/RequestResponseTest.java
+++ b/clients/src/test/java/org/apache/kafka/common/requests/RequestResponseTest.java
@@ -83,8 +83,9 @@ public class RequestResponseTest {
createProduceRequest(),
createProduceRequest().getErrorResponse(2, new UnknownServerException()),
createProduceResponse(),
- createStopReplicaRequest(),
- createStopReplicaRequest().getErrorResponse(0, new UnknownServerException()),
+ createStopReplicaRequest(true),
+ createStopReplicaRequest(false),
+ createStopReplicaRequest(true).getErrorResponse(0, new UnknownServerException()),
createStopReplicaResponse(),
createUpdateMetadataRequest(2, "rack1"),
createUpdateMetadataRequest(2, null),
@@ -348,9 +349,9 @@ public class RequestResponseTest {
return new ProduceResponse(responseData, 0);
}
- private AbstractRequest createStopReplicaRequest() {
+ private AbstractRequest createStopReplicaRequest(boolean deletePartitions) {
Set<TopicPartition> partitions = new HashSet<>(Arrays.asList(new TopicPartition("test", 0)));
- return new StopReplicaRequest(0, 1, true, partitions);
+ return new StopReplicaRequest(0, 1, deletePartitions, partitions);
}
private AbstractRequestResponse createStopReplicaResponse() {
@@ -450,4 +451,4 @@ public class RequestResponseTest {
List<ApiVersionsResponse.ApiVersion> apiVersions = Arrays.asList(new ApiVersionsResponse.ApiVersion((short) 0, (short) 0, (short) 2));
return new ApiVersionsResponse(Errors.NONE.code(), apiVersions);
}
-}
\ No newline at end of file
+}