Skip to content

Commit 51da71f

Browse files
authored
Pipe: Fix epoch status metric (apache#16355)
* fix * fix
1 parent a2bbb51 commit 51da71f

File tree

1 file changed

+10
-3
lines changed
  • iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/epoch

1 file changed

+10
-3
lines changed

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/epoch/TsFileEpoch.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,16 @@ public TsFileEpoch(final TsFileResource resource) {
4343
}
4444

4545
public TsFileEpoch.State getState(final PipeRealtimeDataRegionSource extractor) {
46-
return dataRegionExtractor2State
47-
.computeIfAbsent(extractor, o -> new AtomicReference<>(State.EMPTY))
48-
.get();
46+
AtomicReference<State> stateRef = dataRegionExtractor2State.get(extractor);
47+
48+
if (stateRef == null) {
49+
dataRegionExtractor2State.putIfAbsent(
50+
extractor, stateRef = new AtomicReference<>(State.EMPTY));
51+
extractor.increaseExtractEpochSize();
52+
setExtractorsRecentProcessedTsFileEpochState();
53+
}
54+
55+
return stateRef.get();
4956
}
5057

5158
public void migrateState(

0 commit comments

Comments
 (0)