Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,14 @@ private PipeRawTabletInsertionEvent(
this.allocatedMemoryBlock =
PipeDataNodeResourceManager.memory().forceAllocateForTabletWithRetry(0);

addOnCommittedHook(
() -> {
if (shouldReportOnCommit) {
eliminateProgressIndex();
}
});
if (needToReport) {
addOnCommittedHook(
() -> {
if (shouldReportOnCommit) {
eliminateProgressIndex();
}
});
}
}

public PipeRawTabletInsertionEvent(
Expand Down Expand Up @@ -303,10 +305,8 @@ public boolean internallyDecreaseResourceReferenceCount(final String holderMessa
}

protected void eliminateProgressIndex() {
if (needToReport) {
if (sourceEvent instanceof PipeTsFileInsertionEvent) {
((PipeTsFileInsertionEvent) sourceEvent).eliminateProgressIndex();
}
if (sourceEvent instanceof PipeTsFileInsertionEvent) {
((PipeTsFileInsertionEvent) sourceEvent).eliminateProgressIndex();
}
}

Expand Down Expand Up @@ -387,6 +387,14 @@ public boolean mayEventPathsOverlappedWithPattern() {
}

public void markAsNeedToReport() {
if (!needToReport) {
addOnCommittedHook(
() -> {
if (shouldReportOnCommit) {
eliminateProgressIndex();
}
});
}
this.needToReport = true;
}

Expand All @@ -404,6 +412,11 @@ public EnrichedEvent getSourceEvent() {
return sourceEvent;
}

@Override
public boolean isShouldReportOnCommit() {
return shouldReportOnCommit && needToReport;
}

/////////////////////////// TabletInsertionEvent ///////////////////////////

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@
}

@Override
public void throwIfNoPrivilege() {

Check warning on line 449 in iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/PipeTsFileInsertionEvent.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

A "Brain Method" was detected. Refactor it to reduce at least one of the following metrics: LOC from 99 to 64, Complexity from 21 to 14, Nesting Level from 5 to 2, Number of Variables from 13 to 6.

See more on https://sonarcloud.io/project/issues?id=apache_iotdb&issues=AZ0k4zymF8ivvMx3hAri&open=AZ0k4zymF8ivvMx3hAri&pullRequest=17360
try {
if (AuthorityChecker.SUPER_USER.equals(userName)) {
return;
Expand Down Expand Up @@ -561,6 +561,17 @@
|| startTime <= resource.getFileEndTime() && resource.getFileStartTime() <= endTime;
}

@Override
public boolean shouldParseTime() {
if (!isTimeParsed
&& Objects.nonNull(resource)
&& startTime <= resource.getFileStartTime()
&& resource.getFileEndTime() <= endTime) {
isTimeParsed = true;
}
return !isTimeParsed;
}

@Override
public boolean mayEventPathsOverlappedWithPattern() {
if (Objects.isNull(resource) || !resource.isClosed() || isTableModelEvent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.apache.iotdb.commons.pipe.agent.task.meta.PipeTaskMeta;
import org.apache.iotdb.commons.pipe.datastructure.interval.Interval;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

Expand All @@ -43,7 +44,7 @@ public PipeCommitInterval(
this.pipeTaskMeta = pipeTaskMeta;
this.currentIndex =
Objects.nonNull(currentIndex) ? currentIndex : MinimumProgressIndex.INSTANCE;
this.onCommittedHooks = onCommittedHooks;
this.onCommittedHooks = new ArrayList<>(onCommittedHooks);
}

@Override
Expand Down
Loading