Skip to content

Commit c3b37ae

Browse files
committed
[test](fe) Remove redundant split cancellation unit tests
### What problem does this PR solve? Issue Number: N/A Related PR: #69835 Problem Summary: Split cancellation tests included a whole class repeating JDK CompletableFuture guarantees, a retry test that only constructed two objects, coverage already present in stronger cleanup tests, and constant fake-executor assertions. Remove these cases, combine equivalent batching tests while checking all split identities, and retain the actual query-retry, cancellation, queue and resource-lifetime failure paths. Drop a host-sensitive timeout upper bound while retaining the configured deadline lower bound and progress/termination checks. Production code is unchanged. ### Release note None ### Check List (For Author) - Test: Unit Test / Manual test - Checkstyle passed through the standard FE test entry point with style explicitly enabled; independent read-only test quality review completed. - Focused run-fe-ut.sh run is compiling/running at commit time; final execution results will be recorded separately in the PR description. - Verified unchanged production/POM content, retained behavioral oracles, no removed-tool references, and git diff --check. - Behavior changed: No - Does this need documentation: No
1 parent 0e88246 commit c3b37ae

6 files changed

Lines changed: 9 additions & 153 deletions

File tree

‎fe/fe-connector/fe-connector-iceberg/src/test/java/org/apache/doris/connector/iceberg/IcebergScanPlanningScopeTest.java‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ public void queuedCompletableFutureAndSubmitSettleWithoutWorkerAvailability() th
6161
// Simulate the borrowed executor eventually dequeuing wrappers that cleanup already claimed.
6262
workers.queued.forEach(Runnable::run);
6363
Assertions.assertEquals(0, reads.get());
64-
Assertions.assertFalse(workers.isShutdown());
6564
Assertions.assertThrows(CancellationException.class, () -> scope.submit(reads::incrementAndGet));
6665
}
6766

@@ -155,7 +154,6 @@ public void execute(Runnable task) {
155154
Assertions.assertInstanceOf(CancellationException.class,
156155
Assertions.assertThrows(CompletionException.class, accepted::join).getCause());
157156
workers.queued.forEach(Runnable::run);
158-
Assertions.assertFalse(workers.isShutdown());
159157
}
160158

161159
@Test

‎fe/fe-connector/fe-connector-spi/src/test/java/org/apache/doris/connector/spi/scan/ConnectorScanContextTest.java‎

Lines changed: 0 additions & 88 deletions
This file was deleted.

‎fe/fe-core/src/test/java/org/apache/doris/datasource/scan/PluginDrivenScanNodePartitionBatchTest.java‎

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
import com.google.common.collect.Multimap;
4040
import org.junit.jupiter.api.Assertions;
4141
import org.junit.jupiter.api.Test;
42+
import org.junit.jupiter.params.ParameterizedTest;
43+
import org.junit.jupiter.params.provider.ValueSource;
4244
import org.mockito.Mockito;
4345

4446
import java.util.ArrayDeque;
@@ -55,14 +57,13 @@
5557
import java.util.concurrent.atomic.AtomicInteger;
5658

