This is an automated email from the ASF dual-hosted git repository.
tanxinyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 769a151af97 Revert "Fixed issue where ConfigNode might recover
incorrectly under SimpleConsensus" (#11987)
769a151af97 is described below
commit 769a151af971f8d0644635fca6ebe6d209a8a99a
Author: ZhangHongYin <[email protected]>
AuthorDate: Sun Jan 28 02:31:13 2024 +0800
Revert "Fixed issue where ConfigNode might recover incorrectly under
SimpleConsensus" (#11987)
---
.../statemachine/ConfigRegionStateMachine.java | 23 ----------------------
1 file changed, 23 deletions(-)
diff --git
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/statemachine/ConfigRegionStateMachine.java
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/statemachine/ConfigRegionStateMachine.java
index f84f8a316ff..8b8e1507d37 100644
---
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/statemachine/ConfigRegionStateMachine.java
+++
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/statemachine/ConfigRegionStateMachine.java
@@ -53,13 +53,10 @@ import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
-import java.util.Arrays;
-import java.util.Comparator;
import java.util.Optional;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
-import java.util.regex.Pattern;
/** StateMachine for ConfigRegion. */
public class ConfigRegionStateMachine implements IStateMachine,
IStateMachine.EventApi {
@@ -87,8 +84,6 @@ public class ConfigRegionStateMachine implements
IStateMachine, IStateMachine.Ev
private static final long LOG_FILE_MAX_SIZE =
CONF.getConfigNodeSimpleConsensusLogSegmentSizeMax();
private final TEndPoint currentNodeTEndPoint;
- private static Pattern LOG_INPROGRESS_PATTERN = Pattern.compile("\\d+");
- private static Pattern LOG_PATTERN = Pattern.compile("(?<=_)(\\d+)$");
public ConfigRegionStateMachine(ConfigManager configManager,
ConfigPlanExecutor executor) {
this.executor = executor;
@@ -328,7 +323,6 @@ public class ConfigRegionStateMachine implements
IStateMachine, IStateMachine.Ev
dir.mkdirs();
String[] list = new File(CURRENT_FILE_DIR).list();
if (list != null && list.length != 0) {
- Arrays.sort(list, new FileComparator());
for (String logFileName : list) {
File logFile =
SystemFileFactory.INSTANCE.getFile(CURRENT_FILE_DIR +
File.separator + logFileName);
@@ -401,21 +395,4 @@ public class ConfigRegionStateMachine implements
IStateMachine, IStateMachine.Ev
e);
}
}
-
- static class FileComparator implements Comparator<String> {
- @Override
- public int compare(String filename1, String filename2) {
- long id1 = parseEndIndex(filename1);
- long id2 = parseEndIndex(filename2);
- return Long.compare(id1, id2);
- }
- }
-
- static long parseEndIndex(String filename) {
- if (filename.startsWith("log_inprogress_")) {
- return Long.parseLong(LOG_INPROGRESS_PATTERN.matcher(filename).group());
- } else {
- return Long.parseLong(LOG_PATTERN.matcher(filename).group());
- }
- }
}