Skip to content

Commit 2ff2d0d

Browse files
OutOfBrainsirko
and
sirko
authoredMar 14, 2025··
add support for throttle wildcard (#211)
docs: > alternatively the wildcard '*' can be used to throttle all replicas for this topic. This adds support for that Co-authored-by: sirko <[email protected]>
1 parent 194a446 commit 2ff2d0d

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed
 

‎pkg/config/settings.go

+6
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ var keyValidators = map[string]configValidator{
6262
return intVal >= 0
6363
},
6464
"follower.replication.throttled.replicas": func(v string) bool {
65+
if v == "*" {
66+
return true
67+
}
6568
subValues := strings.Split(v, ",")
6669
for _, subValue := range subValues {
6770
elements := strings.Split(subValue, ":")
@@ -86,6 +89,9 @@ var keyValidators = map[string]configValidator{
8689
return intVal >= 0
8790
},
8891
"leader.replication.throttled.replicas": func(v string) bool {
92+
if v == "*" {
93+
return true
94+
}
8995
subValues := strings.Split(v, ",")
9096
for _, subValue := range subValues {
9197
elements := strings.Split(subValue, ":")

‎pkg/config/settings_test.go

+8
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ func TestValidateSettings(t *testing.T) {
5757
},
5858
expError: false,
5959
},
60+
{
61+
description: "wildcard throttle",
62+
settings: TopicSettings{
63+
"follower.replication.throttled.replicas": "*",
64+
"leader.replication.throttled.replicas": "*",
65+
},
66+
expError: false,
67+
},
6068
{
6169
description: "unrecognized key",
6270
settings: TopicSettings{

0 commit comments

Comments
 (0)
Please sign in to comment.