This is an automated email from the ASF dual-hosted git repository.
rong pushed a commit to branch rel/1.2
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/rel/1.2 by this push:
new 7ad40c74930 [IOTDB-6122] Pipe: Progress Index markers an incorrect
value when load a tsfile with tsfileResource (#10908) (#10914)
7ad40c74930 is described below
commit 7ad40c74930e0ecc8e20bea67a36aa3dfb991d45
Author: Itami Sho <[email protected]>
AuthorDate: Mon Aug 21 08:57:55 2023 +0800
[IOTDB-6122] Pipe: Progress Index markers an incorrect value when load a
tsfile with tsfileResource (#10908) (#10914)
When we load a tsfile, if it has a tsFileResource, there are two cases in
tsFileResource:
1. it doesn't have a progress index, we just give it one from system.
2. it has a progress index, the index shouldn't be loaded, it should be
recovered instead of updating.
(cherry picked from commit af250e0b9cab88ab487837ae9da5c247e5a443d6)
---
.../org/apache/iotdb/db/pipe/agent/runtime/PipeRuntimeAgent.java | 8 +++++++-
.../iotdb/db/storageengine/dataregion/tsfile/TsFileResource.java | 8 ++++++++
.../wal/recover/file/UnsealedTsFileRecoverPerformer.java | 2 +-
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/runtime/PipeRuntimeAgent.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/runtime/PipeRuntimeAgent.java
index d21b7e270df..0f91b346611 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/runtime/PipeRuntimeAgent.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/runtime/PipeRuntimeAgent.java
@@ -96,8 +96,14 @@ public class PipeRuntimeAgent implements IService {
}
////////////////////// Recover ProgressIndex Assigner //////////////////////
-
public void assignRecoverProgressIndexForTsFileRecovery(TsFileResource
tsFileResource) {
+ tsFileResource.recoverProgressIndex(
+ new RecoverProgressIndex(
+ DATA_NODE_ID,
+
simpleConsensusProgressIndexAssigner.getSimpleProgressIndexForTsFileRecovery()));
+ }
+
+ public void assignUpdateProgressIndexForTsFileRecovery(TsFileResource
tsFileResource) {
tsFileResource.updateProgressIndex(
new RecoverProgressIndex(
DATA_NODE_ID,
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/tsfile/TsFileResource.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/tsfile/TsFileResource.java
index b8073a57100..9ccf2f4aed3 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/tsfile/TsFileResource.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/tsfile/TsFileResource.java
@@ -1189,6 +1189,14 @@ public class TsFileResource {
:
maxProgressIndex.updateToMinimumIsAfterProgressIndex(progressIndex));
}
+ public void recoverProgressIndex(ProgressIndex progressIndex) {
+ if (progressIndex == null) {
+ return;
+ }
+
+ maxProgressIndex = progressIndex;
+ }
+
public ProgressIndex getMaxProgressIndexAfterClose() throws
IllegalStateException {
if (getStatus().equals(TsFileResourceStatus.UNCLOSED)) {
throw new IllegalStateException(
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/recover/file/UnsealedTsFileRecoverPerformer.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/recover/file/UnsealedTsFileRecoverPerformer.java
index ff25223ba87..742e996fd03 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/recover/file/UnsealedTsFileRecoverPerformer.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/recover/file/UnsealedTsFileRecoverPerformer.java
@@ -250,7 +250,7 @@ public class UnsealedTsFileRecoverPerformer extends
AbstractTsFileRecoverPerform
}
// set recover progress index for pipe
-
PipeAgent.runtime().assignRecoverProgressIndexForTsFileRecovery(tsFileResource);
+
PipeAgent.runtime().assignUpdateProgressIndexForTsFileRecovery(tsFileResource);
// if we put following codes in the 'if' clause above, this file can
be continued writing
// into it