diff options
author | Sergei Petrunia <sergey@mariadb.com> | 2023-04-24 17:57:45 +0300 |
---|---|---|
committer | Sergei Petrunia <sergey@mariadb.com> | 2023-04-25 14:28:14 +0300 |
commit | de61b9fc9b6523af95d20ceefde00328881d10a0 (patch) | |
tree | b775b902c792d873d14e6c188026c14d2676548f | |
parent | 29fb041007285c34d9c22dbc6359a2e9b9ea32f3 (diff) | |
download | mariadb-git-bb-10.4-mdev31121.tar.gz |
MDEV-31121: ANALYZE statement produces 0 for all timings in embedded serverbb-10.4-mdev31121
One must initialize the timer sybsystem with my_timer_init() call.
It was made only in mysqld_main(). Call it also from init_embedded_server().
-rw-r--r-- | libmysqld/lib_sql.cc | 2 | ||||
-rw-r--r-- | mysql-test/main/analyze_format_json_emb.result | 11 | ||||
-rw-r--r-- | mysql-test/main/analyze_format_json_emb.test | 18 |
3 files changed, 31 insertions, 0 deletions
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 5742a8d66ef..565a722e13b 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -565,6 +565,8 @@ int init_embedded_server(int argc, char **argv, char **groups) if (ho_error != 0) return 1; + my_timer_init(&sys_timer_info); + if (init_common_variables()) { mysql_server_end(); diff --git a/mysql-test/main/analyze_format_json_emb.result b/mysql-test/main/analyze_format_json_emb.result new file mode 100644 index 00000000000..d61e205f031 --- /dev/null +++ b/mysql-test/main/analyze_format_json_emb.result @@ -0,0 +1,11 @@ +# +# MDEV-31121: ANALYZE statement produces 0 for all timings in embedded serve +# +create table t1 (a int); +insert into t1 values (0),(0); +set @js='$out'; +set @out=(select json_extract(@js,'$**.query_block.r_total_time_ms')); +select cast(json_extract(@out,'$[0]') as DOUBLE) > 0; +cast(json_extract(@out,'$[0]') as DOUBLE) > 0 +1 +drop table t1; diff --git a/mysql-test/main/analyze_format_json_emb.test b/mysql-test/main/analyze_format_json_emb.test new file mode 100644 index 00000000000..dcf6f24dd8e --- /dev/null +++ b/mysql-test/main/analyze_format_json_emb.test @@ -0,0 +1,18 @@ +--source include/is_embedded.inc +--source include/big_test.inc + +--echo # +--echo # MDEV-31121: ANALYZE statement produces 0 for all timings in embedded serve +--echo # +create table t1 (a int); +insert into t1 values (0),(0); +let $out=` +analyze format=json select sleep(1+a) from t1 +`; + +evalp set @js='$out'; +set @out=(select json_extract(@js,'$**.query_block.r_total_time_ms')); +select cast(json_extract(@out,'$[0]') as DOUBLE) > 0; + +drop table t1; + |