kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ij...@apache.org
Subject kafka git commit: KAFKA-6174; Add methods in AdminClient Options classes to restore binary compatibility with 0.11
Date Wed, 06 Dec 2017 13:57:25 GMT
Repository: kafka
Updated Branches:
  refs/heads/1.0 8bd7d107c -> d4f006995


KAFKA-6174; Add methods in AdminClient Options classes to restore binary compatibility with
0.11

>From 0.11 to 1.0, we moved `DescribeClusterOptions timeoutMs(Integer timeoutMs)` from
DescribeClusterOptions to AbstractOptions (similarly for other Options classes). This can
cause code compiled against 0.11.0.x to fail when it is executed with 1.0 kafka-clients jar.
This patch adds back these methods to restore binary compatibility with 0.11.

Author: Dong Lin <lindong28@gmail.com>

Reviewers: Ismael Juma <ismael@juma.me.uk>

Closes #4257 from lindong28/KAFKA-6174

(cherry picked from commit 078fd2136524409711e535544ac8960135064df3)
Signed-off-by: Ismael Juma <ismael@juma.me.uk>


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/d4f00699
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/d4f00699
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/d4f00699

Branch: refs/heads/1.0
Commit: d4f0069959fdedc0dd4d40ea66ba9ac8256270dd
Parents: 8bd7d10
Author: Dong Lin <lindong28@gmail.com>
Authored: Wed Dec 6 15:47:27 2017 +0200
Committer: Ismael Juma <ismael@juma.me.uk>
Committed: Wed Dec 6 15:57:15 2017 +0200

----------------------------------------------------------------------
 .../org/apache/kafka/clients/admin/AbstractOptions.java  |  2 +-
 .../apache/kafka/clients/admin/AlterConfigsOptions.java  | 11 +++++++++++
 .../apache/kafka/clients/admin/CreateAclsOptions.java    | 11 +++++++++++
 .../apache/kafka/clients/admin/CreateTopicsOptions.java  | 11 +++++++++++
 .../apache/kafka/clients/admin/DeleteAclsOptions.java    | 11 +++++++++++
 .../apache/kafka/clients/admin/DeleteTopicsOptions.java  | 11 +++++++++++
 .../apache/kafka/clients/admin/DescribeAclsOptions.java  | 11 +++++++++++
 .../kafka/clients/admin/DescribeClusterOptions.java      | 11 +++++++++++
 .../kafka/clients/admin/DescribeConfigsOptions.java      | 11 +++++++++++
 .../kafka/clients/admin/DescribeTopicsOptions.java       | 11 +++++++++++
 .../apache/kafka/clients/admin/ListTopicsOptions.java    | 11 +++++++++++
 docs/upgrade.html                                        | 10 ++++++++--
 12 files changed, 119 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/d4f00699/clients/src/main/java/org/apache/kafka/clients/admin/AbstractOptions.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/clients/admin/AbstractOptions.java b/clients/src/main/java/org/apache/kafka/clients/admin/AbstractOptions.java