5759
class PluginDrivenScanNodePartitionBatchTest {
58-
@Test
59-
void initialBatchRetainsConfiguredSizeAcrossPartitions() throws Exception {
60+
@ParameterizedTest
61+
@ValueSource(ints = {1, 1024})
62+
void batchesRetainConfiguredSizeAcrossPartitions(int partitionsPerBatch) throws Exception {
6063
Fixture fixture = new Fixture(128, Collections.emptySet(), 100, 128);
61-
try (SplitProducer.BatchSource source = fixture.sources(3, 1, 1).get(0)) {
64+
try (SplitProducer.BatchSource source = fixture.sources(3, partitionsPerBatch, 1).get(0)) {
6265
List<Split> first = source.getNextBatch();
6366
Assertions.assertEquals(128, first.size());
64-
Assertions.assertEquals(Arrays.asList(Collections.singletonList("0"), Collections.singletonList("1")),
65-
fixture.loaded);
6667

6768
List<Split> second = source.getNextBatch();
6869
Assertions.assertEquals(128, second.size(), "Subsequent batches retain the configured size");
@@ -84,17 +85,6 @@ void initialBatchRetainsConfiguredSizeAcrossPartitions() throws Exception {
8485
}
8586
}
8687

87-
@Test
88-
void firstBatchRetainsConfiguredSizeWithinALargePartitionBatch() throws Exception {
89-
Fixture fixture = new Fixture(128, Collections.emptySet(), 100, 128);
90-
try (SplitProducer.BatchSource source = fixture.sources(3, 1024, 1).get(0)) {
91-
Assertions.assertEquals(128, source.getNextBatch().size());
92-
Assertions.assertEquals(128, source.getNextBatch().size());
93-
Assertions.assertEquals(44, source.getNextBatch().size());
94-
Assertions.assertTrue(source.getNextBatch().isEmpty());
95-
}
96-
}
97-
9888
@Test
9989
void wholeScanStreamingRetainsConfiguredBatchSize() throws Exception {
10090
Fixture fixture = new Fixture(128, Collections.emptySet(), 200, 128);

‎fe/fe-core/src/test/java/org/apache/doris/datasource/split/SplitAssignmentTest.java‎

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ void firstSplitTimeoutReportsProgressAndStopsEnumeration() {
111111
long start = System.nanoTime();
112112
UserException failure = Assertions.assertThrows(UserException.class, () -> splitAssignment.init(50));
113113
long elapsedMillis = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start);
114-
Assertions.assertTrue(elapsedMillis >= 40 && elapsedMillis < 5000, "elapsed: " + elapsedMillis);
114+
Assertions.assertTrue(elapsedMillis >= 40, "elapsed: " + elapsedMillis);
115115
Assertions.assertTrue(failure.getMessage().contains("50 ms"));
116116
Assertions.assertTrue(failure.getMessage().contains("partitions_processed=1/10000"), failure.getMessage());
117117
Assertions.assertTrue(failure.getMessage().contains("files_enumerated=100"), failure.getMessage());
@@ -147,25 +147,6 @@ void successfulStopWinsAConcurrentInitializationFailure() throws Exception {
147147
Assertions.assertDoesNotThrow(() -> splitAssignment.init(50));
148148
}
149149

150-
@Test
151-
void successfulStopKeepsLateFetchesSuccessfulAfterAProducerFailure() throws Exception {
152-
SplitSource source = new SplitSource(mockBackend, splitAssignment, 1000);
153-
splitAssignment.stop();
154-
splitAssignment.setException(new UserException("late producer failure"));
155-
Assertions.assertNull(splitAssignment.getAssignedSplits(mockBackend));
156-
Assertions.assertTrue(source.getNextBatch(1).isEmpty());
157-
}
158-
159-
@Test
160-
void firstFailureSurvivesCleanupAndSubsequentFailure() {
161-
UserException original = new UserException("query timeout");
162-
splitAssignment.setException(original);
163-
splitAssignment.setException(new UserException("listing failed after cancellation"));
164-
splitAssignment.stop();
165-
Assertions.assertSame(original, Assertions.assertThrows(UserException.class,
166-
() -> splitAssignment.getAssignedSplits(mockBackend)));
167-
}
168-
169150
@Test
170151
void firstConvertedSplitDoesNotWaitForAnotherBackendAssignment() throws Exception {
171152
CountDownLatch assignmentEntered = new CountDownLatch(1);
@@ -241,10 +222,12 @@ void stopClosesRegisteredResourceOutsideRegistryLock() {
241222

242223
@Test
243224
void closingActiveProducerDoesNotTurnSuccessfulStopIntoFailure() throws Exception {
225+
SplitSource source = new SplitSource(mockBackend, splitAssignment, 1000);
244226
splitAssignment.addCloseable(() -> splitAssignment.setException(new UserException("source closed")));
245227
Assertions.assertDoesNotThrow(() -> splitAssignment.stop());
246228
splitAssignment.setException(new UserException("producer interrupted after stop"));
247229
Assertions.assertNull(splitAssignment.getAssignedSplits(mockBackend));
230+
Assertions.assertTrue(source.getNextBatch(1).isEmpty());
248231
}
249232

250233
@Test

‎fe/fe-core/src/test/java/org/apache/doris/datasource/split/SplitSourceTest.java‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -482,18 +482,6 @@ void concurrentRequestsDoNotDuplicateOrLosePendingSplits() throws Exception {
482482
}
483483
}
484484

485-
@Test
486-
void stopDiscardsTheConsumersPartiallyDrainedBatch() throws Exception {
487-
assignment.addToQueue(splits);
488-
SplitSource source = new SplitSource(backend, assignment, 1000);
489-
Assertions.assertEquals(1, source.getNextBatch(1).size());
490-
SplitAssignment.AssignmentQueue buffered = assignment.getAssignedSplits(backend);
491-
Assertions.assertFalse(buffered.isEmpty());
492-
assignment.stop();
493-
Assertions.assertTrue(buffered.isEmpty(), "stop must release buffered ranges before another fetch");
494-
Assertions.assertTrue(source.getNextBatch(1).isEmpty());
495-
}
496-
497485
@Test
498486
void cancellationUnblocksProducerAndClosesLateResources() throws Exception {
499487
assignment.addToQueue(splits);

‎fe/fe-core/src/test/java/org/apache/doris/qe/QueryScanTaskScopeTest.java‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
package org.apache.doris.qe;
1919

2020
import org.apache.doris.common.Status;
21-
import org.apache.doris.common.UserException;
2221
import org.apache.doris.datasource.split.SplitAssignment;
2322
import org.apache.doris.thrift.TStatusCode;
2423

@@ -91,18 +90,4 @@ void closedScopeCannotLeaveALateScanRegistered() {
9190
Mockito.verify(assignment).stop();
9291
Assertions.assertEquals(1, unregisters.get());
9392
}
94-
95-
@Test
96-
void freshAttemptDoesNotInheritThePreviousAttemptsCancellation() {
97-
QueryScanTaskScope first = new QueryScanTaskScope();
98-
first.cancel(new Status(TStatusCode.CANCELLED, "first attempt"));
99-
first.close();
100-
QueryScanTaskScope next = new QueryScanTaskScope();
101-
SplitAssignment assignment = Mockito.mock(SplitAssignment.class);
102-
next.register(assignment, () -> { });
103-
Mockito.verify(assignment, Mockito.never()).setException(Mockito.any(UserException.class));
104-
Mockito.verify(assignment, Mockito.never()).stop();
105-
next.close();
106-
Mockito.verify(assignment).stop();
107-
}
10893
}

0 commit comments

Comments
 (0)