From 0692e36bd63c7fbe1e9646382b3d072862a4fa36 Mon Sep 17 00:00:00 2001 From: Konstantin Bogdanov Date: Thu, 5 Sep 2024 03:47:26 +0200 Subject: [PATCH 1/3] temp-commit --- ...nsert_into_distributed_table_bug.reference | 0 ...03233_insert_into_distributed_table_bug.sh | 50 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 tests/queries/0_stateless/03233_insert_into_distributed_table_bug.reference create mode 100755 tests/queries/0_stateless/03233_insert_into_distributed_table_bug.sh diff --git a/tests/queries/0_stateless/03233_insert_into_distributed_table_bug.reference b/tests/queries/0_stateless/03233_insert_into_distributed_table_bug.reference new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/queries/0_stateless/03233_insert_into_distributed_table_bug.sh b/tests/queries/0_stateless/03233_insert_into_distributed_table_bug.sh new file mode 100755 index 00000000000..499868047f0 --- /dev/null +++ b/tests/queries/0_stateless/03233_insert_into_distributed_table_bug.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +# Tags: distributed +# https://github.com/ClickHouse/ClickHouse/issues/65520 + +CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) +# shellcheck source=../shell_config.sh +. "$CURDIR"/../shell_config.sh + + +${CLICKHOUSE_CLIENT} -q "drop database if exists ${CLICKHOUSE_DATABASE}_db on cluster default" +${CLICKHOUSE_CLIENT} -q "create database ${CLICKHOUSE_DATABASE}_db on cluster default" + +${CLICKHOUSE_CLIENT} -q "drop table if exists ${CLICKHOUSE_DATABASE}_db.segfault_table on cluster default" +${CLICKHOUSE_CLIENT} -q "drop table if exists ${CLICKHOUSE_DATABASE}_db.__segfault_table on cluster default" + + +${CLICKHOUSE_CLIENT} -q " +create table ${CLICKHOUSE_DATABASE}_db.__segfault_table on cluster default ( + c_mpcnr33 Int32 primary key, + c_v8s String, + c_l Int32, + c_jismi1 String, + c_p37t64z75 Bool not null, + c_uz Bool, + c_rp Int32 primary key, + c_d56dwp13jp Bool, + c_sf__xnd4 Float64 not null +)" + +${CLICKHOUSE_CLIENT} -q "create table ${CLICKHOUSE_DATABASE}_db.segfault_table on cluster default as ${CLICKHOUSE_DATABASE}_db.__segfault_table ENGINE = Distributed(default, ${CLICKHOUSE_DATABASE}_db, __segfault_table, c_mpcnr33)" + +${CLICKHOUSE_CLIENT} -q " +create table ${CLICKHOUSE_DATABASE}_db.__t_nh1w on cluster default ( + c_sfdzg Int32 , + c_xf Bool , + c_u3xs92nr4c String , + c_b_m Int32 primary key , + c_lgy Int32 , +)" + +${CLICKHOUSE_CLIENT} -q "create table ${CLICKHOUSE_DATABASE}_db.t_nh1w on cluster default as ${CLICKHOUSE_DATABASE}_db.__t_nh1w ENGINE = Distributed(default, ${CLICKHOUSE_DATABASE}_db, __t_nh1w, c_b_m)" + + +query="insert into ${CLICKHOUSE_DATABASE}_db.segfault_table (c_mpcnr33, c_v8s, c_l, c_jismi1, c_p37t64z75, c_uz, c_rp, c_d56dwp13jp, c_sf__xnd4) values (868701807, coalesce((select c_u3xs92nr4c from ${CLICKHOUSE_DATABASE}_db.t_nh1w order by c_u3xs92nr4c limit 1 offset 6), 'llwlzwb3'), 1824351772, coalesce(MACNumToString(lcm(-3, -6)), 'f'))" + +curl -d@- -sS "${CLICKHOUSE_URL}" <<< "$query" + + +${CLICKHOUSE_CLIENT} -q "drop table if exists ${CLICKHOUSE_DATABASE}_db.segfault_table on cluster default" +${CLICKHOUSE_CLIENT} -q "drop table if exists ${CLICKHOUSE_DATABASE}_db.__segfault_table on cluster default" From d18bd05261bfff41649ce5b40cdef1edd14939d2 Mon Sep 17 00:00:00 2001 From: Konstantin Bogdanov Date: Thu, 5 Sep 2024 04:24:47 +0200 Subject: [PATCH 2/3] temp-commit --- ...03233_insert_into_distributed_table_bug.sh | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/queries/0_stateless/03233_insert_into_distributed_table_bug.sh b/tests/queries/0_stateless/03233_insert_into_distributed_table_bug.sh index 499868047f0..a3e943013f7 100755 --- a/tests/queries/0_stateless/03233_insert_into_distributed_table_bug.sh +++ b/tests/queries/0_stateless/03233_insert_into_distributed_table_bug.sh @@ -7,15 +7,15 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) . "$CURDIR"/../shell_config.sh -${CLICKHOUSE_CLIENT} -q "drop database if exists ${CLICKHOUSE_DATABASE}_db on cluster default" -${CLICKHOUSE_CLIENT} -q "create database ${CLICKHOUSE_DATABASE}_db on cluster default" +${CLICKHOUSE_CLIENT} -q "drop database if exists ${CLICKHOUSE_DATABASE}_db on cluster test_cluster_one_shard_two_replicas" +${CLICKHOUSE_CLIENT} -q "create database ${CLICKHOUSE_DATABASE}_db on cluster test_cluster_one_shard_two_replicas" -${CLICKHOUSE_CLIENT} -q "drop table if exists ${CLICKHOUSE_DATABASE}_db.segfault_table on cluster default" -${CLICKHOUSE_CLIENT} -q "drop table if exists ${CLICKHOUSE_DATABASE}_db.__segfault_table on cluster default" +${CLICKHOUSE_CLIENT} -q "drop table if exists ${CLICKHOUSE_DATABASE}_db.segfault_table on cluster test_cluster_one_shard_two_replicas" +${CLICKHOUSE_CLIENT} -q "drop table if exists ${CLICKHOUSE_DATABASE}_db.__segfault_table on cluster test_cluster_one_shard_two_replicas" ${CLICKHOUSE_CLIENT} -q " -create table ${CLICKHOUSE_DATABASE}_db.__segfault_table on cluster default ( +create table ${CLICKHOUSE_DATABASE}_db.__segfault_table on cluster test_cluster_one_shard_two_replicas ( c_mpcnr33 Int32 primary key, c_v8s String, c_l Int32, @@ -24,21 +24,21 @@ create table ${CLICKHOUSE_DATABASE}_db.__segfault_table on cluster default ( c_uz Bool, c_rp Int32 primary key, c_d56dwp13jp Bool, - c_sf__xnd4 Float64 not null + c_sf__xnd4 Float64 not null, )" -${CLICKHOUSE_CLIENT} -q "create table ${CLICKHOUSE_DATABASE}_db.segfault_table on cluster default as ${CLICKHOUSE_DATABASE}_db.__segfault_table ENGINE = Distributed(default, ${CLICKHOUSE_DATABASE}_db, __segfault_table, c_mpcnr33)" +${CLICKHOUSE_CLIENT} -q "create table ${CLICKHOUSE_DATABASE}_db.segfault_table on cluster test_cluster_one_shard_two_replicas as ${CLICKHOUSE_DATABASE}_db.__segfault_table ENGINE = Distributed(test_cluster_one_shard_two_replicas, ${CLICKHOUSE_DATABASE}_db, __segfault_table, c_mpcnr33)" ${CLICKHOUSE_CLIENT} -q " -create table ${CLICKHOUSE_DATABASE}_db.__t_nh1w on cluster default ( - c_sfdzg Int32 , - c_xf Bool , - c_u3xs92nr4c String , - c_b_m Int32 primary key , - c_lgy Int32 , +create table ${CLICKHOUSE_DATABASE}_db.__t_nh1w on cluster test_cluster_one_shard_two_replicas ( + c_sfdzg Int32, + c_xf Bool, + c_u3xs92nr4c String, + c_b_m Int32 primary key, + c_lgy Int32, )" -${CLICKHOUSE_CLIENT} -q "create table ${CLICKHOUSE_DATABASE}_db.t_nh1w on cluster default as ${CLICKHOUSE_DATABASE}_db.__t_nh1w ENGINE = Distributed(default, ${CLICKHOUSE_DATABASE}_db, __t_nh1w, c_b_m)" +${CLICKHOUSE_CLIENT} -q "create table ${CLICKHOUSE_DATABASE}_db.t_nh1w on cluster test_cluster_one_shard_two_replicas as ${CLICKHOUSE_DATABASE}_db.__t_nh1w ENGINE = Distributed(test_cluster_one_shard_two_replicas, ${CLICKHOUSE_DATABASE}_db, __t_nh1w, c_b_m)" query="insert into ${CLICKHOUSE_DATABASE}_db.segfault_table (c_mpcnr33, c_v8s, c_l, c_jismi1, c_p37t64z75, c_uz, c_rp, c_d56dwp13jp, c_sf__xnd4) values (868701807, coalesce((select c_u3xs92nr4c from ${CLICKHOUSE_DATABASE}_db.t_nh1w order by c_u3xs92nr4c limit 1 offset 6), 'llwlzwb3'), 1824351772, coalesce(MACNumToString(lcm(-3, -6)), 'f'))" @@ -46,5 +46,5 @@ query="insert into ${CLICKHOUSE_DATABASE}_db.segfault_table (c_mpcnr33, c_v8s, c curl -d@- -sS "${CLICKHOUSE_URL}" <<< "$query" -${CLICKHOUSE_CLIENT} -q "drop table if exists ${CLICKHOUSE_DATABASE}_db.segfault_table on cluster default" -${CLICKHOUSE_CLIENT} -q "drop table if exists ${CLICKHOUSE_DATABASE}_db.__segfault_table on cluster default" +${CLICKHOUSE_CLIENT} -q "drop table if exists ${CLICKHOUSE_DATABASE}_db.segfault_table on cluster test_cluster_one_shard_two_replicas" +${CLICKHOUSE_CLIENT} -q "drop table if exists ${CLICKHOUSE_DATABASE}_db.__segfault_table on cluster test_cluster_one_shard_two_replicas" From a0e2f6925e0ec93966994f5ee949c94c261a7d6b Mon Sep 17 00:00:00 2001 From: Konstantin Bogdanov Date: Thu, 5 Sep 2024 06:19:57 +0200 Subject: [PATCH 3/3] temp-commit --- ...03233_insert_into_distributed_table_bug.sh | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/queries/0_stateless/03233_insert_into_distributed_table_bug.sh b/tests/queries/0_stateless/03233_insert_into_distributed_table_bug.sh index a3e943013f7..01d1c6542a9 100755 --- a/tests/queries/0_stateless/03233_insert_into_distributed_table_bug.sh +++ b/tests/queries/0_stateless/03233_insert_into_distributed_table_bug.sh @@ -7,15 +7,15 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) . "$CURDIR"/../shell_config.sh -${CLICKHOUSE_CLIENT} -q "drop database if exists ${CLICKHOUSE_DATABASE}_db on cluster test_cluster_one_shard_two_replicas" -${CLICKHOUSE_CLIENT} -q "create database ${CLICKHOUSE_DATABASE}_db on cluster test_cluster_one_shard_two_replicas" +${CLICKHOUSE_CLIENT} -q "drop database if exists ${CLICKHOUSE_DATABASE}_db on cluster test_shard_localhost" +${CLICKHOUSE_CLIENT} -q "create database ${CLICKHOUSE_DATABASE}_db on cluster test_shard_localhost" -${CLICKHOUSE_CLIENT} -q "drop table if exists ${CLICKHOUSE_DATABASE}_db.segfault_table on cluster test_cluster_one_shard_two_replicas" -${CLICKHOUSE_CLIENT} -q "drop table if exists ${CLICKHOUSE_DATABASE}_db.__segfault_table on cluster test_cluster_one_shard_two_replicas" +${CLICKHOUSE_CLIENT} -q "drop table if exists ${CLICKHOUSE_DATABASE}_db.segfault_table on cluster test_shard_localhost" +${CLICKHOUSE_CLIENT} -q "drop table if exists ${CLICKHOUSE_DATABASE}_db.__segfault_table on cluster test_shard_localhost" ${CLICKHOUSE_CLIENT} -q " -create table ${CLICKHOUSE_DATABASE}_db.__segfault_table on cluster test_cluster_one_shard_two_replicas ( +create table ${CLICKHOUSE_DATABASE}_db.__segfault_table on cluster test_shard_localhost ( c_mpcnr33 Int32 primary key, c_v8s String, c_l Int32, @@ -27,10 +27,10 @@ create table ${CLICKHOUSE_DATABASE}_db.__segfault_table on cluster test_cluster_ c_sf__xnd4 Float64 not null, )" -${CLICKHOUSE_CLIENT} -q "create table ${CLICKHOUSE_DATABASE}_db.segfault_table on cluster test_cluster_one_shard_two_replicas as ${CLICKHOUSE_DATABASE}_db.__segfault_table ENGINE = Distributed(test_cluster_one_shard_two_replicas, ${CLICKHOUSE_DATABASE}_db, __segfault_table, c_mpcnr33)" +${CLICKHOUSE_CLIENT} -q "create table ${CLICKHOUSE_DATABASE}_db.segfault_table on cluster test_shard_localhost as ${CLICKHOUSE_DATABASE}_db.__segfault_table ENGINE = Distributed(test_shard_localhost, ${CLICKHOUSE_DATABASE}_db, __segfault_table, c_mpcnr33)" ${CLICKHOUSE_CLIENT} -q " -create table ${CLICKHOUSE_DATABASE}_db.__t_nh1w on cluster test_cluster_one_shard_two_replicas ( +create table ${CLICKHOUSE_DATABASE}_db.__t_nh1w on cluster test_shard_localhost ( c_sfdzg Int32, c_xf Bool, c_u3xs92nr4c String, @@ -38,7 +38,7 @@ create table ${CLICKHOUSE_DATABASE}_db.__t_nh1w on cluster test_cluster_one_shar c_lgy Int32, )" -${CLICKHOUSE_CLIENT} -q "create table ${CLICKHOUSE_DATABASE}_db.t_nh1w on cluster test_cluster_one_shard_two_replicas as ${CLICKHOUSE_DATABASE}_db.__t_nh1w ENGINE = Distributed(test_cluster_one_shard_two_replicas, ${CLICKHOUSE_DATABASE}_db, __t_nh1w, c_b_m)" +${CLICKHOUSE_CLIENT} -q "create table ${CLICKHOUSE_DATABASE}_db.t_nh1w on cluster test_shard_localhost as ${CLICKHOUSE_DATABASE}_db.__t_nh1w ENGINE = Distributed(test_shard_localhost, ${CLICKHOUSE_DATABASE}_db, __t_nh1w, c_b_m)" query="insert into ${CLICKHOUSE_DATABASE}_db.segfault_table (c_mpcnr33, c_v8s, c_l, c_jismi1, c_p37t64z75, c_uz, c_rp, c_d56dwp13jp, c_sf__xnd4) values (868701807, coalesce((select c_u3xs92nr4c from ${CLICKHOUSE_DATABASE}_db.t_nh1w order by c_u3xs92nr4c limit 1 offset 6), 'llwlzwb3'), 1824351772, coalesce(MACNumToString(lcm(-3, -6)), 'f'))" @@ -46,5 +46,5 @@ query="insert into ${CLICKHOUSE_DATABASE}_db.segfault_table (c_mpcnr33, c_v8s, c curl -d@- -sS "${CLICKHOUSE_URL}" <<< "$query" -${CLICKHOUSE_CLIENT} -q "drop table if exists ${CLICKHOUSE_DATABASE}_db.segfault_table on cluster test_cluster_one_shard_two_replicas" -${CLICKHOUSE_CLIENT} -q "drop table if exists ${CLICKHOUSE_DATABASE}_db.__segfault_table on cluster test_cluster_one_shard_two_replicas" +${CLICKHOUSE_CLIENT} -q "drop table if exists ${CLICKHOUSE_DATABASE}_db.segfault_table on cluster test_shard_localhost" +${CLICKHOUSE_CLIENT} -q "drop table if exists ${CLICKHOUSE_DATABASE}_db.__segfault_table on cluster test_shard_localhost"