From 589d525bb1499afea2cc2b5cdcf850d270d88af1 Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Mon, 6 Nov 2023 14:37:29 +0800 Subject: [PATCH 01/13] as report This reverts commit 932036b32f99834b33650fc5b476eff17a22233d. --- Cargo.lock | 9 +++++---- Cargo.toml | 2 +- src/utils/pgwire/Cargo.toml | 1 + src/utils/pgwire/src/pg_message.rs | 3 ++- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bcac410f23035..8959024b636fa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5952,6 +5952,7 @@ dependencies = [ "risingwave_common", "risingwave_sqlparser", "thiserror", + "thiserror-ext", "tokio-openssl", "tokio-postgres", "tracing", @@ -9980,9 +9981,9 @@ dependencies = [ [[package]] name = "thiserror-ext" -version = "0.0.1" +version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f28a4a7351f496662affc257826b85dd2a613406ce3cc2f07b849685e166d8c" +checksum = "bf2d91b1d6113b442d806608303714860955c04dfbe0a9abc343480a482eb83f" dependencies = [ "thiserror", "thiserror-ext-derive", @@ -9990,9 +9991,9 @@ dependencies = [ [[package]] name = "thiserror-ext-derive" -version = "0.0.1" +version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67621f6d39449754da63668ddd2423ad0c81c27434c16090f8805ad1db59b621" +checksum = "930fe467550a10df6f89ffffc4d2e3ab5639b12a4baa756f1a8895d9b8dc185e" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 46d3a60487b89..2c12469270267 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -121,7 +121,7 @@ arrow-buffer = "48" arrow-flight = "48" arrow-select = "48" arrow-ord = "48" -thiserror-ext = "0.0.1" +thiserror-ext = "0.0.3" tikv-jemalloc-ctl = { git = "https://github.com/risingwavelabs/jemallocator.git", rev = "64a2d9" } tikv-jemallocator = { git = "https://github.com/risingwavelabs/jemallocator.git", features = [ "profiling", diff --git a/src/utils/pgwire/Cargo.toml b/src/utils/pgwire/Cargo.toml index c6d46e356518a..0a13c272c0f41 100644 --- a/src/utils/pgwire/Cargo.toml +++ b/src/utils/pgwire/Cargo.toml @@ -25,6 +25,7 @@ panic-message = "0.3" risingwave_common = { workspace = true } risingwave_sqlparser = { workspace = true } thiserror = "1" +thiserror-ext = { workspace = true } tokio = { version = "0.2", package = "madsim-tokio", features = ["rt", "macros"] } tokio-openssl = "0.6.3" tracing = "0.1" diff --git a/src/utils/pgwire/src/pg_message.rs b/src/utils/pgwire/src/pg_message.rs index b28d09116f94f..c33abee46a804 100644 --- a/src/utils/pgwire/src/pg_message.rs +++ b/src/utils/pgwire/src/pg_message.rs @@ -628,12 +628,13 @@ impl<'a> BeMessage<'a> { } BeMessage::ErrorResponse(error) => { + use thiserror_ext::AsReport; // For all the errors set Severity to Error and error code to // 'internal error'. // 'E' signalizes ErrorResponse messages buf.put_u8(b'E'); - let msg = error.to_string(); + let msg = format!("{:#}", error.as_ref().as_report()); write_err_or_notice(buf, &ErrorOrNoticeMessage::internal_error(&msg))?; } From a474acbc5d9a1ff33cfb6b9d844e21c06a7bf756 Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Mon, 6 Nov 2023 15:38:09 +0800 Subject: [PATCH 02/13] gate on pretty error Signed-off-by: Bugen Zhao --- src/utils/pgwire/src/pg_message.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/utils/pgwire/src/pg_message.rs b/src/utils/pgwire/src/pg_message.rs index c33abee46a804..f57df5c308e08 100644 --- a/src/utils/pgwire/src/pg_message.rs +++ b/src/utils/pgwire/src/pg_message.rs @@ -19,6 +19,7 @@ use std::io::{Error, ErrorKind, IoSlice, Result, Write}; use byteorder::{BigEndian, ByteOrder}; /// Part of code learned from . use bytes::{Buf, BufMut, Bytes, BytesMut}; +use risingwave_common::util::env_var::env_var_is_true; use tokio::io::{AsyncRead, AsyncReadExt}; use crate::error_or_notice::ErrorOrNoticeMessage; @@ -634,7 +635,11 @@ impl<'a> BeMessage<'a> { // 'E' signalizes ErrorResponse messages buf.put_u8(b'E'); - let msg = format!("{:#}", error.as_ref().as_report()); + let msg = if env_var_is_true("RW_PRETTY_ERROR") { + format!("{:#}", error.as_ref().as_report()) + } else { + format!("{}", error.as_ref().as_report()) + }; write_err_or_notice(buf, &ErrorOrNoticeMessage::internal_error(&msg))?; } From 148b3688955b2b07d7b4ab3cb5ea644767dc896f Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Tue, 7 Nov 2023 12:38:34 +0800 Subject: [PATCH 03/13] refine panic error message Signed-off-by: Bugen Zhao --- src/utils/pgwire/src/error.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/pgwire/src/error.rs b/src/utils/pgwire/src/error.rs index ce3e3d05bef7d..c591d2f5a15ae 100644 --- a/src/utils/pgwire/src/error.rs +++ b/src/utils/pgwire/src/error.rs @@ -44,8 +44,9 @@ pub enum PsqlError { #[error(transparent)] Internal(BoxedError), - #[error("Panicked when processing: {0}.\n -This is a bug. We would appreciate a bug report at https://github.com/risingwavelabs/risingwave/issues/new?labels=type%2Fbug&template=bug_report.yml.")] + #[error("Panicked when processing: {0} +This is a bug. We would appreciate a bug report at: + https://github.com/risingwavelabs/risingwave/issues/new?labels=type%2Fbug&template=bug_report.yml")] Panic(String), #[error("Unable to set up an ssl connection")] From 0a887c0181180b89f4fd02a5869506b4a6446d87 Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Tue, 7 Nov 2023 16:08:12 +0800 Subject: [PATCH 04/13] remove cleaned-up note Signed-off-by: Bugen Zhao --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8959024b636fa..4d7ff5612266c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9981,9 +9981,9 @@ dependencies = [ [[package]] name = "thiserror-ext" -version = "0.0.3" +version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf2d91b1d6113b442d806608303714860955c04dfbe0a9abc343480a482eb83f" +checksum = "38b5b0c9502e569262736dc627ebaaa77e88fe76a5a1ccca4112f40c52001a55" dependencies = [ "thiserror", "thiserror-ext-derive", @@ -9991,9 +9991,9 @@ dependencies = [ [[package]] name = "thiserror-ext-derive" -version = "0.0.3" +version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "930fe467550a10df6f89ffffc4d2e3ab5639b12a4baa756f1a8895d9b8dc185e" +checksum = "2938767e40b21ee823cdf1d5f747447bd041624689659a655a0e7e8dde258baf" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 2c12469270267..fb61ce25432d0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -121,7 +121,7 @@ arrow-buffer = "48" arrow-flight = "48" arrow-select = "48" arrow-ord = "48" -thiserror-ext = "0.0.3" +thiserror-ext = "0.0.4" tikv-jemalloc-ctl = { git = "https://github.com/risingwavelabs/jemallocator.git", rev = "64a2d9" } tikv-jemallocator = { git = "https://github.com/risingwavelabs/jemallocator.git", features = [ "profiling", From 8759113209292e12f7cf3d83380a403ff7eeab8c Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Tue, 7 Nov 2023 17:13:11 +0800 Subject: [PATCH 05/13] always use pretty Signed-off-by: Bugen Zhao --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- src/utils/pgwire/src/pg_message.rs | 7 ++----- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4d7ff5612266c..c4ebd20ee9dd3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9981,9 +9981,9 @@ dependencies = [ [[package]] name = "thiserror-ext" -version = "0.0.4" +version = "0.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b5b0c9502e569262736dc627ebaaa77e88fe76a5a1ccca4112f40c52001a55" +checksum = "764a8c5e60a634fe2173e20038dc4d11195559b4099c61fc60e489e813268a68" dependencies = [ "thiserror", "thiserror-ext-derive", @@ -9991,9 +9991,9 @@ dependencies = [ [[package]] name = "thiserror-ext-derive" -version = "0.0.4" +version = "0.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2938767e40b21ee823cdf1d5f747447bd041624689659a655a0e7e8dde258baf" +checksum = "5741c7e65941d49975050cfc4d010e2786404a5e1cc130baa12132bfcf8efda4" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index fb61ce25432d0..e6082a5ad6f91 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -121,7 +121,7 @@ arrow-buffer = "48" arrow-flight = "48" arrow-select = "48" arrow-ord = "48" -thiserror-ext = "0.0.4" +thiserror-ext = "0.0.5" tikv-jemalloc-ctl = { git = "https://github.com/risingwavelabs/jemallocator.git", rev = "64a2d9" } tikv-jemallocator = { git = "https://github.com/risingwavelabs/jemallocator.git", features = [ "profiling", diff --git a/src/utils/pgwire/src/pg_message.rs b/src/utils/pgwire/src/pg_message.rs index f57df5c308e08..9ca2779c1ab36 100644 --- a/src/utils/pgwire/src/pg_message.rs +++ b/src/utils/pgwire/src/pg_message.rs @@ -635,11 +635,8 @@ impl<'a> BeMessage<'a> { // 'E' signalizes ErrorResponse messages buf.put_u8(b'E'); - let msg = if env_var_is_true("RW_PRETTY_ERROR") { - format!("{:#}", error.as_ref().as_report()) - } else { - format!("{}", error.as_ref().as_report()) - }; + // Format the error as a pretty report. + let msg = format!("{:#}", error.as_ref().as_report()); write_err_or_notice(buf, &ErrorOrNoticeMessage::internal_error(&msg))?; } From 723aa2d09e1937e7fc32a60fe6b10fede61170e3 Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Tue, 7 Nov 2023 17:15:55 +0800 Subject: [PATCH 06/13] remove prompt in sqllogictest Signed-off-by: Bugen Zhao --- e2e_test/batch/aggregate/sum.slt.part | 4 ++-- e2e_test/batch/basic/dml.slt.part | 2 +- e2e_test/batch/functions/pow.slt.part | 12 ++++++------ e2e_test/ddl/invalid_operation.slt | 2 +- e2e_test/ddl/table/generated_columns.slt.part | 8 ++++---- e2e_test/sink/append_only_sink.slt | 2 +- e2e_test/sink/kafka/avro.slt | 2 +- e2e_test/sink/kafka/protobuf.slt | 2 +- e2e_test/source/basic/datagen.slt | 4 ++-- e2e_test/source/basic/ddl.slt | 4 ++-- .../source/basic/old_row_format_syntax/datagen.slt | 4 ++-- e2e_test/source/basic/old_row_format_syntax/ddl.slt | 4 ++-- e2e_test/streaming/watermark.slt | 2 +- 13 files changed, 26 insertions(+), 26 deletions(-) diff --git a/e2e_test/batch/aggregate/sum.slt.part b/e2e_test/batch/aggregate/sum.slt.part index 825b684975986..1bb04023e04ab 100644 --- a/e2e_test/batch/aggregate/sum.slt.part +++ b/e2e_test/batch/aggregate/sum.slt.part @@ -77,8 +77,8 @@ select sum(d) from t; statement ok insert into t values (9000000000000000000000000000); -statement error Expr error: Numeric out of range +statement error Numeric out of range select sum(d) from t; statement ok -drop table t; \ No newline at end of file +drop table t; diff --git a/e2e_test/batch/basic/dml.slt.part b/e2e_test/batch/basic/dml.slt.part index 281eabf709c2f..a5a260169784c 100644 --- a/e2e_test/batch/basic/dml.slt.part +++ b/e2e_test/batch/basic/dml.slt.part @@ -121,7 +121,7 @@ select * from t order by v1; 1 1 aa 3 2 bb -statement error QueryError: Bind error: update modifying the PK column is unsupported +statement error update modifying the PK column is unsupported update t set (v3, v2) = (v3||v3, v1+v2); statement ok diff --git a/e2e_test/batch/functions/pow.slt.part b/e2e_test/batch/functions/pow.slt.part index 152cb65be0ea8..7ea01e2e1233f 100644 --- a/e2e_test/batch/functions/pow.slt.part +++ b/e2e_test/batch/functions/pow.slt.part @@ -46,11 +46,11 @@ select pow(100000, 0); statement error underflow select pow(100000, -200000000000000); -statement error QueryError: Expr error: Numeric out of range +statement error Numeric out of range select pow(100000, 200000000000000); -statement error QueryError: Expr error: Numeric out of range +statement error Numeric out of range select pow(-100000, 200000000000001); query R @@ -101,11 +101,11 @@ select 100000 ^ 0; statement error underflow select 100000 ^ -200000000000000; -statement error QueryError: Expr error: Numeric out of range +statement error Numeric out of range select 100000 ^ 200000000000000; -statement error QueryError: Expr error: Numeric out of range +statement error Numeric out of range select -100000 ^ 200000000000001; query RRRR @@ -231,10 +231,10 @@ select exp(2::smallint) ---- 7.38905609893065 -statement error QueryError: Expr error: Numeric out of range: overflow +statement error Numeric out of range: overflow select exp(10000000); -statement error QueryError: Expr error: Numeric out of range: underflow +statement error Numeric out of range: underflow select exp(-10000000); query TRR diff --git a/e2e_test/ddl/invalid_operation.slt b/e2e_test/ddl/invalid_operation.slt index f66aed1d3dc9a..621f3d562d60a 100644 --- a/e2e_test/ddl/invalid_operation.slt +++ b/e2e_test/ddl/invalid_operation.slt @@ -264,7 +264,7 @@ SELECT * from v limit 0; statement ok insert into t values (1); -statement error QueryError: Bind error: update modifying the PK column is unsupported +statement error update modifying the PK column is unsupported update t set v = 2; statement ok diff --git a/e2e_test/ddl/table/generated_columns.slt.part b/e2e_test/ddl/table/generated_columns.slt.part index feea107fe9ac1..0ba892b994865 100644 --- a/e2e_test/ddl/table/generated_columns.slt.part +++ b/e2e_test/ddl/table/generated_columns.slt.part @@ -14,7 +14,7 @@ select * from t1; 0 1 2 2.02 1 2 3 3.02 -statement error QueryError: Bind error: update modifying the generated column is unsupported +statement error update modifying the generated column is unsupported update t1 set v1 = 1; statement ok @@ -140,7 +140,7 @@ statement ok drop source t4; # create a table with generated column now -statement error QueryError: Bind error: failed to bind expression: now() +statement error failed to bind expression: now() CREATE TABLE t (v INT, t timestamptz as now()) WITH ( connector = 'datagen', fields.v.kind = 'sequence', @@ -151,9 +151,9 @@ CREATE TABLE t (v INT, t timestamptz as now()) WITH ( ) FORMAT PLAIN ENCODE JSON; # create a table with impure generated column as pk. -statement error QueryError: Bind error: Generated columns with impure expressions should not be part of the primary key. Here column "v2" is defined as part of the primary key. +statement error Generated columns with impure expressions should not be part of the primary key. Here column "v2" is defined as part of the primary key. CREATE TABLE t ( v1 INT, v2 timestamptz AS proctime(), PRIMARY KEY (v1, v2) -); \ No newline at end of file +); diff --git a/e2e_test/sink/append_only_sink.slt b/e2e_test/sink/append_only_sink.slt index 405ca132ae0a9..23bd1706465e3 100644 --- a/e2e_test/sink/append_only_sink.slt +++ b/e2e_test/sink/append_only_sink.slt @@ -22,7 +22,7 @@ create sink invalid_sink_type from t with (connector = 'blackhole', type = 'inva statement error `force_append_only` must be true or false create sink invalid_force_append_only from t with (connector = 'blackhole', force_append_only = 'invalid'); -statement error db error: ERROR: QueryError: Sink error: config error: unsupported sink type invalid +statement error unsupported sink type invalid create sink invalid_connector from t with (connector = 'invalid'); statement ok diff --git a/e2e_test/sink/kafka/avro.slt b/e2e_test/sink/kafka/avro.slt index a30d8b70fd4ba..88909135b9e53 100644 --- a/e2e_test/sink/kafka/avro.slt +++ b/e2e_test/sink/kafka/avro.slt @@ -71,7 +71,7 @@ create sink sink_err from into_kafka with ( format upsert encode avro ( schema.registry = 'http://message_queue:8081'); -statement error encode extra_column error: field not in avro +statement error field not in avro create sink sink_err as select 1 as extra_column, * from into_kafka with ( connector = 'kafka', topic = 'test-rw-sink-upsert-avro', diff --git a/e2e_test/sink/kafka/protobuf.slt b/e2e_test/sink/kafka/protobuf.slt index c6ccb2ac24416..9510c6e7fbf8b 100644 --- a/e2e_test/sink/kafka/protobuf.slt +++ b/e2e_test/sink/kafka/protobuf.slt @@ -76,7 +76,7 @@ format plain encode protobuf ( schema.location = 'file:///risingwave/proto-recursiv', message = 'recursive.AllTypes'); -statement error encode extra_column error: field not in proto +statement error field not in proto create sink sink_err as select 1 as extra_column with ( connector = 'kafka', topic = 'test-rw-sink-append-only-protobuf', diff --git a/e2e_test/source/basic/datagen.slt b/e2e_test/source/basic/datagen.slt index 14cbffb6b589b..dcda3718e49d5 100644 --- a/e2e_test/source/basic/datagen.slt +++ b/e2e_test/source/basic/datagen.slt @@ -182,9 +182,9 @@ statement ok drop table s1; # Do NOT allow With clause to contain a comma only. -statement error QueryError: sql parser error: Expected identifier.* +statement error Expected identifier.* create table s1 (v1 int) with (,) FORMAT PLAIN ENCODE JSON; # Do NOT allow an empty With clause. -statement error QueryError: sql parser error: Expected identifier.* +statement error Expected identifier.* create table s1 (v1 int) with () FORMAT PLAIN ENCODE JSON; diff --git a/e2e_test/source/basic/ddl.slt b/e2e_test/source/basic/ddl.slt index c6c1c0590d558..1bac32d5d512a 100644 --- a/e2e_test/source/basic/ddl.slt +++ b/e2e_test/source/basic/ddl.slt @@ -18,7 +18,7 @@ create source invalid_startup_mode ( ) FORMAT PLAIN ENCODE JSON; # TODO: Better to refine the error message. -statement error internal error: invalid digit found in string +statement error invalid digit found in string create source invalid_startup_timestamp ( column1 varchar ) with ( @@ -28,7 +28,7 @@ create source invalid_startup_timestamp ( properties.bootstrap.server = 'message_queue:29092' ) FORMAT PLAIN ENCODE JSON; -statement error db error: ERROR: QueryError: Protocol error: Schema definition is required, either from SQL or schema registry. +statement error Schema definition is required, either from SQL or schema registry. create source invalid_schema_definition with ( connector = 'kafka', diff --git a/e2e_test/source/basic/old_row_format_syntax/datagen.slt b/e2e_test/source/basic/old_row_format_syntax/datagen.slt index 629bc63728e74..267ae8eff4c66 100644 --- a/e2e_test/source/basic/old_row_format_syntax/datagen.slt +++ b/e2e_test/source/basic/old_row_format_syntax/datagen.slt @@ -182,9 +182,9 @@ statement ok drop table s1; # Do NOT allow With clause to contain a comma only. -statement error QueryError: sql parser error: Expected identifier.* +statement error Expected identifier.* create table s1 (v1 int) with (,) ROW FORMAT JSON; # Do NOT allow an empty With clause. -statement error QueryError: sql parser error: Expected identifier.* +statement error Expected identifier.* create table s1 (v1 int) with () ROW FORMAT JSON; diff --git a/e2e_test/source/basic/old_row_format_syntax/ddl.slt b/e2e_test/source/basic/old_row_format_syntax/ddl.slt index 6d1290463beeb..2ec7239e61d2c 100644 --- a/e2e_test/source/basic/old_row_format_syntax/ddl.slt +++ b/e2e_test/source/basic/old_row_format_syntax/ddl.slt @@ -18,7 +18,7 @@ create source invalid_startup_mode ( ) ROW FORMAT JSON; # TODO: Better to refine the error message. -statement error internal error: invalid digit found in string +statement error invalid digit found in string create source invalid_startup_timestamp ( column1 varchar ) with ( @@ -28,7 +28,7 @@ create source invalid_startup_timestamp ( properties.bootstrap.server = 'message_queue:29092' ) ROW FORMAT JSON; -statement error db error: ERROR: QueryError: Protocol error: Schema definition is required, either from SQL or schema registry. +statement error Schema definition is required, either from SQL or schema registry. create source invalid_schema_definition with ( connector = 'kafka', diff --git a/e2e_test/streaming/watermark.slt b/e2e_test/streaming/watermark.slt index d1a29b88188cf..5d8f189dfd965 100644 --- a/e2e_test/streaming/watermark.slt +++ b/e2e_test/streaming/watermark.slt @@ -55,7 +55,7 @@ statement ok drop table t; # create a watermark with different return type from column -statement error QueryError: Bind error: The return value type of the watermark expression must be identical to the watermark column data type. Current data type of watermark return value: `timestamp with time zone`, column `integer` +statement error The return value type of the watermark expression must be identical to the watermark column data type. Current data type of watermark return value: `timestamp with time zone`, column `integer` CREATE TABLE t ( v INT, WATERMARK FOR v AS to_timestamp(v) - INTERVAL '5' SECOND From e8f0365dc7e02f55de9560a6c68b68ac784deba5 Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Tue, 7 Nov 2023 17:44:20 +0800 Subject: [PATCH 07/13] cleanup imports Signed-off-by: Bugen Zhao --- src/utils/pgwire/src/pg_message.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/utils/pgwire/src/pg_message.rs b/src/utils/pgwire/src/pg_message.rs index 9ca2779c1ab36..c38182db198f2 100644 --- a/src/utils/pgwire/src/pg_message.rs +++ b/src/utils/pgwire/src/pg_message.rs @@ -19,7 +19,6 @@ use std::io::{Error, ErrorKind, IoSlice, Result, Write}; use byteorder::{BigEndian, ByteOrder}; /// Part of code learned from . use bytes::{Buf, BufMut, Bytes, BytesMut}; -use risingwave_common::util::env_var::env_var_is_true; use tokio::io::{AsyncRead, AsyncReadExt}; use crate::error_or_notice::ErrorOrNoticeMessage; From 39493a08ea84d5ea5713ed745ddcf5d17c59c526 Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Wed, 8 Nov 2023 17:08:24 +0800 Subject: [PATCH 08/13] add ui test file Signed-off-by: Bugen Zhao --- e2e_test/error_ui/main.slt | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 e2e_test/error_ui/main.slt diff --git a/e2e_test/error_ui/main.slt b/e2e_test/error_ui/main.slt new file mode 100644 index 0000000000000..9a3df01ebd978 --- /dev/null +++ b/e2e_test/error_ui/main.slt @@ -0,0 +1,41 @@ +statement error +create function int_42() returns int as int_42 using link 'localhost:8815'; +---- +db error: ERROR: QueryError + +Caused by these errors (recent errors listed first): + 1: failed to connect to UDF service + 2: transport error + 3: error trying to connect + 4: invalid URL, scheme is missing + + +statement error +alter system set not_exist_key to value; +---- +db error: ERROR: QueryError + +Caused by this error: + 1: internal error: SystemParams error: unrecognized system param "not_exist_key" + + +query error +select v1 + v2 = v3; +---- +db error: ERROR: QueryError + +Caused by this error: + 1: Bind error: failed to bind expression: v1 + v2 = v3 + +Caused by: + Item not found: Invalid column: v1 + + +query error +select 1/0; +---- +db error: ERROR: QueryError + +Caused by these errors (recent errors listed first): + 1: Expr error + 2: Division by zero From 3cd7a6fef336df7845f17d74d9c5578c695a39e5 Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Wed, 8 Nov 2023 17:36:52 +0800 Subject: [PATCH 09/13] add readme Signed-off-by: Bugen Zhao --- e2e_test/error_ui/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 e2e_test/error_ui/README.md diff --git a/e2e_test/error_ui/README.md b/e2e_test/error_ui/README.md new file mode 100644 index 0000000000000..931a7d49a8985 --- /dev/null +++ b/e2e_test/error_ui/README.md @@ -0,0 +1,11 @@ +# User Interface Test for Error Reporting + +The test cases in this directory act as snapshot tests for the error reporting, to ensure that the UI does not change unexpectedly. + +When you find the tests in this directory failing... + +- First, ensure that the changes to the error messages are expected and make them look better. +- Then, update the snapshots by running: + ```bash + sqllogictest -p 4566 -d dev './e2e_test/error_ui/**/*.slt' --override + ``` From d60b7e13a69b2ba56cc8411e6317662ed9e39f03 Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Wed, 8 Nov 2023 17:41:59 +0800 Subject: [PATCH 10/13] add readme and bump version in risedev Signed-off-by: Bugen Zhao --- Makefile.toml | 2 +- e2e_test/error_ui/README.md | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile.toml b/Makefile.toml index 6f423ea758608..e2df275de0c4b 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -1333,7 +1333,7 @@ echo "All processes has exited." [tasks.slt] category = "RiseDev - SQLLogicTest" -install_crate = { version = "0.17.1", crate_name = "sqllogictest-bin", binary = "sqllogictest", test_arg = [ +install_crate = { version = "0.18.0", crate_name = "sqllogictest-bin", binary = "sqllogictest", test_arg = [ "--help", ], install_command = "binstall" } dependencies = ["check-risedev-env-file"] diff --git a/e2e_test/error_ui/README.md b/e2e_test/error_ui/README.md index 931a7d49a8985..0aa51e5a9ee74 100644 --- a/e2e_test/error_ui/README.md +++ b/e2e_test/error_ui/README.md @@ -5,7 +5,8 @@ The test cases in this directory act as snapshot tests for the error reporting, When you find the tests in this directory failing... - First, ensure that the changes to the error messages are expected and make them look better. -- Then, update the snapshots by running: +- Then, update the test cases by running: ```bash - sqllogictest -p 4566 -d dev './e2e_test/error_ui/**/*.slt' --override + ./risedev slt './e2e_test/error_ui/**/*.slt' --override ``` + Please note that the minimum required version of `sqllogictest` is 0.18 or higher. From 11b2834f555010029b8940db6a5689b19e3adb2d Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Wed, 8 Nov 2023 17:45:43 +0800 Subject: [PATCH 11/13] add ui test to ci script Signed-off-by: Bugen Zhao --- ci/scripts/run-e2e-test.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ci/scripts/run-e2e-test.sh b/ci/scripts/run-e2e-test.sh index 8fb29ec5bd1a2..360c9837e08f7 100755 --- a/ci/scripts/run-e2e-test.sh +++ b/ci/scripts/run-e2e-test.sh @@ -103,6 +103,14 @@ sqllogictest -p 4566 -d dev './e2e_test/generated/**/*.slt' --junit "generated-$ echo "--- Kill cluster" cluster_stop +echo "--- e2e, $mode, error ui" +RUST_LOG="info,risingwave_stream=info,risingwave_batch=info,risingwave_storage=info" \ +cluster_start +sqllogictest -p 4566 -d dev './e2e_test/error_ui/**/*.slt' + +echo "--- Kill cluster" +cluster_stop + echo "--- e2e, $mode, extended query" RUST_LOG="info,risingwave_stream=info,risingwave_batch=info,risingwave_storage=info" \ cluster_start From bb0ce4587a87ebba5ba6a06f75c2f8840ae1f908 Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Thu, 9 Nov 2023 15:27:07 +0800 Subject: [PATCH 12/13] bump ci image for sqllogictest 0.18 Signed-off-by: Bugen Zhao --- Cargo.lock | 4 ++-- ci/Dockerfile | 2 +- ci/build-ci-image.sh | 2 +- ci/docker-compose.yml | 10 +++++----- src/tests/simulation/Cargo.toml | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6f3d766d86cd5..d158be22c0a52 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9489,9 +9489,9 @@ dependencies = [ [[package]] name = "sqllogictest" -version = "0.17.2" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ea1056caa9180e7e5727eed1a377d96c9f4615303fa82d2f4c202c64736dee" +checksum = "e67e8d8e7f43fc5d4c35be73549ea22ed1d712dcf39656a243144677297da5ec" dependencies = [ "async-trait", "educe", diff --git a/ci/Dockerfile b/ci/Dockerfile index dc75af612598e..427e6d68dc116 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -48,7 +48,7 @@ ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash RUN cargo binstall -y --no-symlinks cargo-llvm-cov cargo-nextest cargo-hakari cargo-sort cargo-cache cargo-audit \ cargo-make@0.36.10 \ - sqllogictest-bin@0.17.2 \ + sqllogictest-bin@0.18.0 \ && cargo install sccache \ && cargo cache -a \ && rm -rf "/root/.cargo/registry/index" \ diff --git a/ci/build-ci-image.sh b/ci/build-ci-image.sh index 723fe00a76518..22f486aefdcfa 100755 --- a/ci/build-ci-image.sh +++ b/ci/build-ci-image.sh @@ -9,7 +9,7 @@ cd "$DIR" cat ../rust-toolchain # shellcheck disable=SC2155 -export BUILD_ENV_VERSION=v20231101 +export BUILD_ENV_VERSION=v20231109 export BUILD_TAG="public.ecr.aws/x5u3w5h6/rw-build-env:${BUILD_ENV_VERSION}" diff --git a/ci/docker-compose.yml b/ci/docker-compose.yml index 41ce645f567be..c6289789d5e67 100644 --- a/ci/docker-compose.yml +++ b/ci/docker-compose.yml @@ -71,7 +71,7 @@ services: retries: 5 source-test-env: - image: public.ecr.aws/x5u3w5h6/rw-build-env:v20231101 + image: public.ecr.aws/x5u3w5h6/rw-build-env:v20231109 depends_on: - mysql - db @@ -81,7 +81,7 @@ services: - ..:/risingwave sink-test-env: - image: public.ecr.aws/x5u3w5h6/rw-build-env:v20231101 + image: public.ecr.aws/x5u3w5h6/rw-build-env:v20231109 depends_on: - mysql - db @@ -93,12 +93,12 @@ services: - ..:/risingwave rw-build-env: - image: public.ecr.aws/x5u3w5h6/rw-build-env:v20231101 + image: public.ecr.aws/x5u3w5h6/rw-build-env:v20231109 volumes: - ..:/risingwave ci-flamegraph-env: - image: public.ecr.aws/x5u3w5h6/rw-build-env:v20231101 + image: public.ecr.aws/x5u3w5h6/rw-build-env:v20231109 # NOTE(kwannoel): This is used in order to permit # syscalls for `nperf` (perf_event_open), # so it can do CPU profiling. @@ -109,7 +109,7 @@ services: - ..:/risingwave regress-test-env: - image: public.ecr.aws/x5u3w5h6/rw-build-env:v20231101 + image: public.ecr.aws/x5u3w5h6/rw-build-env:v20231109 depends_on: db: condition: service_healthy diff --git a/src/tests/simulation/Cargo.toml b/src/tests/simulation/Cargo.toml index f5b9d48eb0d20..15ae2e667ff6c 100644 --- a/src/tests/simulation/Cargo.toml +++ b/src/tests/simulation/Cargo.toml @@ -46,7 +46,7 @@ risingwave_sqlsmith = { workspace = true } serde = "1.0.188" serde_derive = "1.0.188" serde_json = "1.0.107" -sqllogictest = "0.17.2" +sqllogictest = "0.18" tempfile = "3" tikv-jemallocator = { workspace = true } tokio = { version = "0.2.24", package = "madsim-tokio" } From 41c88a54190a4c7e5f7dd13c41105df84409a1b1 Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Thu, 9 Nov 2023 17:11:16 +0800 Subject: [PATCH 13/13] fix duplicated error message Signed-off-by: Bugen Zhao --- e2e_test/ddl/invalid_operation.slt | 1 - 1 file changed, 1 deletion(-) diff --git a/e2e_test/ddl/invalid_operation.slt b/e2e_test/ddl/invalid_operation.slt index 621f3d562d60a..df3f58eaf0354 100644 --- a/e2e_test/ddl/invalid_operation.slt +++ b/e2e_test/ddl/invalid_operation.slt @@ -253,7 +253,6 @@ SELECT * from msrc limit 0; # FIXME: improve the error message query error not found SELECT * from sink limit 0; ----- query I SELECT * from v limit 0;