-
Notifications
You must be signed in to change notification settings - Fork 591
feat(core): Replace fixed parameters with environment variables #3083
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -23,9 +23,10 @@ | |||||||||||||||||||||||||||||
| import org.apache.kafka.controller.stream.NodeMetadata; | ||||||||||||||||||||||||||||||
| import org.apache.kafka.controller.stream.NodeState; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| import com.automq.stream.utils.Systems; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| import java.util.Map; | ||||||||||||||||||||||||||||||
| import java.util.Objects; | ||||||||||||||||||||||||||||||
| import java.util.concurrent.TimeUnit; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||
| * NodeRuntimeMetadata is a runtime view of a node's metadata. | ||||||||||||||||||||||||||||||
|
|
@@ -40,7 +41,7 @@ public final class NodeRuntimeMetadata { | |||||||||||||||||||||||||||||
| * @see ClusterControlManager#getNextNodeId() | ||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||
| private static final int MAX_CONTROLLER_ID = 1000 - 1; | ||||||||||||||||||||||||||||||
| private static final long DONT_FAILOVER_AFTER_NEW_EPOCH_MS = TimeUnit.MINUTES.toMillis(1); | ||||||||||||||||||||||||||||||
| private static final long DONT_FAILOVER_AFTER_NEW_EPOCH_MS = Systems.getEnvLong("AUTOMQ_CONTROLLER_DONT_FAILOVER_AFTER_NEW_EPOCH_MS", 60L * 1000); | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
| private final int id; | ||||||||||||||||||||||||||||||
|
Comment on lines
+44
to
45
|
||||||||||||||||||||||||||||||
| private static final long DONT_FAILOVER_AFTER_NEW_EPOCH_MS = Systems.getEnvLong("AUTOMQ_CONTROLLER_DONT_FAILOVER_AFTER_NEW_EPOCH_MS", 60L * 1000); | |
| private final int id; | |
| private static final long DONT_FAILOVER_AFTER_NEW_EPOCH_MS = getDontFailoverAfterNewEpochMs(); | |
| private final int id; | |
| private static long getDontFailoverAfterNewEpochMs() { | |
| final long defaultValue = 60L * 1000; | |
| try { | |
| return Systems.getEnvLong("AUTOMQ_CONTROLLER_DONT_FAILOVER_AFTER_NEW_EPOCH_MS", defaultValue); | |
| } catch (NumberFormatException e) { | |
| // Optionally log the error here if a logger is available | |
| return defaultValue; | |
| } | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new environment variable
AUTOMQ_CONTROLLER_DONT_FAILOVER_AFTER_NEW_EPOCH_MSshould be documented with a comment explaining its purpose, acceptable values (non-negative long in milliseconds), and the default value (60000ms = 1 minute). This helps operators understand how to configure this parameter.