Skip to content
Open
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 @@ -92,6 +92,7 @@ private PipeRawTabletInsertionEvent(
this.treeModelDatabaseName = treeModelDatabaseName;
this.sourceEvent = sourceEvent;
this.needToReport = needToReport;
inheritSourceEventReportSkippingIfNecessary();

// Allocate empty memory block, will be resized later.
this.allocatedMemoryBlock =
Expand Down Expand Up @@ -342,6 +343,18 @@ public void markAsNeedToReport() {
});
}
this.needToReport = true;
inheritSourceEventReportSkippingIfNecessary();
}

private void inheritSourceEventReportSkippingIfNecessary() {
if (needToReport && shouldSkipReportOnCommitBecauseOfSourceEvent()) {
skipReportOnCommit();
}
}

private boolean shouldSkipReportOnCommitBecauseOfSourceEvent() {
return sourceEvent instanceof PipeTsFileInsertionEvent
&& !((PipeTsFileInsertionEvent) sourceEvent).shouldReportGeneratedEventsOnCommit();
}

// This getter is reserved for user-defined plugins
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ public class PipeTsFileInsertionEvent extends EnrichedEvent

protected volatile ProgressIndex overridingProgressIndex;
private Set<String> tableNames;
// False when generated tablet events should wait for an external progress report.
private volatile boolean shouldReportGeneratedEventsOnCommit = true;
private String tsFileParser;

public PipeTsFileInsertionEvent(final TsFileResource resource, final boolean isLoaded) {
Expand Down Expand Up @@ -412,6 +414,23 @@ public ProgressIndex forceGetProgressIndex() {
return resource.getMaxProgressIndex();
}

public PipeTsFileInsertionEvent skipReportOnCommitAndGeneratedEvents() {
return setShouldReportGeneratedEventsOnCommit(false);
}

public boolean shouldReportGeneratedEventsOnCommit() {
return shouldReportGeneratedEventsOnCommit;
}

private PipeTsFileInsertionEvent setShouldReportGeneratedEventsOnCommit(
final boolean shouldReportGeneratedEventsOnCommit) {
this.shouldReportGeneratedEventsOnCommit = shouldReportGeneratedEventsOnCommit;
if (!shouldReportGeneratedEventsOnCommit) {
skipReportOnCommit();
}
return this;
}

public void eliminateProgressIndex() {
if (Objects.isNull(overridingProgressIndex) && Objects.nonNull(resource)) {
PipeTsFileEpochProgressIndexKeeper.getInstance()
Expand Down Expand Up @@ -449,6 +468,7 @@ public PipeTsFileInsertionEvent shallowCopySelfAndBindPipeTaskMetaForProgressRep
startTime,
endTime,
isTsFileSealed);
copiedEvent.setShouldReportGeneratedEventsOnCommit(shouldReportGeneratedEventsOnCommit);
copiedEvent.setTsFileParser(tsFileParser);
return copiedEvent;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_HISTORY_ENABLE_KEY;
import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_HISTORY_END_TIME_KEY;
import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_HISTORY_START_TIME_KEY;
import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_HISTORY_TSFILE_ORDER_BY_QUERY_PRIORITY_KEY;
import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_PATTERN_FORMAT_IOTDB_VALUE;
import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_PATTERN_FORMAT_KEY;
import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_PATTERN_FORMAT_PREFIX_VALUE;
Expand All @@ -79,6 +80,7 @@
import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_HISTORY_ENABLE_KEY;
import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_HISTORY_END_TIME_KEY;
import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_HISTORY_START_TIME_KEY;
import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_HISTORY_TSFILE_ORDER_BY_QUERY_PRIORITY_KEY;
import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_PATTERN_FORMAT_KEY;
import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_ENABLE_KEY;
import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_MODE_KEY;
Expand Down Expand Up @@ -155,6 +157,16 @@ public void validate(final PipeParameterValidator validator) throws Exception {
SOURCE_HISTORY_ENABLE_KEY, true, Boolean.TRUE.toString(), Boolean.FALSE.toString())
.validateAttributeValueRange(
SOURCE_REALTIME_ENABLE_KEY, true, Boolean.TRUE.toString(), Boolean.FALSE.toString())
.validateAttributeValueRange(
EXTRACTOR_HISTORY_TSFILE_ORDER_BY_QUERY_PRIORITY_KEY,
true,
Boolean.TRUE.toString(),
Boolean.FALSE.toString())
.validateAttributeValueRange(
SOURCE_HISTORY_TSFILE_ORDER_BY_QUERY_PRIORITY_KEY,
true,
Boolean.TRUE.toString(),
Boolean.FALSE.toString())
.validate(
args -> (boolean) args[0] || (boolean) args[1],
"Should not set both history.enable and realtime.enable to false.",
Expand Down
Loading
Loading