From 66e579d3d2999fd31cb33e4f12c1fe41eb07dc39 Mon Sep 17 00:00:00 2001 From: zhubin79 <18784715772@163.com> Date: Sat, 30 Nov 2024 12:51:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5server=E4=BB=A3=E7=A0=81=2001?= =?UTF-8?q?2485d5f3da7587b4d6a1042b438e705948fe17?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/dolphin/expected/perf_schema_test.out | 201 ----------------- contrib/dolphin/include/builtin_funcs.ini | 4 +- .../dolphin/include/plugin_utils/datetime.h | 3 +- contrib/dolphin/input/perf_schema_test.source | 58 +++++ .../dolphin/output/perf_schema_test.source | 210 ++++++++++++++++++ contrib/dolphin/plugin_parser/parse_func.cpp | 16 +- contrib/dolphin/plugin_utility.cpp | 2 + contrib/dolphin/plugin_utils/adt/datetime.cpp | 6 +- contrib/dolphin/plugin_utils/adt/float.cpp | 12 +- .../dolphin/plugin_utils/adt/formatting.cpp | 52 +++-- .../dolphin/plugin_utils/adt/pgstatfuncs.cpp | 20 +- .../dolphin/plugin_utils/adt/timestamp.cpp | 5 +- contrib/dolphin/sql/perf_schema_test.sql | 60 ----- contrib/dolphin/tablecmds.cpp | 10 +- 14 files changed, 357 insertions(+), 302 deletions(-) delete mode 100644 contrib/dolphin/expected/perf_schema_test.out create mode 100644 contrib/dolphin/input/perf_schema_test.source create mode 100644 contrib/dolphin/output/perf_schema_test.source delete mode 100644 contrib/dolphin/sql/perf_schema_test.sql diff --git a/contrib/dolphin/expected/perf_schema_test.out b/contrib/dolphin/expected/perf_schema_test.out deleted file mode 100644 index b6d729aa2..000000000 --- a/contrib/dolphin/expected/perf_schema_test.out +++ /dev/null @@ -1,201 +0,0 @@ ---create mysql compatible database -CREATE DATABASE mysqldb01 DBCOMPATIBILITY = 'B'; -CREATE USER monadmin01 monadmin PASSWORD 'Cmcc@123'; -NOTICE: The iteration value of password is not recommended.Setting the iteration value too small reduces the security of the password, and setting it too large results in performance degradation. -CREATE USER user01 PASSWORD 'Cmcc@123'; -NOTICE: The iteration value of password is not recommended.Setting the iteration value too small reduces the security of the password, and setting it too large results in performance degradation. -\c mysqldb01 -SET track_stmt_stat_level = 'L1,L0'; -SHOW track_stmt_stat_level; - track_stmt_stat_level ------------------------ - L1,L0 -(1 row) - -SHOW track_stmt_parameter; - track_stmt_parameter ----------------------- - on -(1 row) - -SHOW enable_thread_pool; - enable_thread_pool --------------------- - off -(1 row) - -SET SESSION AUTHORIZATION monadmin01 PASSWORD 'Cmcc@123'; -SELECT COUNT(*) FROM performance_schema.events_statements_current; - count -------- ---?.* -(1 row) - -SELECT * FROM performance_schema.events_statements_current limit 1; ---?.* ---?.* ---?.* -(1 row) - -SELECT COUNT(*) FROM performance_schema.events_statements_history; - count -------- ---?.* -(1 row) - -SELECT * FROM performance_schema.events_statements_history limit 1; ---?.* ---?.* ---?.* -(1 row) - -SELECT COUNT(*) FROM performance_schema.events_statements_summary_by_digest; - count -------- ---?.* -(1 row) - -SELECT * FROM performance_schema.events_statements_summary_by_digest limit 1; ---?.* ---?.* ---?.* -(1 row) - -SELECT COUNT(*) FROM performance_schema.events_waits_current; - count -------- ---?.* -(1 row) - -SELECT * FROM performance_schema.events_waits_current limit 1; ---?.* ---?.* ---?.* -(1 row) - -SELECT COUNT(*) FROM performance_schema.events_waits_summary_global_by_event_name; - count -------- ---?.* -(1 row) - -SELECT * FROM performance_schema.events_waits_summary_global_by_event_name limit 1; ---?.* ---?.* ---?.* -(1 row) - -SELECT COUNT(*) FROM performance_schema.events_waits_current; - count -------- ---?.* -(1 row) - -SELECT * FROM performance_schema.events_waits_current limit 1; ---?.* ---?.* ---?.* -(1 row) - -SELECT COUNT(*) FROM performance_schema.events_waits_summary_global_by_event_name; - count -------- ---?.* -(1 row) - -SELECT * FROM performance_schema.events_waits_summary_global_by_event_name limit 1; ---?.* ---?.* ---?.* -(1 row) - -SELECT count(*) FROM performance_schema.file_summary_by_instance; - count -------- ---?.* -(1 row) - -SELECT * FROM performance_schema.file_summary_by_instance limit 1; ---?.* ---?.* ---?.* -(1 row) - -SELECT count(*) FROM performance_schema.table_io_waits_summary_by_table; - count -------- ---?.* -(1 row) - -SELECT * FROM performance_schema.table_io_waits_summary_by_table limit 1; ---?.* ---?.* ---?.* -(1 row) - -SELECT count(*) FROM performance_schema.table_io_waits_summary_by_index_usage; - count -------- ---?.* -(1 row) - -SELECT * FROM performance_schema.table_io_waits_summary_by_index_usage limit 1; ---?.* ---?.* ---?.* -(1 row) - -SET SESSION AUTHORIZATION user01 PASSWORD 'Cmcc@123'; -SELECT COUNT(*) FROM performance_schema.events_statements_current; -ERROR: only system/monitor admin can query unique sql view -SELECT COUNT(*) FROM performance_schema.events_statements_history; -ERROR: only system/monitor admin can query unique sql view -SELECT COUNT(*) FROM performance_schema.events_statements_summary_by_digest; -ERROR: only system/monitor admin can query unique sql view -SELECT COUNT(*) FROM performance_schema.events_waits_current; - count -------- ---?.* -(1 row) - -SELECT COUNT(*) FROM performance_schema.events_waits_summary_global_by_event_name; - count -------- ---?.* -(1 row) - -SELECT COUNT(*) FROM performance_schema.events_waits_current; - count -------- ---?.* -(1 row) - -SELECT COUNT(*) FROM performance_schema.events_waits_summary_global_by_event_name; - count -------- ---?.* -(1 row) - -SELECT count(*) FROM performance_schema.file_summary_by_instance; - count -------- ---?.* -(1 row) - -SELECT count(*) FROM performance_schema.table_io_waits_summary_by_table; - count -------- ---?.* -(1 row) - -SELECT count(*) FROM performance_schema.table_io_waits_summary_by_index_usage; - count -------- ---?.* -(1 row) - -\c contrib_regression -DROP user monadmin01 CASCADE; -DROP user user01 CASCADE; -set dolphin.b_compatibility_mode to off; -DROP DATABASE mysqldb01; diff --git a/contrib/dolphin/include/builtin_funcs.ini b/contrib/dolphin/include/builtin_funcs.ini index 1f5ffc433..da403f6e3 100755 --- a/contrib/dolphin/include/builtin_funcs.ini +++ b/contrib/dolphin/include/builtin_funcs.ini @@ -515,8 +515,8 @@ ), AddFuncGroup( "bin_to_num", 2, - AddBuiltinFunc(_0(971), _1("bin_to_num"), _2(1), _3(true), _4(false), _5(bin_to_num), _6(1700), _7(PG_CATALOG_NAMESPACE), _8(BOOTSTRAP_SUPERUSERID), _9(INTERNALlanguageId), _10(0), _11(0), _12(1700), _13(0), _14(false), _15(false), _16(false), _17(false), _18('i'), _19(0), _20(1, 1231), _21(1,1231), _22(1,'v'), _23(NULL), _24(NULL), _25("bin_to_num"), _26(NULL), _27(NULL), _28(NULL), _29(0), _30(false), _31(NULL), _32(false), _33("convert bits to number"), _34('f'), _35(NULL), _36(0), _37(false), _38(NULL), _39(NULL), _40(1,1231)), - AddBuiltinFunc(_0(974), _1("bin_to_num"), _2(0), _3(false), _4(false), _5(bin_to_num_noparam), _6(1700), _7(PG_CATALOG_NAMESPACE), _8(BOOTSTRAP_SUPERUSERID), _9(INTERNALlanguageId), _10(0), _11(0), _12(0), _13(0), _14(false), _15(false), _16(false), _17(false), _18('i'), _19(0), _20(0), _21(NULL), _22(NULL), _23(NULL), _24(NULL), _25("bin_to_num_noparam"), _26(NULL), _27(NULL), _28(NULL), _29(0), _30(false), _31(NULL), _32(false), _33("convert bits to number"), _34('f'), _35(NULL), _36(0), _37(false), _38(NULL), _39(NULL), _40(0)) + AddBuiltinFunc(_0(971), _1("bin_to_num"), _2(1), _3(true), _4(false), _5(bin_to_num), _6(1700), _7(PG_CATALOG_NAMESPACE), _8(BOOTSTRAP_SUPERUSERID), _9(INTERNALlanguageId), _10(1), _11(0), _12(1700), _13(0), _14(false), _15(false), _16(false), _17(false), _18('i'), _19(0), _20(1, 1231), _21(1,1231), _22(1,'v'), _23(1,"bins"), _24(NULL), _25("bin_to_num"), _26(NULL), _27(NULL), _28(NULL), _29(0), _30(false), _31(NULL), _32(false), _33("convert bits to number"), _34('f'), _35(NULL), _36(0), _37(false), _38(NULL), _39(NULL), _40(1,1231)), + AddBuiltinFunc(_0(974), _1("bin_to_num"), _2(0), _3(false), _4(false), _5(bin_to_num_noparam), _6(1700), _7(PG_CATALOG_NAMESPACE), _8(BOOTSTRAP_SUPERUSERID), _9(INTERNALlanguageId), _10(1), _11(0), _12(0), _13(0), _14(false), _15(false), _16(false), _17(false), _18('i'), _19(0), _20(0), _21(NULL), _22(NULL), _23(NULL), _24(NULL), _25("bin_to_num_noparam"), _26(NULL), _27(NULL), _28(NULL), _29(0), _30(false), _31(NULL), _32(false), _33("convert bits to number"), _34('f'), _35(NULL), _36(0), _37(false), _38(NULL), _39(NULL), _40(0)) ), AddFuncGroup( "bit", 3, diff --git a/contrib/dolphin/include/plugin_utils/datetime.h b/contrib/dolphin/include/plugin_utils/datetime.h index 75aefe046..771373853 100644 --- a/contrib/dolphin/include/plugin_utils/datetime.h +++ b/contrib/dolphin/include/plugin_utils/datetime.h @@ -34,7 +34,8 @@ extern int DecodeDateTimeForBDatabase(char** field, int* ftype, int nf, int* dty extern char* AppendFsec(int64 quot, fsec_t fsec); #else extern int DecodeTimeOnlyForBDatabase(char** field, int* ftype, int nf, int* dtype, struct pg_tm* tm, fsec_t* fsec, int* tzp, int D); -extern int DecodeDateTimeForBDatabase(char** field, int* ftype, int nf, int* dtype, struct pg_tm* tm, fsec_t* fsec, int* tzp); +extern int DecodeDateTimeForBDatabase(char** field, int* ftype, int nf, int* dtype, struct pg_tm* tm, + fsec_t* fsec, int* tzp, bool* bc_flag); #endif extern void EncodeDateOnlyForBDatabase(struct pg_tm* tm, int style, char* str); extern void EncodeDateTimeForBDatabase(struct pg_tm* tm, fsec_t fsec, bool print_tz, int tz, const char* tzn, int style, char* str); diff --git a/contrib/dolphin/input/perf_schema_test.source b/contrib/dolphin/input/perf_schema_test.source new file mode 100644 index 000000000..dff6403a2 --- /dev/null +++ b/contrib/dolphin/input/perf_schema_test.source @@ -0,0 +1,58 @@ +--set enable_thread_pool to off +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "enable_thread_pool=off" > /dev/null 2>&1 +\! @abs_bindir@/gs_ctl stop -D @abs_srcdir@/tmp_check/datanode1 > /dev/null 2>&1 +\! @abs_bindir@/gs_ctl start -D @abs_srcdir@/tmp_check/datanode1 > /dev/null 2>&1 +\! sleep 5 +--end + +\! @abs_bindir@/gsql -d postgres -p @portstring@ -r -c "CREATE DATABASE mysqldb01 DBCOMPATIBILITY = 'B';"; +\! @abs_bindir@/gsql -d postgres -p @portstring@ -r -c "CREATE USER monadmin01 monadmin PASSWORD 'Cmcc@123';"; +\! @abs_bindir@/gsql -d postgres -p @portstring@ -r -c "CREATE USER user01 PASSWORD 'Cmcc@123';"; +\! @abs_bindir@/gsql -d mysqldb01 -p @portstring@ -r -c "ALTER DATABASE mysqldb01 SET track_stmt_stat_level TO 'L1,L0';"; + +\! @abs_bindir@/gsql -d mysqldb01 -p @portstring@ -r -c "SHOW track_stmt_stat_level;"; +\! @abs_bindir@/gsql -d mysqldb01 -p @portstring@ -r -c "SHOW track_stmt_parameter;"; +\! @abs_bindir@/gsql -d mysqldb01 -p @portstring@ -r -c "SHOW enable_thread_pool;"; + +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT COUNT(*) FROM performance_schema.events_statements_current;"; +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT * FROM performance_schema.events_statements_current limit 1;"; +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT COUNT(*) FROM performance_schema.events_statements_history;"; +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT * FROM performance_schema.events_statements_history limit 1;"; +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT COUNT(*) FROM performance_schema.events_statements_summary_by_digest;"; +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT * FROM performance_schema.events_statements_summary_by_digest limit 1;"; + +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT COUNT(*) FROM performance_schema.events_waits_current;"; +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT * FROM performance_schema.events_waits_current limit 1;"; +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT COUNT(*) FROM performance_schema.events_waits_summary_global_by_event_name;"; +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT * FROM performance_schema.events_waits_summary_global_by_event_name limit 1;"; + +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT COUNT(*) FROM performance_schema.events_waits_current;"; +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT * FROM performance_schema.events_waits_current limit 1;"; +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT COUNT(*) FROM performance_schema.events_waits_summary_global_by_event_name;"; +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT * FROM performance_schema.events_waits_summary_global_by_event_name limit 1;"; + +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT count(*) FROM performance_schema.file_summary_by_instance;"; +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT * FROM performance_schema.file_summary_by_instance limit 1;"; +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT count(*) FROM performance_schema.table_io_waits_summary_by_table;"; +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT * FROM performance_schema.table_io_waits_summary_by_table limit 1;"; +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT count(*) FROM performance_schema.table_io_waits_summary_by_index_usage;"; +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT * FROM performance_schema.table_io_waits_summary_by_index_usage limit 1;"; + +\! @abs_bindir@/gsql -d mysqldb01 -U user01 -W Cmcc@123 -p @portstring@ -r -c "SELECT COUNT(*) FROM performance_schema.events_statements_current;"; +\! @abs_bindir@/gsql -d mysqldb01 -U user01 -W Cmcc@123 -p @portstring@ -r -c "SELECT COUNT(*) FROM performance_schema.events_statements_history;"; +\! @abs_bindir@/gsql -d mysqldb01 -U user01 -W Cmcc@123 -p @portstring@ -r -c "SELECT COUNT(*) FROM performance_schema.events_statements_summary_by_digest;"; + +\! @abs_bindir@/gsql -d mysqldb01 -U user01 -W Cmcc@123 -p @portstring@ -r -c "SELECT COUNT(*) FROM performance_schema.events_waits_current;"; +\! @abs_bindir@/gsql -d mysqldb01 -U user01 -W Cmcc@123 -p @portstring@ -r -c "SELECT COUNT(*) FROM performance_schema.events_waits_summary_global_by_event_name;"; + +\! @abs_bindir@/gsql -d mysqldb01 -U user01 -W Cmcc@123 -p @portstring@ -r -c "SELECT COUNT(*) FROM performance_schema.events_waits_current;"; +\! @abs_bindir@/gsql -d mysqldb01 -U user01 -W Cmcc@123 -p @portstring@ -r -c "SELECT COUNT(*) FROM performance_schema.events_waits_summary_global_by_event_name;"; + +\! @abs_bindir@/gsql -d mysqldb01 -U user01 -W Cmcc@123 -p @portstring@ -r -c "SELECT count(*) FROM performance_schema.file_summary_by_instance;"; +\! @abs_bindir@/gsql -d mysqldb01 -U user01 -W Cmcc@123 -p @portstring@ -r -c "SELECT count(*) FROM performance_schema.table_io_waits_summary_by_table;"; +\! @abs_bindir@/gsql -d mysqldb01 -U user01 -W Cmcc@123 -p @portstring@ -r -c "SELECT count(*) FROM performance_schema.table_io_waits_summary_by_index_usage;"; + +\! @abs_bindir@/gsql -d postgres -p @portstring@ -r -c "DROP user monadmin01 CASCADE;"; +\! @abs_bindir@/gsql -d postgres -p @portstring@ -r -c "DROP user user01 CASCADE;"; +\! @abs_bindir@/gsql -d postgres -p @portstring@ -r -c "set dolphin.b_compatibility_mode to off;"; +\! @abs_bindir@/gsql -d postgres -p @portstring@ -r -c "DROP DATABASE mysqldb01;"; diff --git a/contrib/dolphin/output/perf_schema_test.source b/contrib/dolphin/output/perf_schema_test.source new file mode 100644 index 000000000..f27353996 --- /dev/null +++ b/contrib/dolphin/output/perf_schema_test.source @@ -0,0 +1,210 @@ +--set enable_thread_pool to off +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "enable_thread_pool=off" > /dev/null 2>&1 +\! @abs_bindir@/gs_ctl stop -D @abs_srcdir@/tmp_check/datanode1 > /dev/null 2>&1 +\! @abs_bindir@/gs_ctl start -D @abs_srcdir@/tmp_check/datanode1 > /dev/null 2>&1 +\! sleep 5 +--end +\! @abs_bindir@/gsql -d postgres -p @portstring@ -r -c "CREATE DATABASE mysqldb01 DBCOMPATIBILITY = 'B';"; +CREATE DATABASE +\! @abs_bindir@/gsql -d postgres -p @portstring@ -r -c "CREATE USER monadmin01 monadmin PASSWORD 'Cmcc@123';"; +NOTICE: The iteration value of password is not recommended.Setting the iteration value too small reduces the security of the password, and setting it too large results in performance degradation. +CREATE ROLE +\! @abs_bindir@/gsql -d postgres -p @portstring@ -r -c "CREATE USER user01 PASSWORD 'Cmcc@123';"; +NOTICE: The iteration value of password is not recommended.Setting the iteration value too small reduces the security of the password, and setting it too large results in performance degradation. +CREATE ROLE +\! @abs_bindir@/gsql -d mysqldb01 -p @portstring@ -r -c "ALTER DATABASE mysqldb01 SET track_stmt_stat_level TO 'L1,L0';"; +ALTER DATABASE +\! @abs_bindir@/gsql -d mysqldb01 -p @portstring@ -r -c "SHOW track_stmt_stat_level;"; + track_stmt_stat_level +----------------------- + L1,L0 +(1 row) + +\! @abs_bindir@/gsql -d mysqldb01 -p @portstring@ -r -c "SHOW track_stmt_parameter;"; + track_stmt_parameter +---------------------- + on +(1 row) + +\! @abs_bindir@/gsql -d mysqldb01 -p @portstring@ -r -c "SHOW enable_thread_pool;"; + enable_thread_pool +-------------------- + off +(1 row) + +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT COUNT(*) FROM performance_schema.events_statements_current;"; + count +------- +--?.* +(1 row) + +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT * FROM performance_schema.events_statements_current limit 1;"; +--?.* +--?.* +--?.* +(1 row) + +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT COUNT(*) FROM performance_schema.events_statements_history;"; + count +------- +--?.* +(1 row) + +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT * FROM performance_schema.events_statements_history limit 1;"; +--?.* +--?.* +--?.* +(1 row) + +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT COUNT(*) FROM performance_schema.events_statements_summary_by_digest;"; + count +------- +--?.* +(1 row) + +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT * FROM performance_schema.events_statements_summary_by_digest limit 1;"; +--?.* +--?.* +--?.* +(1 row) + +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT COUNT(*) FROM performance_schema.events_waits_current;"; + count +------- +--?.* +(1 row) + +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT * FROM performance_schema.events_waits_current limit 1;"; +--?.* +--?.* +--?.* +(1 row) + +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT COUNT(*) FROM performance_schema.events_waits_summary_global_by_event_name;"; + count +------- +--?.* +(1 row) + +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT * FROM performance_schema.events_waits_summary_global_by_event_name limit 1;"; +--?.* +--?.* +--?.* +(1 row) + +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT COUNT(*) FROM performance_schema.events_waits_current;"; + count +------- +--?.* +(1 row) + +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT * FROM performance_schema.events_waits_current limit 1;"; +--?.* +--?.* +--?.* +(1 row) + +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT COUNT(*) FROM performance_schema.events_waits_summary_global_by_event_name;"; + count +------- +--?.* +(1 row) + +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT * FROM performance_schema.events_waits_summary_global_by_event_name limit 1;"; +--?.* +--?.* +--?.* +(1 row) + +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT count(*) FROM performance_schema.file_summary_by_instance;"; + count +------- +--?.* +(1 row) + +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT * FROM performance_schema.file_summary_by_instance limit 1;"; +--?.* +--?.* +--?.* +(1 row) + +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT count(*) FROM performance_schema.table_io_waits_summary_by_table;"; + count +------- +--?.* +(1 row) + +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT * FROM performance_schema.table_io_waits_summary_by_table limit 1;"; +--?.* +--?.* +--?.* +(1 row) + +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT count(*) FROM performance_schema.table_io_waits_summary_by_index_usage;"; + count +------- +--?.* +(1 row) + +\! @abs_bindir@/gsql -d mysqldb01 -U monadmin01 -W Cmcc@123 -p @portstring@ -r -c "SELECT * FROM performance_schema.table_io_waits_summary_by_index_usage limit 1;"; +--?.* +--?.* +--?.* +(1 row) + +\! @abs_bindir@/gsql -d mysqldb01 -U user01 -W Cmcc@123 -p @portstring@ -r -c "SELECT COUNT(*) FROM performance_schema.events_statements_current;"; +ERROR: only system/monitor admin can query unique sql view +\! @abs_bindir@/gsql -d mysqldb01 -U user01 -W Cmcc@123 -p @portstring@ -r -c "SELECT COUNT(*) FROM performance_schema.events_statements_history;"; +ERROR: user user01 has no privilege to use schema dbe_perf +\! @abs_bindir@/gsql -d mysqldb01 -U user01 -W Cmcc@123 -p @portstring@ -r -c "SELECT COUNT(*) FROM performance_schema.events_statements_summary_by_digest;"; +ERROR: only system/monitor admin can query unique sql view +\! @abs_bindir@/gsql -d mysqldb01 -U user01 -W Cmcc@123 -p @portstring@ -r -c "SELECT COUNT(*) FROM performance_schema.events_waits_current;"; + count +------- +--?.* +(1 row) + +\! @abs_bindir@/gsql -d mysqldb01 -U user01 -W Cmcc@123 -p @portstring@ -r -c "SELECT COUNT(*) FROM performance_schema.events_waits_summary_global_by_event_name;"; + count +------- +--?.* +(1 row) + +\! @abs_bindir@/gsql -d mysqldb01 -U user01 -W Cmcc@123 -p @portstring@ -r -c "SELECT COUNT(*) FROM performance_schema.events_waits_current;"; + count +------- +--?.* +(1 row) + +\! @abs_bindir@/gsql -d mysqldb01 -U user01 -W Cmcc@123 -p @portstring@ -r -c "SELECT COUNT(*) FROM performance_schema.events_waits_summary_global_by_event_name;"; + count +------- +--?.* +(1 row) + +\! @abs_bindir@/gsql -d mysqldb01 -U user01 -W Cmcc@123 -p @portstring@ -r -c "SELECT count(*) FROM performance_schema.file_summary_by_instance;"; + count +------- +--?.* +(1 row) + +\! @abs_bindir@/gsql -d mysqldb01 -U user01 -W Cmcc@123 -p @portstring@ -r -c "SELECT count(*) FROM performance_schema.table_io_waits_summary_by_table;"; + count +------- +--?.* +(1 row) + +\! @abs_bindir@/gsql -d mysqldb01 -U user01 -W Cmcc@123 -p @portstring@ -r -c "SELECT count(*) FROM performance_schema.table_io_waits_summary_by_index_usage;"; + count +------- +--?.* +(1 row) + +\! @abs_bindir@/gsql -d postgres -p @portstring@ -r -c "DROP user monadmin01 CASCADE;"; +DROP ROLE +\! @abs_bindir@/gsql -d postgres -p @portstring@ -r -c "DROP user user01 CASCADE;"; +DROP ROLE +\! @abs_bindir@/gsql -d postgres -p @portstring@ -r -c "set dolphin.b_compatibility_mode to off;"; +SET +\! @abs_bindir@/gsql -d postgres -p @portstring@ -r -c "DROP DATABASE mysqldb01;"; +DROP DATABASE diff --git a/contrib/dolphin/plugin_parser/parse_func.cpp b/contrib/dolphin/plugin_parser/parse_func.cpp index f392b4d0c..42a024022 100644 --- a/contrib/dolphin/plugin_parser/parse_func.cpp +++ b/contrib/dolphin/plugin_parser/parse_func.cpp @@ -2095,11 +2095,19 @@ static void unify_hypothetical_args(ParseState *pstate, * Select common type, giving preference to the aggregated argument's * type (we'd rather coerce the direct argument once than coerce all * the aggregated values). + * + * In A compatibility, we always coerce the direct argument to the type + * of the aggregated values. So that even if they are not in the same + * type category, we can still do the coercing. */ - commontype = select_common_type(pstate, - list_make2(args[aargpos], args[i]), - "WITHIN GROUP", - NULL); + if (DB_IS_CMPT(A_FORMAT)) { + commontype = getBaseType(exprType(args[aargpos])); + } else { + commontype = select_common_type(pstate, + list_make2(args[aargpos], args[i]), + "WITHIN GROUP", + NULL); + } /* * Perform the coercions. We don't need to worry about NamedArgExprs diff --git a/contrib/dolphin/plugin_utility.cpp b/contrib/dolphin/plugin_utility.cpp index cb97b550c..d66f54d1c 100644 --- a/contrib/dolphin/plugin_utility.cpp +++ b/contrib/dolphin/plugin_utility.cpp @@ -3477,6 +3477,8 @@ void standard_ProcessUtility(processutility_context* processutility_cxt, if (u_sess->plsql_cxt.debug_query_string) { pfree_ext(u_sess->plsql_cxt.debug_query_string); } + list_free_ext(u_sess->plsql_cxt.func_compiled_list); + u_sess->plsql_cxt.real_func_num = 0; set_create_plsql_type_end(); set_function_style_none(); u_sess->plsql_cxt.isCreatePkg = false; diff --git a/contrib/dolphin/plugin_utils/adt/datetime.cpp b/contrib/dolphin/plugin_utils/adt/datetime.cpp index e83cf15eb..915e1dcc1 100644 --- a/contrib/dolphin/plugin_utils/adt/datetime.cpp +++ b/contrib/dolphin/plugin_utils/adt/datetime.cpp @@ -958,7 +958,8 @@ int ParseDateTime( #ifdef DOLPHIN int DecodeDateTimeForBDatabase(char** field, int* ftype, int nf, int* dtype, struct pg_tm* tm, fsec_t* fsec, int* tzp, unsigned int date_flag) #else -int DecodeDateTimeForBDatabase(char** field, int* ftype, int nf, int* dtype, struct pg_tm* tm, fsec_t* fsec, int* tzp) +int DecodeDateTimeForBDatabase(char** field, int* ftype, int nf, int* dtype, struct pg_tm* tm, fsec_t* fsec, int* tzp, + bool* bc_flag) #endif { unsigned int fmask = 0, tmask; @@ -1497,6 +1498,9 @@ int DecodeDateTimeForBDatabase(char** field, int* ftype, int nf, int* dtype, str #ifdef DOLPHIN dterr = ValidateDate(fmask, isjulian, is2digits, bc, ad, tm, date_flag); #else + if (bc_flag != nullptr) { + *bc_flag = bc; + } dterr = ValidateDate(fmask, isjulian, is2digits, bc, tm); #endif if (dterr) diff --git a/contrib/dolphin/plugin_utils/adt/float.cpp b/contrib/dolphin/plugin_utils/adt/float.cpp index 1ee8344a3..4ecc6d398 100644 --- a/contrib/dolphin/plugin_utils/adt/float.cpp +++ b/contrib/dolphin/plugin_utils/adt/float.cpp @@ -622,7 +622,7 @@ Datum float4out(PG_FUNCTION_ARGS) errno_t rc = EOK; if (isnan(num)) { - if (u_sess->attr.attr_sql.enable_binary_special_a_format) { + if (DB_IS_CMPT(A_FORMAT) && u_sess->attr.attr_sql.enable_binary_special_a_format && !is_req_from_jdbc()) { rc = strcpy_s(ascii, MAXDOUBLEWIDTH + 1, "Nan"); } else { rc = strcpy_s(ascii, MAXDOUBLEWIDTH + 1, "NaN"); @@ -633,7 +633,7 @@ Datum float4out(PG_FUNCTION_ARGS) switch (is_infinite(num)) { case 1: - if (u_sess->attr.attr_sql.enable_binary_special_a_format) { + if (DB_IS_CMPT(A_FORMAT) && u_sess->attr.attr_sql.enable_binary_special_a_format && !is_req_from_jdbc()) { rc = strcpy_s(ascii, MAXDOUBLEWIDTH + 1, "Inf"); } else { rc = strcpy_s(ascii, MAXDOUBLEWIDTH + 1, "Infinity"); @@ -641,7 +641,7 @@ Datum float4out(PG_FUNCTION_ARGS) securec_check_ss(rc, "\0", "\0"); break; case -1: - if (u_sess->attr.attr_sql.enable_binary_special_a_format) { + if (DB_IS_CMPT(A_FORMAT) && u_sess->attr.attr_sql.enable_binary_special_a_format && !is_req_from_jdbc()) { rc = strcpy_s(ascii, MAXDOUBLEWIDTH + 1, "-Inf"); } else { rc = strcpy_s(ascii, MAXDOUBLEWIDTH + 1, "-Infinity"); @@ -907,7 +907,7 @@ Datum float8out(PG_FUNCTION_ARGS) errno_t rc = EOK; if (isnan(num)) { - if (u_sess->attr.attr_sql.enable_binary_special_a_format && !is_req_from_jdbc()) { + if (DB_IS_CMPT(A_FORMAT) && u_sess->attr.attr_sql.enable_binary_special_a_format && !is_req_from_jdbc()) { rc = strcpy_s(ascii, MAXDOUBLEWIDTH + 1, "Nan"); } else { rc = strcpy_s(ascii, MAXDOUBLEWIDTH + 1, "NaN"); @@ -917,7 +917,7 @@ Datum float8out(PG_FUNCTION_ARGS) } switch (is_infinite(num)) { case 1: - if (u_sess->attr.attr_sql.enable_binary_special_a_format && !is_req_from_jdbc()) { + if (DB_IS_CMPT(A_FORMAT) && u_sess->attr.attr_sql.enable_binary_special_a_format && !is_req_from_jdbc()) { rc = strcpy_s(ascii, MAXDOUBLEWIDTH + 1, "Inf"); } else { rc = strcpy_s(ascii, MAXDOUBLEWIDTH + 1, "Infinity"); @@ -925,7 +925,7 @@ Datum float8out(PG_FUNCTION_ARGS) securec_check(rc, "\0", "\0"); break; case -1: - if (u_sess->attr.attr_sql.enable_binary_special_a_format && !is_req_from_jdbc()) { + if (DB_IS_CMPT(A_FORMAT) && u_sess->attr.attr_sql.enable_binary_special_a_format && !is_req_from_jdbc()) { rc = strcpy_s(ascii, MAXDOUBLEWIDTH + 1, "-Inf"); } else { rc = strcpy_s(ascii, MAXDOUBLEWIDTH + 1, "-Infinity"); diff --git a/contrib/dolphin/plugin_utils/adt/formatting.cpp b/contrib/dolphin/plugin_utils/adt/formatting.cpp index a94d9b805..1d7d653fa 100644 --- a/contrib/dolphin/plugin_utils/adt/formatting.cpp +++ b/contrib/dolphin/plugin_utils/adt/formatting.cpp @@ -6803,6 +6803,10 @@ static char* NUM_processor(FormatNode* node, NUMDesc* Num, char* inout, char* nu */ \ len = strlen(VARDATA(result)); \ SET_VARSIZE(result, len + VARHDRSZ); \ + /* In A compatibility, all we need for overflow num is a pure "###" style str */ \ + if (u_sess->attr.attr_sql.sql_compatibility == A_FORMAT && overflow) { \ + fill_str(VARDATA(result), '#', len); \ + } \ } while (0) @@ -7129,6 +7133,7 @@ Datum numeric_to_char(PG_FUNCTION_ARGS) FormatNode* format = NULL; text* result = NULL; bool shouldFree = false; + bool overflow = false; int len = 0, plen = 0, sign = 0; char *numstr = NULL, *orgnum = NULL, *p = NULL; Numeric x; @@ -7214,9 +7219,13 @@ Datum numeric_to_char(PG_FUNCTION_ARGS) if (Num.pre > len) plen = Num.pre - len; else if (len > Num.pre) { - numstr = (char*)palloc(Num.pre + Num.post + 2); - fill_str(numstr, '#', Num.pre + Num.post + 1); - *(numstr + Num.pre) = '.'; + overflow = true; + // if overflow when A_FORMAT, do fill_str later. + if (u_sess->attr.attr_sql.sql_compatibility != A_FORMAT) { + numstr = (char*)palloc(Num.pre + Num.post + 2); + fill_str(numstr, '#', Num.pre + Num.post + 1); + *(numstr + Num.pre) = '.'; + } } } @@ -7243,6 +7252,7 @@ Datum int4_to_char(PG_FUNCTION_ARGS) FormatNode* format = NULL; text* result = NULL; bool shouldFree = false; + bool overflow = false; int len = 0, plen = 0, sign = 0; char *numstr = NULL, *orgnum = NULL; errno_t ret = EOK; @@ -7312,9 +7322,12 @@ Datum int4_to_char(PG_FUNCTION_ARGS) if (Num.pre > len) plen = Num.pre - len; else if (len > Num.pre) { - numstr = (char*)palloc(Num.pre + Num.post + 2); - fill_str(numstr, '#', Num.pre + Num.post + 1); - *(numstr + Num.pre) = '.'; + overflow = true; + if (u_sess->attr.attr_sql.sql_compatibility != A_FORMAT) { + numstr = (char*)palloc(Num.pre + Num.post + 2); + fill_str(numstr, '#', Num.pre + Num.post + 1); + *(numstr + Num.pre) = '.'; + } } } @@ -7334,6 +7347,7 @@ Datum int8_to_char(PG_FUNCTION_ARGS) FormatNode* format = NULL; text* result = NULL; bool shouldFree = false; + bool overflow = false; int len = 0, plen = 0, sign = 0; char *numstr = NULL, *orgnum = NULL; errno_t ret = EOK; @@ -7413,8 +7427,11 @@ Datum int8_to_char(PG_FUNCTION_ARGS) if (Num.pre > len) plen = Num.pre - len; else if (len > Num.pre) { - numstr = (char*)palloc(Num.pre + Num.post + 2); - fill_str(numstr, '#', Num.pre + Num.post + 1); + overflow = true; + if (u_sess->attr.attr_sql.sql_compatibility != A_FORMAT) { + numstr = (char*)palloc(Num.pre + Num.post + 2); + fill_str(numstr, '#', Num.pre + Num.post + 1); + } } } @@ -7434,6 +7451,7 @@ Datum float4_to_char(PG_FUNCTION_ARGS) FormatNode* format = NULL; text* result = NULL; bool shouldFree = false; + bool overflow = false; int len = 0, plen = 0, sign = 0; char *numstr = NULL, *orgnum = NULL, *p = NULL; errno_t ret = EOK; @@ -7521,8 +7539,11 @@ Datum float4_to_char(PG_FUNCTION_ARGS) if (Num.pre > len) plen = Num.pre - len; else if (len > Num.pre) { - numstr = (char*)palloc(Num.pre + Num.post + 2); - fill_str(numstr, '#', Num.pre + Num.post + 1); + overflow = true; + if (u_sess->attr.attr_sql.sql_compatibility != A_FORMAT) { + numstr = (char*)palloc(Num.pre + Num.post + 2); + fill_str(numstr, '#', Num.pre + Num.post + 1); + } } } @@ -7542,6 +7563,7 @@ Datum float8_to_char(PG_FUNCTION_ARGS) FormatNode* format = NULL; text* result = NULL; bool shouldFree = false; + bool overflow = false; int len = 0, plen = 0, sign = 0; char *numstr = NULL, *orgnum = NULL, *p = NULL; errno_t ret = EOK; @@ -7629,9 +7651,12 @@ Datum float8_to_char(PG_FUNCTION_ARGS) if (Num.pre > len) plen = Num.pre - len; else if (len > Num.pre) { - numstr = (char*)palloc(Num.pre + Num.post + 2); - fill_str(numstr, '#', Num.pre + Num.post + 1); - *(numstr + Num.pre) = '.'; + overflow = true; + if (u_sess->attr.attr_sql.sql_compatibility != A_FORMAT) { + numstr = (char*)palloc(Num.pre + Num.post + 2); + fill_str(numstr, '#', Num.pre + Num.post + 1); + *(numstr + Num.pre) = '.'; + } } } @@ -7644,6 +7669,7 @@ void Init_NUM_cache(void) t_thrd.format_cxt.last_NUM_cache_entry = t_thrd.format_cxt.NUM_cache + 0; } +// to_timestamp(string) Datum to_timestamp_default_format(PG_FUNCTION_ARGS) { text* date_txt = PG_GETARG_TEXT_P(0); diff --git a/contrib/dolphin/plugin_utils/adt/pgstatfuncs.cpp b/contrib/dolphin/plugin_utils/adt/pgstatfuncs.cpp index aa32c1bab..f5fd6e4c6 100644 --- a/contrib/dolphin/plugin_utils/adt/pgstatfuncs.cpp +++ b/contrib/dolphin/plugin_utils/adt/pgstatfuncs.cpp @@ -15306,14 +15306,26 @@ Datum query_node_reform_info(PG_FUNCTION_ARGS) values[4] = BoolGetDatum(reform_info.reform_success); if (reform_info.reform_type == DMS_REFORM_TYPE_FOR_FAILOVER_OPENGAUSS) { - values[5] = TimestampTzGetDatum(reform_info.redo_start_time); - if (reform_info.redo_start_time > reform_info.redo_end_time) { + if (reform_info.redo_start_time == 0) { + nulls[5] = true; + } else { + values[5] = TimestampTzGetDatum(reform_info.redo_start_time); + } + if ((reform_info.redo_start_time > reform_info.redo_end_time) || reform_info.redo_end_time == 0) { nulls[6] = true; } else { values[6] = TimestampTzGetDatum(reform_info.redo_end_time); } - values[7] = UInt64GetDatum(reform_info.redo_total_bytes); - values[8] = TimestampTzGetDatum(reform_info.construct_hashmap); + if (reform_info.redo_total_bytes == 0) { + nulls[7] = true; + } else { + values[7] = UInt64GetDatum(reform_info.redo_total_bytes); + } + if (reform_info.construct_hashmap == 0) { + nulls[8] = true; + } else { + values[8] = TimestampTzGetDatum(reform_info.construct_hashmap); + } } else { values[7] = UInt64GetDatum(-1); nulls[5] = true; diff --git a/contrib/dolphin/plugin_utils/adt/timestamp.cpp b/contrib/dolphin/plugin_utils/adt/timestamp.cpp index 2da46001f..49fb4c27d 100644 --- a/contrib/dolphin/plugin_utils/adt/timestamp.cpp +++ b/contrib/dolphin/plugin_utils/adt/timestamp.cpp @@ -573,12 +573,13 @@ bool TimestampTypeCheck(char* str, bool can_ignore, struct pg_tm* tm, Timestamp int tz; int dtype; int nf; + bool bc; char* field[MAXDATEFIELDS]; int ftype[MAXDATEFIELDS]; char workbuf[MAXDATELEN + MAXDATEFIELDS]; dterr = ParseDateTime(str, workbuf, sizeof(workbuf), field, ftype, MAXDATEFIELDS, &nf); if (dterr == 0) - dterr = DecodeDateTime(field, ftype, nf, &dtype, tm, &fsec, &tz); + dterr = DecodeDateTime(field, ftype, nf, &dtype, tm, &fsec, &tz, &bc); if (dterr != 0) { DateTimeParseError(dterr, str, "timestamp", can_ignore); /* @@ -593,7 +594,7 @@ bool TimestampTypeCheck(char* str, bool can_ignore, struct pg_tm* tm, Timestamp ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), errmsg("timestamp out of range: \"%s\"", str))); - if (tm->tm_year < MIN_VALUE_YEAR || tm->tm_year > MAX_VALUE_YEAR || tm->tm_year == 0) { + if (tm->tm_year < MIN_VALUE_YEAR || tm->tm_year > MAX_VALUE_YEAR || (tm->tm_year == 0 && !bc)) { ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), errmsg("invalid data for \"year = %d\", value must be between -4712 and 9999," \ diff --git a/contrib/dolphin/sql/perf_schema_test.sql b/contrib/dolphin/sql/perf_schema_test.sql deleted file mode 100644 index 64512fa3f..000000000 --- a/contrib/dolphin/sql/perf_schema_test.sql +++ /dev/null @@ -1,60 +0,0 @@ - ---create mysql compatible database -CREATE DATABASE mysqldb01 DBCOMPATIBILITY = 'B'; -CREATE USER monadmin01 monadmin PASSWORD 'Cmcc@123'; -CREATE USER user01 PASSWORD 'Cmcc@123'; - -\c mysqldb01 -SET track_stmt_stat_level = 'L1,L0'; - -SHOW track_stmt_stat_level; -SHOW track_stmt_parameter; -SHOW enable_thread_pool; - -SET SESSION AUTHORIZATION monadmin01 PASSWORD 'Cmcc@123'; - -SELECT COUNT(*) FROM performance_schema.events_statements_current; -SELECT * FROM performance_schema.events_statements_current limit 1; -SELECT COUNT(*) FROM performance_schema.events_statements_history; -SELECT * FROM performance_schema.events_statements_history limit 1; -SELECT COUNT(*) FROM performance_schema.events_statements_summary_by_digest; -SELECT * FROM performance_schema.events_statements_summary_by_digest limit 1; - -SELECT COUNT(*) FROM performance_schema.events_waits_current; -SELECT * FROM performance_schema.events_waits_current limit 1; -SELECT COUNT(*) FROM performance_schema.events_waits_summary_global_by_event_name; -SELECT * FROM performance_schema.events_waits_summary_global_by_event_name limit 1; - -SELECT COUNT(*) FROM performance_schema.events_waits_current; -SELECT * FROM performance_schema.events_waits_current limit 1; -SELECT COUNT(*) FROM performance_schema.events_waits_summary_global_by_event_name; -SELECT * FROM performance_schema.events_waits_summary_global_by_event_name limit 1; - -SELECT count(*) FROM performance_schema.file_summary_by_instance; -SELECT * FROM performance_schema.file_summary_by_instance limit 1; -SELECT count(*) FROM performance_schema.table_io_waits_summary_by_table; -SELECT * FROM performance_schema.table_io_waits_summary_by_table limit 1; -SELECT count(*) FROM performance_schema.table_io_waits_summary_by_index_usage; -SELECT * FROM performance_schema.table_io_waits_summary_by_index_usage limit 1; - -SET SESSION AUTHORIZATION user01 PASSWORD 'Cmcc@123'; - -SELECT COUNT(*) FROM performance_schema.events_statements_current; -SELECT COUNT(*) FROM performance_schema.events_statements_history; -SELECT COUNT(*) FROM performance_schema.events_statements_summary_by_digest; - -SELECT COUNT(*) FROM performance_schema.events_waits_current; -SELECT COUNT(*) FROM performance_schema.events_waits_summary_global_by_event_name; - -SELECT COUNT(*) FROM performance_schema.events_waits_current; -SELECT COUNT(*) FROM performance_schema.events_waits_summary_global_by_event_name; - -SELECT count(*) FROM performance_schema.file_summary_by_instance; -SELECT count(*) FROM performance_schema.table_io_waits_summary_by_table; -SELECT count(*) FROM performance_schema.table_io_waits_summary_by_index_usage; - -\c contrib_regression -DROP user monadmin01 CASCADE; -DROP user user01 CASCADE; -set dolphin.b_compatibility_mode to off; -DROP DATABASE mysqldb01; diff --git a/contrib/dolphin/tablecmds.cpp b/contrib/dolphin/tablecmds.cpp index 2101011b5..b291b371c 100644 --- a/contrib/dolphin/tablecmds.cpp +++ b/contrib/dolphin/tablecmds.cpp @@ -22953,16 +22953,13 @@ static void ATExecIMCSTORED(Relation rel, List* colList) { Oid relOid = RelationGetRelid(rel); int2vector* imcsAtts = NULL; - List* colNames = NIL; int imcsNatts = 0; - int nameLength = 0; CheckForEnableImcs(rel, colList, imcsAtts, &imcsNatts); /* standbynode populate */ if (t_thrd.postmaster_cxt.HaShmData->current_mode == PRIMARY_MODE) { - GetColNamesForStandBy(rel, imcsAtts, imcsNatts, colNames, &nameLength); CreateImcsDescForPrimaryNode(rel, imcsAtts, imcsNatts); - SendImcstoredRequest(relOid, InvalidOid, colNames, nameLength, TYPE_IMCSTORED); + SendImcstoredRequest(relOid, InvalidOid, imcsAtts->values, imcsNatts, TYPE_IMCSTORED); } else { AlterTableEnableImcstore(rel, imcsAtts, imcsNatts); } @@ -22993,9 +22990,7 @@ static void ATExecModifyPartitionIMCSTORED(Relation rel, const char* partName, L Oid partOid = InvalidOid; Oid relOid = RelationGetRelid(rel); int2vector* imcsAtts = NULL; - List* colNames = NIL; int imcsNatts = 0; - int nameLength = 0; partOid = ImcsPartNameGetPartOid(relOid, partName); CheckForEnableImcs(rel, colList, imcsAtts, &imcsNatts, partOid); @@ -23015,9 +23010,8 @@ static void ATExecModifyPartitionIMCSTORED(Relation rel, const char* partName, L { /* populate on standbynode */ if (t_thrd.postmaster_cxt.HaShmData->current_mode == PRIMARY_MODE) { - GetColNamesForStandBy(partRel, imcsAtts, imcsNatts, colNames, &nameLength); CreateImcsDescForPrimaryNode(partRel, imcsAtts, imcsNatts); - SendImcstoredRequest(relOid, partOid, colNames, nameLength, TYPE_PARTITION_IMCSTORED); + SendImcstoredRequest(relOid, partOid, imcsAtts->values, imcsNatts, TYPE_PARTITION_IMCSTORED); } else { /* populate on currrent node */ AlterTableEnableImcstore(partRel, imcsAtts, imcsNatts); -- Gitee