-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49122 from CurtizJ/add-async-insert-mt-setting
Add `MergeTree` setting `async_insert`
- Loading branch information
Showing
7 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
tests/queries/0_stateless/02725_async_insert_table_setting.reference
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
2 | ||
2 | ||
default.t_mt_async_insert 1 | ||
default.t_mt_sync_insert 0 |
35 changes: 35 additions & 0 deletions
35
tests/queries/0_stateless/02725_async_insert_table_setting.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env bash | ||
|
||
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) | ||
# shellcheck source=../shell_config.sh | ||
. "$CURDIR"/../shell_config.sh | ||
|
||
${CLICKHOUSE_CLIENT} -n --query " | ||
DROP TABLE IF EXISTS t_mt_async_insert; | ||
DROP TABLE IF EXISTS t_mt_sync_insert; | ||
CREATE TABLE t_mt_async_insert (id UInt64, s String) | ||
ENGINE = MergeTree ORDER BY id SETTINGS async_insert = 1; | ||
CREATE TABLE t_mt_sync_insert (id UInt64, s String) | ||
ENGINE = MergeTree ORDER BY id SETTINGS async_insert = 0;" | ||
|
||
url="${CLICKHOUSE_URL}&async_insert=0&wait_for_async_insert=1" | ||
|
||
${CLICKHOUSE_CURL} -sS "$url" -d "INSERT INTO t_mt_async_insert VALUES (1, 'aa'), (2, 'bb')" | ||
${CLICKHOUSE_CURL} -sS "$url" -d "INSERT INTO t_mt_sync_insert VALUES (1, 'aa'), (2, 'bb')" | ||
|
||
${CLICKHOUSE_CLIENT} -n --query " | ||
SELECT count() FROM t_mt_async_insert; | ||
SELECT count() FROM t_mt_sync_insert; | ||
SYSTEM FLUSH LOGS; | ||
SELECT tables[1], ProfileEvents['AsyncInsertQuery'] FROM system.query_log | ||
WHERE | ||
type = 'QueryFinish' AND | ||
current_database = currentDatabase() AND | ||
query ILIKE 'INSERT INTO t_mt_%sync_insert%' | ||
ORDER BY tables[1]; | ||
DROP TABLE IF EXISTS t_mt_async_insert; | ||
DROP TABLE IF EXISTS t_mt_sync_insert;" |