Skip to content

Handle stopped task queue in table task cleanup tests#17720

Open
xiangfu0 wants to merge 1 commit intoapache:masterfrom
xiangfu0:codex/fix-flaky-table-task-cleanup
Open

Handle stopped task queue in table task cleanup tests#17720
xiangfu0 wants to merge 1 commit intoapache:masterfrom
xiangfu0:codex/fix-flaky-table-task-cleanup

Conversation

@xiangfu0
Copy link
Contributor

@xiangfu0 xiangfu0 commented Feb 18, 2026

Summary

  • Add a test-level task-queue stabilization step in @BeforeMethod to resume SegmentGenerationAndPushTask before scheduling any test task.
  • Replace direct one-shot scheduling with a retry loop in getOrScheduleTask(...) that:
    • attempts scheduling,
    • resumes the task queue on queue-stopped scheduling errors,
    • retries scheduling until success or timeout.
  • Keep active-task cleanup robust by resuming the queue in finally where it is explicitly stopped/deleted.

Validation

Not run (not requested); this is a test-only stability fix targeting flaky test setup in PinotTableRestletResourceTest.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates PinotTableRestletResourceTest to reduce flakiness in testTableTasksCleanupWithActiveTasks by making minion-task state checks and deletion cleanup more race-tolerant when tables are deleted with ignoreActiveTasks=true.

Changes:

  • Added helpers to wait for a task to reach a state or be missing, and to force-delete tasks with retries.
  • Updated the active-task cleanup test to stop the minion task queue before waiting/deleting the task.

Comment on lines +1293 to +1296
sendPutRequest(DEFAULT_INSTANCE.getControllerRequestURLBuilder()
.forStopMinionTaskQueue(MinionConstants.SegmentGenerationAndPushTask.TASK_TYPE));
waitForTaskStateOrTaskMissing(taskName, TaskState.STOPPED);
deleteMinionTaskWithRetry(taskName);
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test stops the minion task queue but never resumes it. This can leak shared state into subsequent tests in this class/suite (note the earlier cleanup test explicitly resumes the queue “to avoid affecting other tests”). Please ensure the queue is resumed (ideally in a finally block or in @AfterMethod cleanup) even if assertions fail.

Copilot uses AI. Check for mistakes.
Comment on lines +1250 to +1254
private static boolean isTaskStateNotFound(IOException e) {
String message = e.getMessage();
return message != null && (message.contains("status code: 404") || message.contains("Not Found")
|| message.contains("does not exist"));
}
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isTaskStateNotFound detects 404s by substring-matching IOException.getMessage(), which is brittle and may misclassify errors if message formats change. Since the request helpers wrap HttpErrorStatusException as the IOException cause, prefer checking e.getCause() for HttpErrorStatusException and using its status code (or a dedicated helper that returns status codes) to reliably detect 404s.

Copilot uses AI. Check for mistakes.
@codecov-commenter
Copy link

codecov-commenter commented Feb 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.21%. Comparing base (60b1f56) to head (ffaaf9a).
⚠️ Report is 9 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master   #17720   +/-   ##
=========================================
  Coverage     63.21%   63.21%           
- Complexity     1501     1502    +1     
=========================================
  Files          3179     3181    +2     
  Lines        190717   190816   +99     
  Branches      29154    29164   +10     
=========================================
+ Hits         120566   120631   +65     
- Misses        60779    60807   +28     
- Partials       9372     9378    +6     
Flag Coverage Δ
custom-integration1 100.00% <ø> (ø)
integration 100.00% <ø> (ø)
integration1 100.00% <ø> (ø)
integration2 0.00% <ø> (ø)
java-11 63.19% <ø> (-0.01%) ⬇️
java-21 63.16% <ø> (-0.03%) ⬇️
temurin 63.21% <ø> (+<0.01%) ⬆️
unittests 63.21% <ø> (+<0.01%) ⬆️
unittests1 55.61% <ø> (-0.05%) ⬇️
unittests2 34.05% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@xiangfu0 xiangfu0 force-pushed the codex/fix-flaky-table-task-cleanup branch from afba597 to 2aca9c1 Compare February 18, 2026 09:11
@xiangfu0 xiangfu0 changed the title Stabilize table task cleanup test in active task deletion Handle stopped task queue in table task cleanup tests Feb 18, 2026
@xiangfu0 xiangfu0 force-pushed the codex/fix-flaky-table-task-cleanup branch from 6a1f4e1 to ffaaf9a Compare February 18, 2026 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants