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 5d8deac225f Ensuring IoTconsensus data consistency during region
migration (#12448)
5d8deac225f is described below
commit 5d8deac225f229a6c3bd8d84f169b958818ef194
Author: Potato <[email protected]>
AuthorDate: Mon Apr 29 23:18:42 2024 +0800
Ensuring IoTconsensus data consistency during region migration (#12448)
Signed-off-by: OneSizeFitQuorum <[email protected]>
---
.../org/apache/iotdb/consensus/iot/IoTConsensusServerImpl.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git
a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerImpl.java
b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerImpl.java
index 42aac9f4641..86c514a48b3 100644
---
a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerImpl.java
+++
b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerImpl.java
@@ -130,6 +130,7 @@ public class IoTConsensusServerImpl {
private final IoTConsensusRateLimiter ioTConsensusRateLimiter =
IoTConsensusRateLimiter.getInstance();
private volatile long lastPinnedSearchIndexForMigration = -1;
+ private volatile long lastPinnedSafeDeletedIndexForMigration = -1;
public IoTConsensusServerImpl(
String storageDir,
@@ -771,9 +772,9 @@ public class IoTConsensusServerImpl {
}
public long getMinFlushedSyncIndex() {
- return lastPinnedSearchIndexForMigration == -1
+ return lastPinnedSafeDeletedIndexForMigration == -1
? logDispatcher.getMinFlushedSyncIndex().orElseGet(searchIndex::get)
- : lastPinnedSearchIndexForMigration;
+ : lastPinnedSafeDeletedIndexForMigration;
}
public String getStorageDir() {
@@ -891,6 +892,7 @@ public class IoTConsensusServerImpl {
*/
public void checkAndLockSafeDeletedSearchIndex() {
lastPinnedSearchIndexForMigration = searchIndex.get();
+ lastPinnedSafeDeletedIndexForMigration = getMinFlushedSyncIndex();
consensusReqReader.setSafelyDeletedSearchIndex(getMinFlushedSyncIndex());
}
@@ -899,6 +901,7 @@ public class IoTConsensusServerImpl {
*/
public void checkAndUnlockSafeDeletedSearchIndex() {
lastPinnedSearchIndexForMigration = -1;
+ lastPinnedSafeDeletedIndexForMigration = -1;
checkAndUpdateSafeDeletedSearchIndex();
}