-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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
[ISSUE #7300] jRaft-Controller Implemention #7301
Changes from 14 commits
7529187
2edc6c7
c24e268
855a8ba
c973b56
14d45c7
1196047
d775f87
ed2e82f
8800d69
8b38ee6
e01ef73
a172a60
8f3f8c1
adffdf2
9ce99b6
6c86484
14bac4b
863b49e
05062f3
27e8134
44d5717
323ea1c
03b0cb2
15002d0
677faf3
2b33ccb
8e1f71c
2f362ef
e0f8ede
e5b4ae5
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 |
---|---|---|
|
@@ -21,10 +21,11 @@ | |
import org.apache.rocketmq.common.metrics.MetricsExporterType; | ||
|
||
public class ControllerConfig { | ||
|
||
private String rocketmqHome = System.getProperty(MixAll.ROCKETMQ_HOME_PROPERTY, System.getenv(MixAll.ROCKETMQ_HOME_ENV)); | ||
private String configStorePath = System.getProperty("user.home") + File.separator + "controller" + File.separator + "controller.properties"; | ||
|
||
public static final String DLEDGER_CONTROLLER = "DLedger"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would be better to use an enum There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using enum is indeed more elegant, but I think using string constants here is sufficient. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
public static final String JRAFT_CONTROLLER = "jRaft"; | ||
private String controllerType = DLEDGER_CONTROLLER; | ||
/** | ||
* Interval of periodic scanning for non-active broker; | ||
* Unit: millisecond | ||
|
@@ -45,7 +46,7 @@ public class ControllerConfig { | |
private String controllerDLegerPeers; | ||
private String controllerDLegerSelfId; | ||
private int mappedFileSize = 1024 * 1024 * 1024; | ||
private String controllerStorePath = System.getProperty("user.home") + File.separator + "DledgerController"; | ||
private String controllerStorePath = System.getProperty("user.home") + File.separator + controllerType + "Controller"; | ||
|
||
/** | ||
* Whether the controller can elect a master which is not in the syncStateSet. | ||
|
@@ -67,6 +68,13 @@ public class ControllerConfig { | |
*/ | ||
private long scanInactiveMasterInterval = 5 * 1000; | ||
|
||
private int jRaftElectionTimeoutMs = 1000; | ||
private int jRaftSnapshotIntervalSecs = 3600; | ||
private String jRaftGroupId = "jRaft-Controller"; | ||
private String jRaftServerId = "localhost:9880"; | ||
private String jRaftInitConf = "localhost:9880,localhost:9881,localhost:9882"; | ||
private String jRaftControllerRPCAddr = "localhost:9770,localhost:9771,localhost:9772"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moving these configurations to a jraftConfig class will make it clearer. |
||
|
||
private MetricsExporterType metricsExporterType = MetricsExporterType.DISABLE; | ||
|
||
private String metricsGrpcExporterTarget = ""; | ||
|
@@ -201,6 +209,10 @@ public String getDLedgerAddress() { | |
.map(x -> x.split("-")[1]).findFirst().get(); | ||
} | ||
|
||
public String getJRaftAddress() { | ||
return jRaftServerId; | ||
} | ||
|
||
public MetricsExporterType getMetricsExporterType() { | ||
return metricsExporterType; | ||
} | ||
|
@@ -280,4 +292,60 @@ public boolean isMetricsInDelta() { | |
public void setMetricsInDelta(boolean metricsInDelta) { | ||
this.metricsInDelta = metricsInDelta; | ||
} | ||
|
||
public String getControllerType() { | ||
return controllerType; | ||
} | ||
|
||
public void setControllerType(String controllerType) { | ||
this.controllerType = controllerType; | ||
} | ||
|
||
public int getjRaftElectionTimeoutMs() { | ||
return jRaftElectionTimeoutMs; | ||
} | ||
|
||
public void setjRaftElectionTimeoutMs(int jRaftElectionTimeoutMs) { | ||
this.jRaftElectionTimeoutMs = jRaftElectionTimeoutMs; | ||
} | ||
|
||
public int getjRaftSnapshotIntervalSecs() { | ||
return jRaftSnapshotIntervalSecs; | ||
} | ||
|
||
public void setjRaftSnapshotIntervalSecs(int jRaftSnapshotIntervalSecs) { | ||
this.jRaftSnapshotIntervalSecs = jRaftSnapshotIntervalSecs; | ||
} | ||
|
||
public String getjRaftGroupId() { | ||
return jRaftGroupId; | ||
} | ||
|
||
public void setjRaftGroupId(String jRaftGroupId) { | ||
this.jRaftGroupId = jRaftGroupId; | ||
} | ||
|
||
public String getjRaftServerId() { | ||
return jRaftServerId; | ||
} | ||
|
||
public void setjRaftServerId(String jRaftServerId) { | ||
this.jRaftServerId = jRaftServerId; | ||
} | ||
|
||
public String getjRaftInitConf() { | ||
return jRaftInitConf; | ||
} | ||
|
||
public void setjRaftInitConf(String jRaftInitConf) { | ||
this.jRaftInitConf = jRaftInitConf; | ||
} | ||
|
||
public String getjRaftControllerRPCAddr() { | ||
return jRaftControllerRPCAddr; | ||
} | ||
|
||
public void setjRaftControllerRPCAddr(String jRaftControllerRPCAddr) { | ||
this.jRaftControllerRPCAddr = jRaftControllerRPCAddr; | ||
} | ||
} |
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.
It should be 1.3.14?