Skip to content

Commit 769a151

Browse files
authored
Revert "Fixed issue where ConfigNode might recover incorrectly under SimpleConsensus" (#11987)
1 parent a544517 commit 769a151

File tree

1 file changed

+0
-23
lines changed

1 file changed

+0
-23
lines changed

iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/statemachine/ConfigRegionStateMachine.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,10 @@
5353
import java.nio.ByteBuffer;
5454
import java.nio.file.Files;
5555
import java.nio.file.StandardCopyOption;
56-
import java.util.Arrays;
57-
import java.util.Comparator;
5856
import java.util.Optional;
5957
import java.util.concurrent.ExecutorService;
6058
import java.util.concurrent.ScheduledExecutorService;
6159
import java.util.concurrent.TimeUnit;
62-
import java.util.regex.Pattern;
6360

6461
/** StateMachine for ConfigRegion. */
6562
public class ConfigRegionStateMachine implements IStateMachine, IStateMachine.EventApi {
@@ -87,8 +84,6 @@ public class ConfigRegionStateMachine implements IStateMachine, IStateMachine.Ev
8784
private static final long LOG_FILE_MAX_SIZE =
8885
CONF.getConfigNodeSimpleConsensusLogSegmentSizeMax();
8986
private final TEndPoint currentNodeTEndPoint;
90-
private static Pattern LOG_INPROGRESS_PATTERN = Pattern.compile("\\d+");
91-
private static Pattern LOG_PATTERN = Pattern.compile("(?<=_)(\\d+)$");
9287

9388
public ConfigRegionStateMachine(ConfigManager configManager, ConfigPlanExecutor executor) {
9489
this.executor = executor;
@@ -328,7 +323,6 @@ private void initStandAloneConfigNode() {
328323
dir.mkdirs();
329324
String[] list = new File(CURRENT_FILE_DIR).list();
330325
if (list != null && list.length != 0) {
331-
Arrays.sort(list, new FileComparator());
332326
for (String logFileName : list) {
333327
File logFile =
334328
SystemFileFactory.INSTANCE.getFile(CURRENT_FILE_DIR + File.separator + logFileName);
@@ -401,21 +395,4 @@ private void createLogFile(int endIndex) {
401395
e);
402396
}
403397
}
404-
405-
static class FileComparator implements Comparator<String> {
406-
@Override
407-
public int compare(String filename1, String filename2) {
408-
long id1 = parseEndIndex(filename1);
409-
long id2 = parseEndIndex(filename2);
410-
return Long.compare(id1, id2);
411-
}
412-
}
413-
414-
static long parseEndIndex(String filename) {
415-
if (filename.startsWith("log_inprogress_")) {
416-
return Long.parseLong(LOG_INPROGRESS_PATTERN.matcher(filename).group());
417-
} else {
418-
return Long.parseLong(LOG_PATTERN.matcher(filename).group());
419-
}
420-
}
421398
}

0 commit comments

Comments
 (0)