Skip to content
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

Pipe: filtered empty tsFiles which should not be parsed or reported #12216

Merged
merged 2 commits into from
Mar 22, 2024
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 @@ -70,14 +70,15 @@ public void testTumblingTimeSamplingProcessor() throws Exception {

try (SyncConfigNodeIServiceClient client =
(SyncConfigNodeIServiceClient) senderEnv.getLeaderConfigNodeConnection()) {
// Test the mixture of historical and realtime data
// Test empty tsFile parsing
// Assert that an empty tsFile will not be parsed by the processor then block
// the subsequent data processing
// Do not fail if the failure has nothing to do with pipe
// Because the failures will randomly generate due to resource limitation
if (!TestUtils.tryExecuteNonQueriesWithRetry(
senderEnv,
Arrays.asList(
"insert into root.vehicle.d0(time, s1) values (0, 1)",
"insert into root.vehicle.d0(time, s1) values (10000, 2)"))) {
"insert into root.vehicle.d0(time, s1) values (0, 1)", "delete from root.**"))) {
return;
}

Expand Down Expand Up @@ -110,6 +111,8 @@ public void testTumblingTimeSamplingProcessor() throws Exception {
if (!TestUtils.tryExecuteNonQueriesWithRetry(
senderEnv,
Arrays.asList(
"insert into root.vehicle.d0(time, s1) values (0, 1)",
"insert into root.vehicle.d0(time, s1) values (10000, 2)",
"insert into root.vehicle.d0(time, s1) values (19999, 3)",
"insert into root.vehicle.d0(time, s1) values (20000, 4)",
"insert into root.vehicle.d0(time, s1) values (20001, 5)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

import java.io.File;
import java.io.IOException;
import java.util.Collections;
import java.util.concurrent.atomic.AtomicBoolean;

public class PipeTsFileInsertionEvent extends EnrichedEvent implements TsFileInsertionEvent {
Expand Down Expand Up @@ -156,7 +157,12 @@ public boolean internallyDecreaseResourceReferenceCount(String holderMessage) {
@Override
public ProgressIndex getProgressIndex() {
try {
waitForTsFileClose();
if (!waitForTsFileClose()) {
LOGGER.warn(
"Skipping temporary TsFile {}'s progressIndex, will report MinimumProgressIndex",
tsFile);
return MinimumProgressIndex.INSTANCE;
}
return resource.getMaxProgressIndexAfterClose();
} catch (InterruptedException e) {
LOGGER.warn(
Expand Down Expand Up @@ -217,18 +223,13 @@ public boolean shouldParsePattern() {

@Override
public Iterable<TabletInsertionEvent> toTabletInsertionEvents() {
return initDataContainer().toTabletInsertionEvents();
}

private TsFileInsertionDataContainer initDataContainer() {
try {
if (dataContainer == null) {
waitForTsFileClose();
dataContainer =
new TsFileInsertionDataContainer(
tsFile, pipePattern, startTime, endTime, pipeTaskMeta, this);
if (!waitForTsFileClose()) {
LOGGER.warn(
"Pipe skipping temporary TsFile's parsing which shouldn't be transferred: {}", tsFile);
return Collections.emptyList();
}
return dataContainer;
return initDataContainer().toTabletInsertionEvents();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
close();
Expand All @@ -238,6 +239,17 @@ private TsFileInsertionDataContainer initDataContainer() {
"Interrupted when waiting for closing TsFile %s.", resource.getTsFilePath());
LOGGER.warn(errorMsg, e);
throw new PipeException(errorMsg);
}
}

private TsFileInsertionDataContainer initDataContainer() {
try {
if (dataContainer == null) {
dataContainer =
new TsFileInsertionDataContainer(
tsFile, pipePattern, startTime, endTime, pipeTaskMeta, this);
}
return dataContainer;
} catch (IOException e) {
close();

Expand Down
Loading