index d3085c3..ccccf11 100644
--- a/clients/src/main/java/org/apache/kafka/clients/admin/AbstractOptions.java
+++ b/clients/src/main/java/org/apache/kafka/clients/admin/AbstractOptions.java
@@ -23,7 +23,7 @@ package org.apache.kafka.clients.admin;
  */
 public abstract class AbstractOptions<T extends AbstractOptions> {
 
-    private Integer timeoutMs = null;
+    protected Integer timeoutMs = null;
 
     /**
      * Set the request timeout in milliseconds for this operation or {@code null} if the
default request timeout for the

http://git-wip-us.apache.org/repos/asf/kafka/blob/d4f00699/clients/src/main/java/org/apache/kafka/clients/admin/AlterConfigsOptions.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/clients/admin/AlterConfigsOptions.java
b/clients/src/main/java/org/apache/kafka/clients/admin/AlterConfigsOptions.java
index 7c84e05..2dbeba2 100644
--- a/clients/src/main/java/org/apache/kafka/clients/admin/AlterConfigsOptions.java
+++ b/clients/src/main/java/org/apache/kafka/clients/admin/AlterConfigsOptions.java
@@ -32,6 +32,17 @@ public class AlterConfigsOptions extends AbstractOptions<AlterConfigsOptions>
{
     private boolean validateOnly = false;
 
     /**
+     * Set the request timeout in milliseconds for this operation or {@code null} if the
default request timeout for the
+     * AdminClient should be used.
+     *
+     */
+    // This method is retained to keep binary compatibility with 0.11
+    public AlterConfigsOptions timeoutMs(Integer timeoutMs) {
+        this.timeoutMs = timeoutMs;
+        return this;
+    }
+
+    /**
      * Return true if the request should be validated without altering the configs.
      */
     public boolean shouldValidateOnly() {

http://git-wip-us.apache.org/repos/asf/kafka/blob/d4f00699/clients/src/main/java/org/apache/kafka/clients/admin/CreateAclsOptions.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/clients/admin/CreateAclsOptions.java b/clients/src/main/java/org/apache/kafka/clients/admin/CreateAclsOptions.java
index 410f079..a7b92ba 100644
--- a/clients/src/main/java/org/apache/kafka/clients/admin/CreateAclsOptions.java
+++ b/clients/src/main/java/org/apache/kafka/clients/admin/CreateAclsOptions.java
@@ -29,4 +29,15 @@ import java.util.Collection;
 @InterfaceStability.Evolving
 public class CreateAclsOptions extends AbstractOptions<CreateAclsOptions> {
 
+    /**
+     * Set the request timeout in milliseconds for this operation or {@code null} if the
default request timeout for the
+     * AdminClient should be used.
+     *
+     */
+    // This method is retained to keep binary compatibility with 0.11
+    public CreateAclsOptions timeoutMs(Integer timeoutMs) {
+        this.timeoutMs = timeoutMs;
+        return this;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/kafka/blob/d4f00699/clients/src/main/java/org/apache/kafka/clients/admin/CreateTopicsOptions.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/clients/admin/CreateTopicsOptions.java
b/clients/src/main/java/org/apache/kafka/clients/admin/CreateTopicsOptions.java
index 7d4bd9e..7cd0df8 100644
--- a/clients/src/main/java/org/apache/kafka/clients/admin/CreateTopicsOptions.java
+++ b/clients/src/main/java/org/apache/kafka/clients/admin/CreateTopicsOptions.java
@@ -32,6 +32,17 @@ public class CreateTopicsOptions extends AbstractOptions<CreateTopicsOptions>
{
     private boolean validateOnly = false;
 
     /**
+     * Set the request timeout in milliseconds for this operation or {@code null} if the
default request timeout for the
+     * AdminClient should be used.
+     *
+     */
+    // This method is retained to keep binary compatibility with 0.11
+    public CreateTopicsOptions timeoutMs(Integer timeoutMs) {
+        this.timeoutMs = timeoutMs;
+        return this;
+    }
+
+    /**
      * Set to true if the request should be validated without creating the topic.
      */
     public CreateTopicsOptions validateOnly(boolean validateOnly) {

http://git-wip-us.apache.org/repos/asf/kafka/blob/d4f00699/clients/src/main/java/org/apache/kafka/clients/admin/DeleteAclsOptions.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/clients/admin/DeleteAclsOptions.java b/clients/src/main/java/org/apache/kafka/clients/admin/DeleteAclsOptions.java
index ca57978..56f4b78 100644
--- a/clients/src/main/java/org/apache/kafka/clients/admin/DeleteAclsOptions.java
+++ b/clients/src/main/java/org/apache/kafka/clients/admin/DeleteAclsOptions.java
@@ -29,4 +29,15 @@ import java.util.Collection;
 @InterfaceStability.Evolving
 public class DeleteAclsOptions extends AbstractOptions<DeleteAclsOptions> {
 
+    /**
+     * Set the request timeout in milliseconds for this operation or {@code null} if the
default request timeout for the
+     * AdminClient should be used.
+     *
+     */
+    // This method is retained to keep binary compatibility with 0.11
+    public DeleteAclsOptions timeoutMs(Integer timeoutMs) {
+        this.timeoutMs = timeoutMs;
+        return this;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/kafka/blob/d4f00699/clients/src/main/java/org/apache/kafka/clients/admin/DeleteTopicsOptions.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/clients/admin/DeleteTopicsOptions.java
b/clients/src/main/java/org/apache/kafka/clients/admin/DeleteTopicsOptions.java
index d7c5af3..27c9af9 100644
--- a/clients/src/main/java/org/apache/kafka/clients/admin/DeleteTopicsOptions.java
+++ b/clients/src/main/java/org/apache/kafka/clients/admin/DeleteTopicsOptions.java
@@ -29,4 +29,15 @@ import java.util.Collection;
 @InterfaceStability.Evolving
 public class DeleteTopicsOptions extends AbstractOptions<DeleteTopicsOptions> {
 
+    /**
+     * Set the request timeout in milliseconds for this operation or {@code null} if the
default request timeout for the
+     * AdminClient should be used.
+     *
+     */
+    // This method is retained to keep binary compatibility with 0.11
+    public DeleteTopicsOptions timeoutMs(Integer timeoutMs) {
+        this.timeoutMs = timeoutMs;
+        return this;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/kafka/blob/d4f00699/clients/src/main/java/org/apache/kafka/clients/admin/DescribeAclsOptions.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/clients/admin/DescribeAclsOptions.java
b/clients/src/main/java/org/apache/kafka/clients/admin/DescribeAclsOptions.java
index 097cd19..89ba4bc 100644
--- a/clients/src/main/java/org/apache/kafka/clients/admin/DescribeAclsOptions.java
+++ b/clients/src/main/java/org/apache/kafka/clients/admin/DescribeAclsOptions.java
@@ -28,4 +28,15 @@ import org.apache.kafka.common.annotation.InterfaceStability;
 @InterfaceStability.Evolving
 public class DescribeAclsOptions extends AbstractOptions<DescribeAclsOptions> {
 
+    /**
+     * Set the request timeout in milliseconds for this operation or {@code null} if the
default request timeout for the
+     * AdminClient should be used.
+     *
+     */
+    // This method is retained to keep binary compatibility with 0.11
+    public DescribeAclsOptions timeoutMs(Integer timeoutMs) {
+        this.timeoutMs = timeoutMs;
+        return this;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/kafka/blob/d4f00699/clients/src/main/java/org/apache/kafka/clients/admin/DescribeClusterOptions.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/clients/admin/DescribeClusterOptions.java
b/clients/src/main/java/org/apache/kafka/clients/admin/DescribeClusterOptions.java
index cb5652b..92640fd 100644
--- a/clients/src/main/java/org/apache/kafka/clients/admin/DescribeClusterOptions.java
+++ b/clients/src/main/java/org/apache/kafka/clients/admin/DescribeClusterOptions.java
@@ -27,4 +27,15 @@ import org.apache.kafka.common.annotation.InterfaceStability;
 @InterfaceStability.Evolving
 public class DescribeClusterOptions extends AbstractOptions<DescribeClusterOptions>
{
 
+    /**
+     * Set the request timeout in milliseconds for this operation or {@code null} if the
default request timeout for the
+     * AdminClient should be used.
+     *
+     */
+    // This method is retained to keep binary compatibility with 0.11
+    public DescribeClusterOptions timeoutMs(Integer timeoutMs) {
+        this.timeoutMs = timeoutMs;
+        return this;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/kafka/blob/d4f00699/clients/src/main/java/org/apache/kafka/clients/admin/DescribeConfigsOptions.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/clients/admin/DescribeConfigsOptions.java
b/clients/src/main/java/org/apache/kafka/clients/admin/DescribeConfigsOptions.java
index bb37e6b..b0b9b3c 100644
--- a/clients/src/main/java/org/apache/kafka/clients/admin/DescribeConfigsOptions.java
+++ b/clients/src/main/java/org/apache/kafka/clients/admin/DescribeConfigsOptions.java
@@ -29,4 +29,15 @@ import java.util.Collection;
 @InterfaceStability.Evolving
 public class DescribeConfigsOptions extends AbstractOptions<DescribeConfigsOptions>
{
 
+    /**
+     * Set the request timeout in milliseconds for this operation or {@code null} if the
default request timeout for the
+     * AdminClient should be used.
+     *
+     */
+    // This method is retained to keep binary compatibility with 0.11
+    public DescribeConfigsOptions timeoutMs(Integer timeoutMs) {
+        this.timeoutMs = timeoutMs;
+        return this;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/kafka/blob/d4f00699/clients/src/main/java/org/apache/kafka/clients/admin/DescribeTopicsOptions.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/clients/admin/DescribeTopicsOptions.java
b/clients/src/main/java/org/apache/kafka/clients/admin/DescribeTopicsOptions.java
index 64ead48..cc3d420 100644
--- a/clients/src/main/java/org/apache/kafka/clients/admin/DescribeTopicsOptions.java
+++ b/clients/src/main/java/org/apache/kafka/clients/admin/DescribeTopicsOptions.java
@@ -29,4 +29,15 @@ import java.util.Collection;
 @InterfaceStability.Evolving
 public class DescribeTopicsOptions extends AbstractOptions<DescribeTopicsOptions> {
 
+    /**
+     * Set the request timeout in milliseconds for this operation or {@code null} if the
default request timeout for the
+     * AdminClient should be used.
+     *
+     */
+    // This method is retained to keep binary compatibility with 0.11
+    public DescribeTopicsOptions timeoutMs(Integer timeoutMs) {
+        this.timeoutMs = timeoutMs;
+        return this;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/kafka/blob/d4f00699/clients/src/main/java/org/apache/kafka/clients/admin/ListTopicsOptions.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/clients/admin/ListTopicsOptions.java b/clients/src/main/java/org/apache/kafka/clients/admin/ListTopicsOptions.java
index f656ff4..1431494 100644
--- a/clients/src/main/java/org/apache/kafka/clients/admin/ListTopicsOptions.java
+++ b/clients/src/main/java/org/apache/kafka/clients/admin/ListTopicsOptions.java
@@ -30,6 +30,17 @@ public class ListTopicsOptions extends AbstractOptions<ListTopicsOptions>
{
     private boolean listInternal = false;
 
     /**
+     * Set the request timeout in milliseconds for this operation or {@code null} if the
default request timeout for the
+     * AdminClient should be used.
+     *
+     */
+    // This method is retained to keep binary compatibility with 0.11
+    public ListTopicsOptions timeoutMs(Integer timeoutMs) {
+        this.timeoutMs = timeoutMs;
+        return this;
+    }
+
+    /**
      * Set whether we should list internal topics.
      *
      * @param listInternal  Whether we should list internal topics.  null means to use

http://git-wip-us.apache.org/repos/asf/kafka/blob/d4f00699/docs/upgrade.html
----------------------------------------------------------------------
diff --git a/docs/upgrade.html b/docs/upgrade.html
index 27c7081..bc5bb57 100644
--- a/docs/upgrade.html
+++ b/docs/upgrade.html
@@ -30,7 +30,7 @@
     <li> Update server.properties on all brokers and add the following properties.
CURRENT_KAFKA_VERSION refers to the version you
         are upgrading from. CURRENT_MESSAGE_FORMAT_VERSION refers to the message format version
currently in use. If you have previously
         overridden the message format version, you should keep its current value. Alternatively,
if you are upgrading from a version prior
-        to 0.11.0.x, then CURRENT_MESSAGE_FORMAT_VERSION should be set to match CURRENT_KAFKA_VERSION.

+        to 0.11.0.x, then CURRENT_MESSAGE_FORMAT_VERSION should be set to match CURRENT_KAFKA_VERSION.
         <ul>
             <li>inter.broker.protocol.version=CURRENT_KAFKA_VERSION (e.g. 0.8.2, 0.9.0,
0.10.0, 0.10.1, 0.10.2, 0.11.0).</li>
             <li>log.message.format.version=CURRENT_MESSAGE_FORMAT_VERSION  (See <a
href="#upgrade_10_performance_impact">potential performance impact
@@ -47,7 +47,7 @@
     <li> Restart the brokers one by one for the new protocol version to take effect.
</li>
     <li> If you have overridden the message format version as instructed above, then
you need to do one more rolling restart to
         upgrade it to its latest version. Once all (or most) consumers have been upgraded
to 0.11.0 or later,
-        change log.message.format.version to 1.0 on each broker and restart them one by one.
Note that the older Scala consumer 
+        change log.message.format.version to 1.0 on each broker and restart them one by one.
Note that the older Scala consumer
         does not support the new message format introduced in 0.11, so to avoid the performance
cost of down-conversion (or to
         take advantage of <a href="#upgrade_11_exactly_once_semantics">exactly once
semantics</a>), the newer Java consumer must be used.</li>
 </ol>
@@ -61,6 +61,12 @@
         Similarly for the message format version.</li>
 </ol>
 
+<h5><a id="upgrade_101_notable" href="#upgrade_101_notable">Notable changes in
1.0.1</a></h5>
+<ul>
+    <li>Restored binary compatibility of AdminClient's Options classes (e.g. CreateTopicsOptions,
DeleteTopicsOptions, etc.) with
+        0.11.0.x. Binary (but not source) compatibility had been broken inadvertently in
1.0.0.</li>
+</ul>
+
 <h5><a id="upgrade_100_notable" href="#upgrade_100_notable">Notable changes in
1.0.0</a></h5>
 <ul>
     <li>Topic deletion is now enabled by default, since the functionality is now stable.
Users who wish to


Mime
View raw message