Skip to content

Pipe: Made historical extractor do not extract TsFiles that have not started to close #15466

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
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 @@ -549,11 +549,11 @@ private void extractTsFiles(
&& (
// Some resource may not be closed due to the control of
// PIPE_MIN_FLUSH_INTERVAL_IN_MS. We simply ignore them.
!resource.isClosed()
|| mayTsFileContainUnprocessedData(resource)
&& isTsFileResourceOverlappedWithTimeRange(resource)
&& isTsFileGeneratedAfterExtractionTimeLowerBound(resource)
&& mayTsFileResourceOverlappedWithPattern(resource)))
resource.getProcessor().alreadyMarkedClosing()
&& mayTsFileContainUnprocessedData(resource)
&& isTsFileResourceOverlappedWithTimeRange(resource)
&& isTsFileGeneratedAfterExtractionTimeLowerBound(resource)
&& mayTsFileResourceOverlappedWithPattern(resource)))
.collect(Collectors.toList());
resourceList.addAll(sequenceTsFileResources);

Expand All @@ -566,11 +566,11 @@ && mayTsFileResourceOverlappedWithPattern(resource)))
&& (
// Some resource may not be closed due to the control of
// PIPE_MIN_FLUSH_INTERVAL_IN_MS. We simply ignore them.
!resource.isClosed()
|| mayTsFileContainUnprocessedData(resource)
&& isTsFileResourceOverlappedWithTimeRange(resource)
&& isTsFileGeneratedAfterExtractionTimeLowerBound(resource)
&& mayTsFileResourceOverlappedWithPattern(resource)))
resource.getProcessor().alreadyMarkedClosing()
&& mayTsFileContainUnprocessedData(resource)
&& isTsFileResourceOverlappedWithTimeRange(resource)
&& isTsFileGeneratedAfterExtractionTimeLowerBound(resource)
&& mayTsFileResourceOverlappedWithPattern(resource)))
.collect(Collectors.toList());
resourceList.addAll(unsequenceTsFileResources);

Expand Down Expand Up @@ -619,13 +619,13 @@ private boolean mayTsFileContainUnprocessedData(final TsFileResource resource) {
// "equals" max progressIndex must be transmitted to avoid data loss
final ProgressIndex innerProgressIndex =
((StateProgressIndex) startIndex).getInnerProgressIndex();
return !innerProgressIndex.isAfter(resource.getMaxProgressIndexAfterClose())
&& !innerProgressIndex.equals(resource.getMaxProgressIndexAfterClose());
return !innerProgressIndex.isAfter(resource.getMaxProgressIndex())
&& !innerProgressIndex.equals(resource.getMaxProgressIndex());
}

// Some different tsFiles may share the same max progressIndex, thus tsFiles with an
// "equals" max progressIndex must be transmitted to avoid data loss
return !startIndex.isAfter(resource.getMaxProgressIndexAfterClose());
return !startIndex.isAfter(resource.getMaxProgressIndex());
}

private boolean mayTsFileResourceOverlappedWithPattern(final TsFileResource resource) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1294,18 +1294,18 @@ public Future<?> asyncClose() {
IMemTable tmpMemTable = workMemTable == null ? new NotifyFlushMemTable() : workMemTable;

try {
// When invoke closing TsFile after insert data to memTable, we shouldn't flush until invoke
// flushing memTable in System module.
Future<?> future = addAMemtableIntoFlushingList(tmpMemTable);
shouldClose = true;

PipeInsertionDataNodeListener.getInstance()
.listenToTsFile(
dataRegionInfo.getDataRegion().getDataRegionId(),
dataRegionInfo.getDataRegion().getDatabaseName(),
tsFileResource,
false,
tmpMemTable.isTotallyGeneratedByPipe());

// When invoke closing TsFile after insert data to memTable, we shouldn't flush until invoke
// flushing memTable in System module.
Future<?> future = addAMemtableIntoFlushingList(tmpMemTable);
shouldClose = true;
return future;
} catch (Exception e) {
logger.error(
Expand Down
Loading