Skip to content

Commit

Permalink
[ISSUE-#4342] Fix nacos.core.protocol.raft.data.read_index_type isn't…
Browse files Browse the repository at this point in the history
… effect (#4343)

* fix nacos.core.protocol.raft.data.read_index_type=ReadOnlyLeaseBased isn't effect and enhance log hint

* define ReadOnlyOption param name just by self
  • Loading branch information
horizonzy committed Nov 26, 2020
1 parent 85bdc1e commit 67a0ba3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public final class RaftSysConstants {
public static final String RAFT_CLI_SERVICE_THREAD_NUM = "cli_service_thread_num";

/**
* raft linear read strategy, defaults to index
* raft linear read strategy, defaults to read_index read
*/
public static final String RAFT_READ_INDEX_TYPE = "read_index_type";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private static ReadOnlyOption raftReadIndexType(RaftConfig config) {
String readOnySafe = "ReadOnlySafe";
String readOnlyLeaseBased = "ReadOnlyLeaseBased";

String val = config.getVal(RaftSysConstants.DEFAULT_READ_INDEX_TYPE);
String val = config.getVal(RaftSysConstants.RAFT_READ_INDEX_TYPE);

if (StringUtils.isBlank(val) || StringUtils.equals(readOnySafe, val)) {
return ReadOnlyOption.ReadOnlySafe;
Expand All @@ -117,8 +117,8 @@ private static ReadOnlyOption raftReadIndexType(RaftConfig config) {
if (StringUtils.equals(readOnlyLeaseBased, val)) {
return ReadOnlyOption.ReadOnlyLeaseBased;
}
throw new IllegalArgumentException(
"Illegal Raft system parameters => " + RaftSysConstants.DEFAULT_READ_INDEX_TYPE + " : [" + val + "]");
throw new IllegalArgumentException("Illegal Raft system parameters => ReadOnlyOption" + " : [" + val
+ "], should be 'ReadOnlySafe' or 'ReadOnlyLeaseBased'");

}

Expand Down

0 comments on commit 67a0ba3

Please sign in to comment.