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 @@ -93,6 +93,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;

public PipeTsFileInsertionEvent(final TsFileResource resource, final boolean isLoaded) {
// The modFile must be copied before the event is assigned to the listening pipes
Expand Down Expand Up @@ -388,6 +390,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 All @@ -404,18 +423,19 @@ public PipeTsFileInsertionEvent shallowCopySelfAndBindPipeTaskMetaForProgressRep
final long startTime,
final long endTime) {
return new PipeTsFileInsertionEvent(
resource,
tsFile,
isWithMod,
isLoaded,
isGeneratedByHistoricalExtractor,
pipeName,
creationTime,
pipeTaskMeta,
pattern,
startTime,
endTime,
isTsFileSealed);
resource,
tsFile,
isWithMod,
isLoaded,
isGeneratedByHistoricalExtractor,
pipeName,
creationTime,
pipeTaskMeta,
pattern,
startTime,
endTime,
isTsFileSealed)
.setShouldReportGeneratedEventsOnCommit(shouldReportGeneratedEventsOnCommit);
}

@Override
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 @@ -76,6 +77,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 @@ -138,6 +140,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