You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "clarkwtc (via GitHub)" <gi...@apache.org> on 2025/03/01 17:35:52 UTC
[PR] KAFKA-18907: Add suitable error message when the appended value is too larger [kafka]
clarkwtc opened a new pull request, #19070:
URL: https://github.com/apache/kafka/pull/19070
KRaft mode does not allow the `ConfigRecord` to exceed a maximum value size of `Short.MAX_VALUE`.
Add a `DISALLOWED_CONFIG_VALUE_SIZE_ERROR` while the configuration value exceeds a maximum value size of `Short.MAX_VALUE`.
Append a test for exceeding the maximum value size of `Short.MAX_VALUE` to the `testIncrementalAlterConfig` method in `ConfigurationControlManagerTest`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18907: Add suitable error message when the appended value is too larger [kafka]
Posted by "clarkwtc (via GitHub)" <gi...@apache.org>.
clarkwtc commented on code in PR #19070:
URL: https://github.com/apache/kafka/pull/19070#discussion_r1976542126
##########
metadata/src/main/java/org/apache/kafka/controller/ConfigurationControlManager.java:
##########
@@ -339,6 +339,8 @@ private ApiError validateAlterConfig(
return DISALLOWED_CLUSTER_MIN_ISR_REMOVAL_ERROR;
} else if (configRecord.value() == null) {
allConfigs.remove(configRecord.name());
+ } else if (configRecord.value().length() > Short.MAX_VALUE) {
+ return DISALLOWED_CONFIG_VALUE_SIZE_ERROR;
Review Comment:
Thank you for your comment.
Sure, I’ve added a comment to handle this condition.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18907: Add suitable error message when the appended value is too larger [kafka]
Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 merged PR #19070:
URL: https://github.com/apache/kafka/pull/19070
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18907: Add suitable error message when the appended value is too larger [kafka]
Posted by "clarkwtc (via GitHub)" <gi...@apache.org>.
clarkwtc commented on code in PR #19070:
URL: https://github.com/apache/kafka/pull/19070#discussion_r1976542126
##########
metadata/src/main/java/org/apache/kafka/controller/ConfigurationControlManager.java:
##########
@@ -339,6 +339,8 @@ private ApiError validateAlterConfig(
return DISALLOWED_CLUSTER_MIN_ISR_REMOVAL_ERROR;
} else if (configRecord.value() == null) {
allConfigs.remove(configRecord.name());
+ } else if (configRecord.value().length() > Short.MAX_VALUE) {
+ return DISALLOWED_CONFIG_VALUE_SIZE_ERROR;
Review Comment:
Thank you for your comment.
Sure, I’ve added a comment to handle this action.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18907: Add suitable error message when the appended value is too larger [kafka]
Posted by "clarkwtc (via GitHub)" <gi...@apache.org>.
clarkwtc commented on code in PR #19070:
URL: https://github.com/apache/kafka/pull/19070#discussion_r1976669347
##########
metadata/src/main/java/org/apache/kafka/controller/ConfigurationControlManager.java:
##########
@@ -385,6 +388,10 @@ private ApiError validateAlterConfig(
new ApiError(INVALID_CONFIG, "Cluster-level " + MIN_IN_SYNC_REPLICAS_CONFIG +
" cannot be removed while ELR is enabled.");
+ private static final ApiError DISALLOWED_CONFIG_VALUE_SIZE_ERROR =
+ new ApiError(INVALID_CONFIG, String.format("The configuration value cannot be added because " +
+ "it exceeds the maximum value size of %d bytes.", Short.MAX_VALUE));
Review Comment:
@frankvicky
I originally thought `String.format` would be more readable than using the appending string.
Sure, we should follow the code style.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18907: Add suitable error message when the appended value is too larger [kafka]
Posted by "frankvicky (via GitHub)" <gi...@apache.org>.
frankvicky commented on code in PR #19070:
URL: https://github.com/apache/kafka/pull/19070#discussion_r1976597193
##########
metadata/src/main/java/org/apache/kafka/controller/ConfigurationControlManager.java:
##########
@@ -385,6 +388,10 @@ private ApiError validateAlterConfig(
new ApiError(INVALID_CONFIG, "Cluster-level " + MIN_IN_SYNC_REPLICAS_CONFIG +
" cannot be removed while ELR is enabled.");
+ private static final ApiError DISALLOWED_CONFIG_VALUE_SIZE_ERROR =
+ new ApiError(INVALID_CONFIG, String.format("The configuration value cannot be added because " +
+ "it exceeds the maximum value size of %d bytes.", Short.MAX_VALUE));
Review Comment:
Is there any reason for using `String.format`?
We should keep the style consistent.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18907: Add suitable error message when the appended value is too larger [kafka]
Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on code in PR #19070:
URL: https://github.com/apache/kafka/pull/19070#discussion_r1976527577
##########
metadata/src/main/java/org/apache/kafka/controller/ConfigurationControlManager.java:
##########
@@ -339,6 +339,8 @@ private ApiError validateAlterConfig(
return DISALLOWED_CLUSTER_MIN_ISR_REMOVAL_ERROR;
} else if (configRecord.value() == null) {
allConfigs.remove(configRecord.name());
+ } else if (configRecord.value().length() > Short.MAX_VALUE) {
+ return DISALLOWED_CONFIG_VALUE_SIZE_ERROR;
Review Comment:
Could you please add comments explaining why we handle this individually?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18907: Add suitable error message when the appended value is too larger [kafka]
Posted by "clarkwtc (via GitHub)" <gi...@apache.org>.
clarkwtc commented on code in PR #19070:
URL: https://github.com/apache/kafka/pull/19070#discussion_r1976668052
##########
metadata/src/main/java/org/apache/kafka/controller/ConfigurationControlManager.java:
##########
@@ -339,6 +339,8 @@ private ApiError validateAlterConfig(
return DISALLOWED_CLUSTER_MIN_ISR_REMOVAL_ERROR;
} else if (configRecord.value() == null) {
allConfigs.remove(configRecord.name());
+ } else if (configRecord.value().length() > Short.MAX_VALUE) {
+ return DISALLOWED_CONFIG_VALUE_SIZE_ERROR;
Review Comment:
I got it wrong.
I've changed the comment.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18907: Add suitable error message when the appended value is too larger [kafka]
Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on code in PR #19070:
URL: https://github.com/apache/kafka/pull/19070#discussion_r1976564129
##########
metadata/src/main/java/org/apache/kafka/controller/ConfigurationControlManager.java:
##########
@@ -339,6 +339,8 @@ private ApiError validateAlterConfig(
return DISALLOWED_CLUSTER_MIN_ISR_REMOVAL_ERROR;
} else if (configRecord.value() == null) {
allConfigs.remove(configRecord.name());
+ } else if (configRecord.value().length() > Short.MAX_VALUE) {
+ return DISALLOWED_CONFIG_VALUE_SIZE_ERROR;
Review Comment:
I meant the comment should explain why to throw specific exception ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18907: Add suitable error message when the appended value is too larger [kafka]
Posted by "clarkwtc (via GitHub)" <gi...@apache.org>.
clarkwtc commented on code in PR #19070:
URL: https://github.com/apache/kafka/pull/19070#discussion_r1976670186
##########
metadata/src/main/java/org/apache/kafka/controller/ConfigurationControlManager.java:
##########
@@ -385,6 +388,10 @@ private ApiError validateAlterConfig(
new ApiError(INVALID_CONFIG, "Cluster-level " + MIN_IN_SYNC_REPLICAS_CONFIG +
" cannot be removed while ELR is enabled.");
+ private static final ApiError DISALLOWED_CONFIG_VALUE_SIZE_ERROR =
+ new ApiError(INVALID_CONFIG, String.format("The configuration value cannot be added because " +
+ "it exceeds the maximum value size of %d bytes.", Short.MAX_VALUE));
Review Comment:
@m1a2st
I’ll be careful about maintaining consistent indentation style.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18907: Add suitable error message when the appended value is too larger [kafka]
Posted by "m1a2st (via GitHub)" <gi...@apache.org>.
m1a2st commented on code in PR #19070:
URL: https://github.com/apache/kafka/pull/19070#discussion_r1976613368
##########
metadata/src/main/java/org/apache/kafka/controller/ConfigurationControlManager.java:
##########
@@ -385,6 +388,10 @@ private ApiError validateAlterConfig(
new ApiError(INVALID_CONFIG, "Cluster-level " + MIN_IN_SYNC_REPLICAS_CONFIG +
" cannot be removed while ELR is enabled.");
+ private static final ApiError DISALLOWED_CONFIG_VALUE_SIZE_ERROR =
+ new ApiError(INVALID_CONFIG, String.format("The configuration value cannot be added because " +
+ "it exceeds the maximum value size of %d bytes.", Short.MAX_VALUE));
Review Comment:
Please ensure that the "indentation" style is followed for consistency.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18907: Add suitable error message when the appended value is too larger [kafka]
Posted by "clarkwtc (via GitHub)" <gi...@apache.org>.
clarkwtc commented on code in PR #19070:
URL: https://github.com/apache/kafka/pull/19070#discussion_r1976668420
##########
metadata/src/main/java/org/apache/kafka/controller/ConfigurationControlManager.java:
##########
@@ -385,6 +388,10 @@ private ApiError validateAlterConfig(
new ApiError(INVALID_CONFIG, "Cluster-level " + MIN_IN_SYNC_REPLICAS_CONFIG +
" cannot be removed while ELR is enabled.");
+ private static final ApiError DISALLOWED_CONFIG_VALUE_SIZE_ERROR =
+ new ApiError(INVALID_CONFIG, String.format("The configuration value cannot be added because " +
+ "it exceeds the maximum value size of %d bytes.", Short.MAX_VALUE));
Review Comment:
Thank you for these comments.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org