mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
Merge pull request #59146 from ClickHouse/fix-02015_async_inserts_stress_long
Fix `02015_async_inserts_stress_long`
This commit is contained in:
commit
fccc78a75b
@ -11,7 +11,8 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
function insert1()
|
||||
{
|
||||
url="${CLICKHOUSE_URL}&async_insert=1&wait_for_async_insert=0"
|
||||
while true; do
|
||||
local TIMELIMIT=$((SECONDS+$1))
|
||||
while [ $SECONDS -lt "$TIMELIMIT" ]; do
|
||||
${CLICKHOUSE_CURL} -sS "$url" -d 'INSERT INTO async_inserts FORMAT CSV
|
||||
1,"a"
|
||||
2,"b"
|
||||
@ -22,7 +23,8 @@ function insert1()
|
||||
function insert2()
|
||||
{
|
||||
url="${CLICKHOUSE_URL}&async_insert=1&wait_for_async_insert=0"
|
||||
while true; do
|
||||
local TIMELIMIT=$((SECONDS+$1))
|
||||
while [ $SECONDS -lt "$TIMELIMIT" ]; do
|
||||
${CLICKHOUSE_CURL} -sS "$url" -d 'INSERT INTO async_inserts FORMAT JSONEachRow {"id": 5, "s": "e"} {"id": 6, "s": "f"}'
|
||||
done
|
||||
}
|
||||
@ -30,28 +32,32 @@ function insert2()
|
||||
function insert3()
|
||||
{
|
||||
url="${CLICKHOUSE_URL}&async_insert=1&wait_for_async_insert=0"
|
||||
while true; do
|
||||
local TIMELIMIT=$((SECONDS+$1))
|
||||
while [ $SECONDS -lt "$TIMELIMIT" ]; do
|
||||
${CLICKHOUSE_CURL} -sS "$url" -d "INSERT INTO FUNCTION remote('127.0.0.1', $CLICKHOUSE_DATABASE, async_inserts) VALUES (7, 'g') (8, 'h')"
|
||||
done
|
||||
}
|
||||
|
||||
function select1()
|
||||
{
|
||||
while true; do
|
||||
local TIMELIMIT=$((SECONDS+$1))
|
||||
while [ $SECONDS -lt "$TIMELIMIT" ]; do
|
||||
${CLICKHOUSE_CLIENT} -q "SELECT * FROM async_inserts FORMAT Null"
|
||||
done
|
||||
}
|
||||
|
||||
function select2()
|
||||
{
|
||||
while true; do
|
||||
local TIMELIMIT=$((SECONDS+$1))
|
||||
while [ $SECONDS -lt "$TIMELIMIT" ]; do
|
||||
${CLICKHOUSE_CLIENT} -q "SELECT * FROM system.asynchronous_inserts FORMAT Null"
|
||||
done
|
||||
}
|
||||
|
||||
function truncate1()
|
||||
{
|
||||
while true; do
|
||||
local TIMELIMIT=$((SECONDS+$1))
|
||||
while [ $SECONDS -lt "$TIMELIMIT" ]; do
|
||||
sleep 0.1
|
||||
${CLICKHOUSE_CLIENT} -q "TRUNCATE TABLE async_inserts"
|
||||
done
|
||||
@ -70,14 +76,14 @@ export -f select2
|
||||
export -f truncate1
|
||||
|
||||
for _ in {1..5}; do
|
||||
timeout $TIMEOUT bash -c insert1 &
|
||||
timeout $TIMEOUT bash -c insert2 &
|
||||
timeout $TIMEOUT bash -c insert3 &
|
||||
insert1 $TIMEOUT &
|
||||
insert2 $TIMEOUT &
|
||||
insert3 $TIMEOUT &
|
||||
done
|
||||
|
||||
timeout $TIMEOUT bash -c select1 &
|
||||
timeout $TIMEOUT bash -c select2 &
|
||||
timeout $TIMEOUT bash -c truncate1 &
|
||||
select1 $TIMEOUT &
|
||||
select2 $TIMEOUT &
|
||||
truncate1 $TIMEOUT &
|
||||
|
||||
wait
|
||||
echo "OK"
|
||||
|
Loading…
Reference in New Issue
Block a user