Skip to content

Commit 4d6535e

Browse files
authored
KAFKA-18290 Remove deprecated methods of FeatureUpdate (apache#18246)
Reviewers: Chia-Ping Tsai <[email protected]>
1 parent 1a3dce7 commit 4d6535e

File tree

3 files changed

+23
-28
lines changed

3 files changed

+23
-28
lines changed

clients/src/main/java/org/apache/kafka/clients/admin/Admin.java

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,14 +1443,23 @@ default DescribeFeaturesResult describeFeatures() {
14431443
* error code for each supplied {@link FeatureUpdate}, and the code indicates if the update
14441444
* succeeded or failed in the controller.
14451445
* <ul>
1446-
* <li>Downgrade of feature version level is not a regular operation/intent. It is only allowed
1447-
* in the controller if the {@link FeatureUpdate} has the allowDowngrade flag set. Setting this
1448-
* flag conveys user intent to attempt downgrade of a feature max version level. Note that
1449-
* despite the allowDowngrade flag being set, certain downgrades may be rejected by the
1450-
* controller if it is deemed impossible.</li>
1451-
* <li>Deletion of a finalized feature version is not a regular operation/intent. It could be
1452-
* done by setting the allowDowngrade flag to true in the {@link FeatureUpdate}, and, setting
1453-
* the max version level to a value less than 1.</li>
1446+
* <li>Downgrading a feature version level is not a common operation and should only be
1447+
* performed when necessary. It is permitted only if the {@link FeatureUpdate} specifies the
1448+
* {@code upgradeType} as either {@link FeatureUpdate.UpgradeType#SAFE_DOWNGRADE} or
1449+
* {@link FeatureUpdate.UpgradeType#UNSAFE_DOWNGRADE}.
1450+
* <ul>
1451+
* <li>{@code SAFE_DOWNGRADE}: Allows downgrades that do not lead to metadata loss.</li>
1452+
* <li>{@code UNSAFE_DOWNGRADE}: Permits downgrades that might result in metadata loss.</li>
1453+
* </ul>
1454+
* Note that even with these settings, certain downgrades may still be rejected by the controller
1455+
* if they are considered unsafe or impossible.</li>
1456+
* <li>Deleting a finalized feature version is also not a common operation. To delete a feature,
1457+
* set the {@code maxVersionLevel} to zero and specify the {@code upgradeType} as either
1458+
* {@link FeatureUpdate.UpgradeType#SAFE_DOWNGRADE} or
1459+
* {@link FeatureUpdate.UpgradeType#UNSAFE_DOWNGRADE}.</li>
1460+
* <li>The {@link FeatureUpdate.UpgradeType#UPGRADE} type cannot be used when the
1461+
* {@code maxVersionLevel} is zero. Attempting to do so will result in an
1462+
* {@link IllegalArgumentException}.</li>
14541463
* </ul>
14551464
* <p>
14561465
* The following exceptions can be anticipated when calling {@code get()} on the futures

clients/src/main/java/org/apache/kafka/clients/admin/FeatureUpdate.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,6 @@ public static UpgradeType fromCode(int code) {
5454
}
5555
}
5656

57-
/**
58-
* @param maxVersionLevel the new maximum version level for the finalized feature.
59-
* a value of zero is special and indicates that the update is intended to
60-
* delete the finalized feature, and should be accompanied by setting
61-
* the allowDowngrade flag to true.
62-
* @param allowDowngrade - true, if this feature update was meant to downgrade the existing
63-
* maximum version level of the finalized feature. Only "safe" downgrades are
64-
* enabled with this boolean. See {@link FeatureUpdate#FeatureUpdate(short, UpgradeType)}
65-
* - false, otherwise.
66-
*/
67-
@Deprecated
68-
public FeatureUpdate(final short maxVersionLevel, final boolean allowDowngrade) {
69-
this(maxVersionLevel, allowDowngrade ? UpgradeType.SAFE_DOWNGRADE : UpgradeType.UPGRADE);
70-
}
71-
7257
/**
7358
* @param maxVersionLevel The new maximum version level for the finalized feature.
7459
* a value of zero is special and indicates that the update is intended to
@@ -96,11 +81,6 @@ public short maxVersionLevel() {
9681
return maxVersionLevel;
9782
}
9883

99-
@Deprecated
100-
public boolean allowDowngrade() {
101-
return upgradeType != UpgradeType.UPGRADE;
102-
}
103-
10484
public UpgradeType upgradeType() {
10585
return upgradeType;
10686
}

docs/upgrade.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,12 @@ <h5><a id="upgrade_400_notable" href="#upgrade_400_notable">Notable changes in 4
221221
The deprecated <code>dryRun</code> methods were removed from the <code>org.apache.kafka.clients.admin.UpdateFeaturesOptions</code>.
222222
Please use <code>validateOnly</code> instead.
223223
</li>
224+
<li>The constructor <code>org.apache.kafka.clients.admin.FeatureUpdate</code> with short and boolean arguments was removed.
225+
Please use the constructor that accepts short and the specified UpgradeType enum instead.
226+
</li>
227+
<li>
228+
The <code>allowDowngrade</code> method was removed from the <code>org.apache.kafka.clients.admin.FeatureUpdate</code>.
229+
</li>
224230
<li>The <code>org.apache.kafka.clients.admin.DescribeTopicsResult.DescribeTopicsResult(Map&lt;String, KafkaFuture&lt;TopicDescription&gt;&gt;)</code> method was removed.
225231
Please use <code>org.apache.kafka.clients.admin.DescribeTopicsResult.DescribeTopicsResult(Map&lt;Uuid, KafkaFuture&lt;TopicDescription&gt;&gt;, Map&lt;String, KafkaFuture&lt;TopicDescription&gt;&gt;)</code> instead.
226232
</li>

0 commit comments

Comments
 (0)