Merge pull request #64764 from Algunenano/fix_02790

Fix 02790_async_queries_in_query_log (silent discard in MV column matching)
This commit is contained in:
Raúl Marín 2024-06-04 09:18:55 +00:00 committed by GitHub
commit 0917ff0fa0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 6 deletions

View File

@ -68,9 +68,9 @@ type: QueryFinish
read_rows: 3 read_rows: 3
read_bytes: 12 read_bytes: 12
written_rows: 6 written_rows: 6
written_bytes: 12 written_bytes: 24
result_rows: 6 result_rows: 6
result_bytes: 12 result_bytes: 24
query: INSERT INTO default.async_insert_landing SETTINGS wait_for_async_insert = 1, async_insert = 1 FORMAT Values query: INSERT INTO default.async_insert_landing SETTINGS wait_for_async_insert = 1, async_insert = 1 FORMAT Values
query_kind: AsyncInsertFlush query_kind: AsyncInsertFlush
databases: ['default'] databases: ['default']
@ -84,12 +84,12 @@ Row 1:
────── ──────
view_name: default.async_insert_mv view_name: default.async_insert_mv
view_type: Materialized view_type: Materialized
view_query: SELECT id + throwIf(id = 42) FROM default.async_insert_landing view_query: SELECT id + throwIf(id = 42) AS id FROM default.async_insert_landing
view_target: default.async_insert_target view_target: default.async_insert_target
read_rows: 3 read_rows: 3
read_bytes: 12 read_bytes: 12
written_rows: 3 written_rows: 3
written_bytes: 0 written_bytes: 12
status: QueryFinish status: QueryFinish
exception_code: 0 exception_code: 0
@ -101,6 +101,13 @@ table: async_insert_landing
partition_id: all partition_id: all
rows: 3 rows: 3
Row 2:
──────
database: default
table: async_insert_target
partition_id: all
rows: 3
system.query_log system.query_log
Row 1: Row 1:
────── ──────
@ -141,7 +148,7 @@ Row 1:
────── ──────
view_name: default.async_insert_mv view_name: default.async_insert_mv
view_type: Materialized view_type: Materialized
view_query: SELECT id + throwIf(id = 42) FROM default.async_insert_landing view_query: SELECT id + throwIf(id = 42) AS id FROM default.async_insert_landing
view_target: default.async_insert_target view_target: default.async_insert_target
read_rows: 3 read_rows: 3
read_bytes: 12 read_bytes: 12

View File

@ -51,6 +51,7 @@ function print_flush_query_logs()
WHERE WHERE
event_date >= yesterday() event_date >= yesterday()
AND initial_query_id = (SELECT flush_query_id FROM system.asynchronous_insert_log WHERE event_date >= yesterday() AND query_id = '$1') AND initial_query_id = (SELECT flush_query_id FROM system.asynchronous_insert_log WHERE event_date >= yesterday() AND query_id = '$1')
ORDER BY view_name
FORMAT Vertical" FORMAT Vertical"
echo "" echo ""
@ -65,6 +66,7 @@ function print_flush_query_logs()
WHERE WHERE
event_date >= yesterday() event_date >= yesterday()
AND query_id = (SELECT flush_query_id FROM system.asynchronous_insert_log WHERE event_date >= yesterday() AND query_id = '$1') AND query_id = (SELECT flush_query_id FROM system.asynchronous_insert_log WHERE event_date >= yesterday() AND query_id = '$1')
ORDER BY table
FORMAT Vertical" FORMAT Vertical"
} }
@ -77,7 +79,7 @@ print_flush_query_logs ${query_id}
${CLICKHOUSE_CLIENT} -q "CREATE TABLE async_insert_target (id UInt32) ENGINE = MergeTree ORDER BY id" ${CLICKHOUSE_CLIENT} -q "CREATE TABLE async_insert_target (id UInt32) ENGINE = MergeTree ORDER BY id"
${CLICKHOUSE_CLIENT} -q "CREATE MATERIALIZED VIEW async_insert_mv TO async_insert_target AS SELECT id + throwIf(id = 42) FROM async_insert_landing" ${CLICKHOUSE_CLIENT} -q "CREATE MATERIALIZED VIEW async_insert_mv TO async_insert_target AS SELECT id + throwIf(id = 42) AS id FROM async_insert_landing"
query_id="$(random_str 10)" query_id="$(random_str 10)"
${CLICKHOUSE_CLIENT} --query_id="${query_id}" -q "INSERT INTO async_insert_landing SETTINGS wait_for_async_insert=1, async_insert=1 values (11), (12), (13);" ${CLICKHOUSE_CLIENT} --query_id="${query_id}" -q "INSERT INTO async_insert_landing SETTINGS wait_for_async_insert=1, async_insert=1 values (11), (12), (13);"