Skip to content

[Bug]: sql_task.sql BVT is flaky because scheduled SQL task run races with manual-run assertions #24249

Closed

Description

@iamlinjunhong

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch Name

3.0-dev

Commit ID

2ceb06e

Other Environment Information

- Hardware parameters:
- OS type:
- Others:

Actual Behavior

test/distributed/cases/task/sql_task.sql occasionally fails in CI. The case expects the latest sql_task_cron run to be MANUAL, but CI sometimes observes a newer SCHEDULED run instead. The extra scheduled execution also inserts one more row into scheduled_events, so the expected count 2 becomes 3.

Expected Behavior

sql_task.sql should be deterministic in CI. The section that validates manual EXECUTE TASK behavior should not be affected by background scheduled executions, and the latest run/count assertions should consistently match the expected result.

Steps to Reproduce

Run test/distributed/cases/task/sql_task.sql in CI or a slow local environment.
The case creates sql_task_cron, then changes its schedule to every second:
alter task sql_task_cron set schedule '*/1 * * * * *' timezone 'UTC';
The test immediately executes the task manually and asserts exact run/count results:
execute task sql_task_cron;
select sleep(1);
show task runs for sql_task_cron limit 1;
...
execute task sql_task_cron;
select sleep(1);
select count(*) from scheduled_events;
On slower runners, the async scheduled-run pipeline can land a SCHEDULED run during the assertion window, causing show task runs ... limit 1 to return SCHEDULED and scheduled_events to contain one extra row.

Additional information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions