Add a test for data-race in CreatingSetsTransform

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
Azat Khuzhin 2023-10-08 18:22:31 +02:00
parent cd3c140dd6
commit dee435f8f4
3 changed files with 77 additions and 0 deletions

View File

@ -0,0 +1,7 @@
<clickhouse>
<profiles>
<default>
<max_execution_time>3</max_execution_time>
</default>
</profiles>
</clickhouse>

View File

@ -0,0 +1,70 @@
# pylint: disable=unused-argument
# pylint: disable=redefined-outer-name
# pylint: disable=line-too-long
from helpers.cluster import ClickHouseCluster
from helpers.client import QueryRuntimeException
import pytest
cluster = ClickHouseCluster(__file__)
node = cluster.add_instance("node", user_configs=["configs/users_overrides.xml"])
@pytest.fixture(scope="module", autouse=True)
def start_cluster():
try:
cluster.start()
yield
finally:
cluster.shutdown()
# See https://github.com/ClickHouse/ClickHouse/issues/55279
def test_set():
node.query(
"""
CREATE TABLE 02581_trips (id UInt32, description String, id2 UInt32) ENGINE = MergeTree PRIMARY KEY id ORDER BY id;
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
INSERT INTO 02581_trips SELECT number, '', number FROM numbers(1);
"""
)
with pytest.raises(
QueryRuntimeException,
match="Exception happened during execution of mutation",
):
node.query(
"ALTER TABLE `02581_trips` UPDATE description = 'a' WHERE id IN (SELECT CAST(number * 10, 'UInt32') FROM numbers(10e9)) SETTINGS mutations_sync = 2"
)