Skip to content

Add limit on the number or total size of pending asynchronous insertions - #61112

Draft
nickitat wants to merge 11 commits into
ClickHouse:masterfrom
nickitat:queue_limit_async_insert
Draft

nickitat wants to merge 11 commits into
ClickHouse:masterfrom
nickitat:queue_limit_async_insert

Conversation

@nickitat

@nickitat nickitat commented Mar 8, 2024

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

@robot-ch-test-poll robot-ch-test-poll added the pr-not-for-changelog This PR should not be mentioned in the changelog label Mar 8, 2024
@robot-ch-test-poll

robot-ch-test-poll commented Mar 8, 2024 •

Copy link
Copy Markdown
Contributor

This is an automated comment for commit f8e3e95 with description of existing statuses. It's updated for the latest CI running

❌ Click here to open a full report in a separate page

Check nameDescriptionStatus
AST fuzzerRuns randomly generated queries to catch program errors. The build type is optionally given in parenthesis. If it fails, ask a maintainer for help❌ failure
CI runningA meta-check that indicates the running CI. Normally, it's in success or pending state. The failed status indicates some problems with the PR❌ failure
Integration testsThe integration tests report. In parenthesis the package type is given, and in square brackets are the optional part/total tests❌ failure
Stateless testsRuns stateless functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc❌ failure
Stress testRuns stateless functional tests concurrently from several clients to detect concurrency-related errors❌ failure
Successful checks
Check nameDescriptionStatus
A SyncIf it fails, ask a maintainer for help✅ success
ClickBenchRuns [ClickBench](https://github.com/ClickHouse/ClickBench/) with instant-attach table✅ success
ClickHouse build checkBuilds ClickHouse in various configurations for use in further steps. You have to fix the builds that fail. Build logs often has enough information to fix the error, but you might have to reproduce the failure locally. The cmake options can be found in the build log, grepping for cmake. Use these options and follow the general build process✅ success
Compatibility checkChecks that clickhouse binary runs on distributions with old libc versions. If it fails, ask a maintainer for help✅ success
Docker keeper imageThe check to build and optionally push the mentioned image to docker hub✅ success
Docker server imageThe check to build and optionally push the mentioned image to docker hub✅ success
Docs checkBuilds and tests the documentation✅ success
Fast testNormally this is the first check that is ran for a PR. It builds ClickHouse and runs most of stateless functional tests, omitting some. If it fails, further checks are not started until it is fixed. Look at the report to see which tests fail, then reproduce the failure locally as described here✅ success
Flaky testsChecks if new added or modified tests are flaky by running them repeatedly, in parallel, with more randomization. Functional tests are run 100 times with address sanitizer, and additional randomization of thread scheduling. Integration tests are run up to 10 times. If at least once a new test has failed, or was too long, this check will be red. We don't allow flaky tests, read the doc✅ success
Install packagesChecks that the built packages are installable in a clear environment✅ success
Mergeable CheckChecks if all other necessary checks are successful✅ success
PR CheckThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Performance ComparisonMeasure changes in query performance. The performance test report is described in detail here. In square brackets are the optional part/total tests✅ success
Stateful testsRuns stateful functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc✅ success
Style checkRuns a set of checks to keep the code style clean. If some of tests failed, see the related log from the report✅ success
Unit testsRuns the unit tests for different release types✅ success
Upgrade checkRuns stress tests on server version from last release and then tries to upgrade it to the version from the PR. It checks if the new server can successfully startup without any errors, crashes or sanitizer asserts✅ success

@alexey-milovidov alexey-milovidov changed the title impl Add a limit on the number of pending asynchronous insertions Mar 9, 2024

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The bash manual says &> is preferred over >&.

@nickitat
nickitat force-pushed the queue_limit_async_insert branch from 9d727ac to 58a6060 Compare March 11, 2024 15:36
@nickitat
nickitat force-pushed the queue_limit_async_insert branch from 58a6060 to aafd26a Compare March 18, 2024 21:25
@al13n321

Copy link
Copy Markdown
Contributor

Wouldn't it be much more useful for the limit to be either in bytes or in number of big-inserts, rather than in number of mini-inserts? That would allow limiting memory usage (relatively) reliably. With the current setting we have to guess the mini-insert size, and would still OOM if there's a spike of unusually big mini-inserts.

@nickitat

Copy link
Copy Markdown
Member Author

Wouldn't it be much more useful for the limit to be either in bytes or in number of big-inserts, rather than in number of mini-inserts? That would allow limiting memory usage (relatively) reliably. With the current setting we have to guess the mini-insert size, and would still OOM if there's a spike of unusually big mini-inserts.

memory usage was out of scope of my interest here, I wanted to solve a pretty simple problem when the server just unable to keep up with the pace of inserts (when they are small and there are a lot of them). we could add one more limit for the number of pending bytes, I think it makes perfect sense too.

@nickitat nickitat changed the title Add a limit on the number of pending asynchronous insertions Add limit on the number or total size of pending asynchronous insertions Mar 25, 2024
@serxa serxa self-assigned this Apr 2, 2024
@nickitat
nickitat force-pushed the queue_limit_async_insert branch 2 times, most recently from 41555b2 to 150aaac Compare April 10, 2024 16:42
@nickitat
nickitat force-pushed the queue_limit_async_insert branch from 09ab750 to 483b8b3 Compare May 30, 2024 17:33
@nickitat
nickitat force-pushed the queue_limit_async_insert branch from 483b8b3 to cbeac36 Compare May 31, 2024 19:31
@clickhouse-gh

clickhouse-gh Bot commented Aug 6, 2024

Copy link
Copy Markdown
Contributor

Dear @nickitat, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message.

@clickhouse-gh

clickhouse-gh Bot commented Nov 26, 2024

Copy link
Copy Markdown
Contributor

Dear @nickitat, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message.

9 similar comments
@clickhouse-gh

clickhouse-gh Bot commented Jan 28, 2025

Copy link
Copy Markdown
Contributor

Dear @nickitat, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message.

@clickhouse-gh

clickhouse-gh Bot commented Apr 1, 2025

Copy link
Copy Markdown
Contributor

Dear @nickitat, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message.

@clickhouse-gh

clickhouse-gh Bot commented Jun 3, 2025

Copy link
Copy Markdown
Contributor

Dear @nickitat, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message.

@clickhouse-gh

clickhouse-gh Bot commented Aug 5, 2025

Copy link
Copy Markdown
Contributor

Dear @nickitat, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message.

@clickhouse-gh

clickhouse-gh Bot commented Oct 7, 2025

Copy link
Copy Markdown
Contributor

Dear @nickitat, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message.

@clickhouse-gh

clickhouse-gh Bot commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

Dear @nickitat, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message.

@clickhouse-gh

clickhouse-gh Bot commented Feb 10, 2026

Copy link
Copy Markdown
Contributor

Dear @nickitat, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message.

@clickhouse-gh

clickhouse-gh Bot commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

Dear @nickitat, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message.

@clickhouse-gh

clickhouse-gh Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Dear @nickitat, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message.

vikashkumar2020 pushed a commit to vikashkumar2020/ClickHouse that referenced this pull request Jul 30, 2026
The code change is unaffected: this commit is empty and the diff against
master is still the same 3 insertions and 2 deletions in
`tests/queries/0_stateless/02015_async_inserts_2.sh`. Only the previous
message's account of when the failure started is wrong.

That message claimed the failure only starts showing up in CI once the
`ClickHouse#89140` merge landed, and concluded that this change is therefore a revert
of that PR's test-side half. Both claims are false. Keying the CI database on
this test name plus `curl: (28)` in `test_context_raw` returns 30 failing
rows all time. The earliest is 2024-03-11 16:55:56 on PR ClickHouse#61112,
`Stateless tests (aarch64)`, carrying the same partial shape the previous
message quotes (`1 a`, `2 b`, `all_1_1_0 2 0` and a curl that received 0
bytes). 27 of those 30 predate the `ClickHouse#89140` merge (`dc5086b93f0959`,
2025-12-24 19:18:34 UTC) and 3 follow it. Counting whole runs since the URL
settings reached their current form (`7c715e66a270e5`, authored 2024-01-30):
475006 runs and 27 such failures before that merge, 563673 runs and 3 after.
The rate is lower in the era that has the flush, so the failure is older
than the flush and this change is not a revert of the only cause.

Both facts hold at once because two routes produced the same visible
signature, and the older one is already closed. Route A was a global
`SYSTEM FLUSH ASYNC INSERT QUEUE` issued by some other stateless test: it
drains every table's queue, so it could partially drain a concurrently
running `02015_async_inserts_2` that had no flush of its own. That route was
removed by `36fc6e58b55cff` (2026-05-21) and the bare form is now rejected
by `ci/jobs/scripts/check_style/various_checks.sh` (added `c3d9664bcee66b`);
no test file on master trips that check today. Route B is this test's own
flush, the mechanism the previous message describes correctly. Both
remaining failures (2026-07-21 and 2026-07-26) are after route A was closed,
so route B is the route that is still live, and deleting these two lines
closes it.

The causal claim for route B rests on the forced-ordering experiment, not on
CI rates, which cannot separate the two routes. Under one forced
interleaving and one binary: unfixed 10/10 FAIL, fixed 10/10 PASS, re-adding
only the explicit flush 4/10 FAIL, re-adding only `sleep 2` 10/10 PASS.

`Both lines were added by PR ClickHouse#89140` stands and is verified: `bf6826835ce5c7`
adds exactly those 2 lines to this file and nothing else, it leaves the
reference file untouched, and its merge commit is an ancestor of master.

Co-Authored-By: Claude Opus 5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Dear @nickitat, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message.

1 similar comment
@clickhouse-gh

clickhouse-gh Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Dear @nickitat, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message.

@abashkeev abashkeev added the comp-async-insert Asynchronous INSERT buffering/queueing and flush semantics. label Sep 3, 2026
@clickhouse-gh

clickhouse-gh Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Dear @nickitat, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message.

This branch has not been deployed

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

Labels

comp-async-insert Asynchronous INSERT buffering/queueing and flush semantics. pr-not-for-changelog This PR should not be mentioned in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants