diff options
25 files changed, 254 insertions, 250 deletions
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 4af5cc0d1d5..d506228e8c6 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -4257,19 +4257,6 @@ fail_before_log_copying_thread_start: } debug_sync_point("xtrabackup_suspend_at_start"); - if (xtrabackup_incremental) { - if (!xtrabackup_incremental_force_scan) { - changed_page_bitmap = xb_page_bitmap_init(); - } - if (!changed_page_bitmap) { - msg("mariabackup: using the full scan for incremental " - "backup\n"); - } else if (incremental_lsn != checkpoint_lsn_start) { - /* Do not print that bitmaps are used when dummy bitmap - is build for an empty LSN range. */ - msg("mariabackup: using the changed page bitmap\n"); - } - } ut_a(xtrabackup_parallel > 0); diff --git a/include/json_lib.h b/include/json_lib.h index 567b04dbdc0..e9c10906502 100644 --- a/include/json_lib.h +++ b/include/json_lib.h @@ -319,6 +319,12 @@ int json_skip_to_level(json_engine_t *j, int level); json_skip_to_level((json_engine), (json_engine)->stack_p) +/* + works as json_skip_level() but also counts items on the current + level skipped. +*/ +int json_skip_level_and_count(json_engine_t *j, int *n_items_skipped); + #define json_skip_array_item json_skip_key /* diff --git a/mysql-test/r/func_json.result b/mysql-test/r/func_json.result index e8b2fac4fb8..c828b2676b4 100644 --- a/mysql-test/r/func_json.result +++ b/mysql-test/r/func_json.result @@ -790,3 +790,23 @@ JSON_SET('{}', '$.a', _utf8 0xC3B6, '$.b', _utf8 0xC3B6) SELECT JSON_SET('{}', '$.a', _utf8 X'C3B6', '$.x', 1, '$.b', _utf8 X'C3B6'); JSON_SET('{}', '$.a', _utf8 X'C3B6', '$.x', 1, '$.b', _utf8 X'C3B6') {"a": "", "x": 1, "b": ""} +# +# MDEV-17121 JSON_ARRAY_APPEND +# +select json_array_append('[ ]', '$', 'aue'); +json_array_append('[ ]', '$', 'aue') +["aue"] +# +# MDEV-17018 JSON_SEARCH and User-Defined Variables. +# +SET @`json` := '["A", [{"B": "1"}], {"C": "AB"}, {"D": "BC"}]', @`value` := 'AB'; +SELECT JSON_SEARCH(@`json`, 'one', @`value`); +JSON_SEARCH(@`json`, 'one', @`value`) +"$[2].C" +SET @`json` := NULL, @`value` := NULL; +# +# MDEV-17001 JSON_MERGE returns nullwhen merging empty array. +# +SELECT JSON_MERGE('[1]', '[]'); +JSON_MERGE('[1]', '[]') +[1] diff --git a/mysql-test/suite/galera/r/galera_sst_rsync_data_dir,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_rsync_data_dir,debug.rdiff new file mode 100644 index 00000000000..e307a2ff0f9 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_sst_rsync_data_dir,debug.rdiff @@ -0,0 +1,114 @@ +--- suite/galera/r/galera_sst_rsync_data_dir.result 2018-09-13 14:52:50.848220719 +0200 ++++ suite/galera/r/galera_sst_rsync_data_dir.reject 2018-09-13 15:03:32.339135247 +0200 +@@ -286,3 +286,111 @@ + DROP TABLE t1; + COMMIT; + SET AUTOCOMMIT=ON; ++Performing State Transfer on a server that has been killed and restarted ++while a DDL was in progress on it ++connection node_1; ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++connection node_2; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; ++connection node_1; ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++connection node_2; ++SET wsrep_sync_wait = 0; ++Killing server ... ++connection node_1; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++connection node_2; ++Performing --wsrep-recover ... ++connection node_2; ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++COMMIT; ++connection node_1; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++COMMIT; ++connection node_1a_galera_st_kill_slave_ddl; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++connection node_1; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++SET GLOBAL debug_dbug = $debug_orig; diff --git a/mysql-test/suite/galera/r/galera_sst_rsync_data_dir.result b/mysql-test/suite/galera/r/galera_sst_rsync_data_dir.result index d5c6a11f61f..ff85a7d6c0f 100644 --- a/mysql-test/suite/galera/r/galera_sst_rsync_data_dir.result +++ b/mysql-test/suite/galera/r/galera_sst_rsync_data_dir.result @@ -286,111 +286,3 @@ COUNT(*) = 0 DROP TABLE t1; COMMIT; SET AUTOCOMMIT=ON; -Performing State Transfer on a server that has been killed and restarted -while a DDL was in progress on it -connection node_1; -CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; -SET AUTOCOMMIT=OFF; -START TRANSACTION; -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); -connection node_2; -START TRANSACTION; -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); -COMMIT; -SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; -connection node_1; -ALTER TABLE t1 ADD COLUMN f2 INTEGER; -connection node_2; -SET wsrep_sync_wait = 0; -Killing server ... -connection node_1; -SET AUTOCOMMIT=OFF; -START TRANSACTION; -INSERT INTO t1 (f1) VALUES ('node1_committed_during'); -INSERT INTO t1 (f1) VALUES ('node1_committed_during'); -INSERT INTO t1 (f1) VALUES ('node1_committed_during'); -INSERT INTO t1 (f1) VALUES ('node1_committed_during'); -INSERT INTO t1 (f1) VALUES ('node1_committed_during'); -COMMIT; -START TRANSACTION; -INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1; -SET AUTOCOMMIT=OFF; -START TRANSACTION; -INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -connection node_2; -Performing --wsrep-recover ... -connection node_2; -Starting server ... -Using --wsrep-start-position when starting mysqld ... -SET AUTOCOMMIT=OFF; -START TRANSACTION; -INSERT INTO t1 (f1) VALUES ('node2_committed_after'); -INSERT INTO t1 (f1) VALUES ('node2_committed_after'); -INSERT INTO t1 (f1) VALUES ('node2_committed_after'); -INSERT INTO t1 (f1) VALUES ('node2_committed_after'); -INSERT INTO t1 (f1) VALUES ('node2_committed_after'); -COMMIT; -connection node_1; -INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -COMMIT; -SET AUTOCOMMIT=OFF; -START TRANSACTION; -INSERT INTO t1 (f1) VALUES ('node1_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_committed_after'); -COMMIT; -connection node_1a_galera_st_kill_slave_ddl; -INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -ROLLBACK; -SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; -COUNT(*) = 2 -1 -SELECT COUNT(*) = 35 FROM t1; -COUNT(*) = 35 -1 -SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; -COUNT(*) = 0 -1 -COMMIT; -SET AUTOCOMMIT=ON; -connection node_1; -SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; -COUNT(*) = 2 -1 -SELECT COUNT(*) = 35 FROM t1; -COUNT(*) = 35 -1 -SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; -COUNT(*) = 0 -1 -DROP TABLE t1; -COMMIT; -SET AUTOCOMMIT=ON; -SET GLOBAL debug_dbug = $debug_orig; diff --git a/mysql-test/suite/galera_3nodes/r/galera_certification_double_failure.result b/mysql-test/suite/galera_3nodes/r/galera_certification_double_failure.result index c2fdfc38dd5..e1528c6f74f 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_certification_double_failure.result +++ b/mysql-test/suite/galera_3nodes/r/galera_certification_double_failure.result @@ -11,6 +11,6 @@ connection node_3; INSERT INTO t2 VALUES (1); connection node_1; COMMIT; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ERROR 40001: Deadlock: wsrep aborted transaction DROP TABLE t1; DROP TABLE t2; diff --git a/mysql-test/t/func_json.test b/mysql-test/t/func_json.test index fd5e3d7d7ee..1dc16419cfd 100644 --- a/mysql-test/t/func_json.test +++ b/mysql-test/t/func_json.test @@ -448,3 +448,23 @@ SELECT JSON_SET('{}', '$.a', _utf8 0xC3B6); SELECT JSON_SET('{}', '$.a', _utf8 0xC3B6, '$.b', _utf8 0xC3B6); SELECT JSON_SET('{}', '$.a', _utf8 X'C3B6', '$.x', 1, '$.b', _utf8 X'C3B6'); + +--echo # +--echo # MDEV-17121 JSON_ARRAY_APPEND +--echo # + +select json_array_append('[ ]', '$', 'aue'); + +--echo # +--echo # MDEV-17018 JSON_SEARCH and User-Defined Variables. +--echo # + +SET @`json` := '["A", [{"B": "1"}], {"C": "AB"}, {"D": "BC"}]', @`value` := 'AB'; +SELECT JSON_SEARCH(@`json`, 'one', @`value`); +SET @`json` := NULL, @`value` := NULL; + +--echo # +--echo # MDEV-17001 JSON_MERGE returns nullwhen merging empty array. +--echo # + +SELECT JSON_MERGE('[1]', '[]'); diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc index 4a837646451..60726050aca 100644 --- a/sql/item_jsonfunc.cc +++ b/sql/item_jsonfunc.cc @@ -1621,13 +1621,15 @@ String *Item_func_json_array_append::val_str(String *str) if (je.value_type == JSON_VALUE_ARRAY) { - if (json_skip_level(&je)) + int n_items; + if (json_skip_level_and_count(&je, &n_items)) goto js_error; ar_end= je.s.c_str - je.sav_c_len; str_rest_len= js->length() - (ar_end - (const uchar *) js->ptr()); str->q_append(js->ptr(), ar_end-(const uchar *) js->ptr()); - str->append(", ", 2); + if (n_items) + str->append(", ", 2); if (append_json_value(str, args[n_arg+1], &tmp_val)) goto return_null; /* Out of memory. */ @@ -2018,23 +2020,14 @@ continue_j2: else { const uchar *end1, *beg1, *end2, *beg2; - int empty_array= 0; + int n_items1=1, n_items2= 1; beg1= je1->value_begin; /* Merge as a single array. */ if (je1->value_type == JSON_VALUE_ARRAY) { - int cur_level= je1->stack_p; - empty_array= 1; - while (json_scan_next(je1) == 0) - { - if (je1->stack_p < cur_level) - break; - empty_array= 0; - } - - if (je1->s.error) + if (json_skip_level_and_count(je1, &n_items1)) return 1; end1= je1->s.c_str - je1->sav_c_len; @@ -2053,8 +2046,7 @@ continue_j2: end1= je1->value_end; } - if (str->append((const char*) beg1, end1 - beg1) || - (!empty_array && str->append(", ", 2))) + if (str->append((const char*) beg1, end1 - beg1)) return 3; if (json_value_scalar(je2)) @@ -2065,15 +2057,22 @@ continue_j2: else { if (je2->value_type == JSON_VALUE_OBJECT) + { beg2= je2->value_begin; + if (json_skip_level(je2)) + return 2; + } else + { beg2= je2->s.c_str; - if (json_skip_level(je2)) - return 2; + if (json_skip_level_and_count(je2, &n_items2)) + return 2; + } end2= je2->s.c_str; } - if (str->append((const char*) beg2, end2 - beg2)) + if ((n_items1 && n_items2 && str->append(", ", 2)) || + str->append((const char*) beg2, end2 - beg2)) return 3; if (je2->value_type != JSON_VALUE_ARRAY && @@ -3054,7 +3053,7 @@ static int append_json_path(String *str, const json_path_t *p) String *Item_func_json_search::val_str(String *str) { String *js= args[0]->val_json(&tmp_js); - String *s_str= args[2]->val_str(&tmp_js); + String *s_str= args[2]->val_str(&tmp_path); json_engine_t je; json_path_t p, sav_path; uint n_arg; diff --git a/sql/item_jsonfunc.h b/sql/item_jsonfunc.h index f331ee3b582..f2358168080 100644 --- a/sql/item_jsonfunc.h +++ b/sql/item_jsonfunc.h @@ -400,7 +400,7 @@ public: class Item_func_json_search: public Item_json_str_multipath { protected: - String tmp_js, esc_value; + String tmp_js, tmp_path, esc_value; bool mode_one; bool ooa_constant, ooa_parsed; int escape; diff --git a/storage/connect/javaconn.cpp b/storage/connect/javaconn.cpp index 37a96351a3b..f05db1892d9 100644 --- a/storage/connect/javaconn.cpp +++ b/storage/connect/javaconn.cpp @@ -82,29 +82,6 @@ GETDEF JAVAConn::GetDefaultJavaVMInitArgs = NULL; #endif // !_DEBUG /***********************************************************************/ -/* Allocate the structure used to refer to the result set. */ -/***********************************************************************/ -static JCATPARM *AllocCatInfo(PGLOBAL g, JCATINFO fid, PCSZ db, - PCSZ tab, PQRYRES qrp) -{ - JCATPARM *cap; - -#if defined(_DEBUG) - assert(qrp); -#endif - - if ((cap = (JCATPARM *)PlgDBSubAlloc(g, NULL, sizeof(JCATPARM)))) { - memset(cap, 0, sizeof(JCATPARM)); - cap->Id = fid; - cap->Qrp = qrp; - cap->DB = db; - cap->Tab = tab; - } // endif cap - - return cap; -} // end of AllocCatInfo - -/***********************************************************************/ /* JAVAConn construction/destruction. */ /***********************************************************************/ JAVAConn::JAVAConn(PGLOBAL g, PCSZ wrapper) diff --git a/storage/connect/jdbconn.cpp b/storage/connect/jdbconn.cpp index 24da65cf6a8..e0aca3333e6 100644 --- a/storage/connect/jdbconn.cpp +++ b/storage/connect/jdbconn.cpp @@ -322,10 +322,6 @@ static JCATPARM *AllocCatInfo(PGLOBAL g, JCATINFO fid, PCSZ db, { JCATPARM *cap; -#if defined(_DEBUG) - assert(qrp); -#endif - if ((cap = (JCATPARM *)PlgDBSubAlloc(g, NULL, sizeof(JCATPARM)))) { memset(cap, 0, sizeof(JCATPARM)); cap->Id = fid; diff --git a/storage/connect/mysql-test/connect/r/jdbc.result b/storage/connect/mysql-test/connect/r/jdbc.result index a16f2791e8f..12c8779f96d 100644 --- a/storage/connect/mysql-test/connect/r/jdbc.result +++ b/storage/connect/mysql-test/connect/r/jdbc.result @@ -236,7 +236,6 @@ WHEELFOR SALESMAN 10030.00 MARTIN ENGINEER 10000.00 DROP TABLE t1, connect.emp; CREATE TABLE t2 (command varchar(128) not null,number int(5) not null flag=1,message varchar(255) flag=2) ENGINE=CONNECT TABLE_TYPE=JDBC CONNECTION='jdbc:mariadb://localhost:PORT/connect' OPTION_LIST='User=root,Execsrc=1'; -SELECT * FROM t2 WHERE command='drop table tx1'; command number message drop table tx1 0 Execute: java.sql.SQLSyntaxErrorException: (conn:24) Unknown table 'connect.tx1' SELECT * FROM t2 WHERE command = 'create table tx1 (a int not null, b char(32), c double(8,2))'; diff --git a/storage/connect/mysql-test/connect/r/json_java_2.result b/storage/connect/mysql-test/connect/r/json_java_2.result index 6c578b35d6f..4bbac236200 100644 --- a/storage/connect/mysql-test/connect/r/json_java_2.result +++ b/storage/connect/mysql-test/connect/r/json_java_2.result @@ -1,4 +1,3 @@ -SET GLOBAL connect_class_path='C:/MariaDB-10.2/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo2.jar'; set connect_enable_mongo=1; # # Test the MONGO table type diff --git a/storage/connect/mysql-test/connect/r/json_java_3.result b/storage/connect/mysql-test/connect/r/json_java_3.result index 4c5fc94fca6..eb8bfc022d6 100644 --- a/storage/connect/mysql-test/connect/r/json_java_3.result +++ b/storage/connect/mysql-test/connect/r/json_java_3.result @@ -1,4 +1,3 @@ -SET GLOBAL connect_class_path='C:/MariaDB-10.2/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo3.jar'; set connect_enable_mongo=1; # # Test the MONGO table type diff --git a/storage/connect/mysql-test/connect/r/mongo_java_2.result b/storage/connect/mysql-test/connect/r/mongo_java_2.result index 67c67653e88..bc186d7137e 100644 --- a/storage/connect/mysql-test/connect/r/mongo_java_2.result +++ b/storage/connect/mysql-test/connect/r/mongo_java_2.result @@ -1,4 +1,3 @@ -SET GLOBAL connect_class_path='C:/MariaDB-10.2/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo2.jar'; set connect_enable_mongo=1; # # Test the MONGO table type diff --git a/storage/connect/mysql-test/connect/r/mongo_java_3.result b/storage/connect/mysql-test/connect/r/mongo_java_3.result index 665178bd3ea..30c696fc9eb 100644 --- a/storage/connect/mysql-test/connect/r/mongo_java_3.result +++ b/storage/connect/mysql-test/connect/r/mongo_java_3.result @@ -1,4 +1,3 @@ -SET GLOBAL connect_class_path='C:/MariaDB-10.2/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo3.jar'; set connect_enable_mongo=1; # # Test the MONGO table type diff --git a/storage/connect/mysql-test/connect/r/xml2.result b/storage/connect/mysql-test/connect/r/xml2.result index eea53bf55c7..b8075fa1928 100644 --- a/storage/connect/mysql-test/connect/r/xml2.result +++ b/storage/connect/mysql-test/connect/r/xml2.result @@ -333,37 +333,6 @@ DROP TABLE t1; # # Testing Cyrillic # -CREATE TABLE t1 -( -c CHAR(16) CHARACTER SET utf8 -) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='cp1251.xml' - OPTION_LIST='xmlsup=libxml2,rownode=b'; -SELECT * FROM t1; -c БВГДЕЖЗ -INSERT INTO t1 VALUES ('ИКЛМН'); -SELECT c, HEX(c) FROM t1; -c БВГДЕЖЗ -HEX(c) D091D092D093D094D095D096D097 -c ИКЛМН -HEX(c) D098D09AD09BD09CD09D -DROP TABLE t1; -CREATE TABLE t1 -( -c CHAR(16) CHARACTER SET cp1251 -) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='cp1251.xml' - OPTION_LIST='xmlsup=libxml2,rownode=b'; -SELECT * FROM t1; -c БВГДЕЖЗ -c ИКЛМН -INSERT INTO t1 VALUES ('ОПРСТ'); -SELECT c, HEX(c) FROM t1; -c БВГДЕЖЗ -HEX(c) C1C2C3C4C5C6C7 -c ИКЛМН -HEX(c) C8CACBCCCD -c ОПРСТ -HEX(c) CECFD0D1D2 -DROP TABLE t1; # # Testing that the underlying file is created with a proper Encoding # diff --git a/storage/connect/mysql-test/connect/t/json_java_2.test b/storage/connect/mysql-test/connect/t/json_java_2.test index bb32eff4e94..2f64d8e2eed 100644 --- a/storage/connect/mysql-test/connect/t/json_java_2.test +++ b/storage/connect/mysql-test/connect/t/json_java_2.test @@ -1,7 +1,9 @@ -- source jdbconn.inc -- source mongo.inc +--disable_query_log eval SET GLOBAL connect_class_path='$MTR_SUITE_DIR/std_data/Mongo2.jar'; +--enable_query_log let $DRV= Java; let $VERS= 2; let $TYPE= JSON; diff --git a/storage/connect/mysql-test/connect/t/json_java_3.test b/storage/connect/mysql-test/connect/t/json_java_3.test index 29e66cd5a1c..cee8343772a 100644 --- a/storage/connect/mysql-test/connect/t/json_java_3.test +++ b/storage/connect/mysql-test/connect/t/json_java_3.test @@ -1,7 +1,9 @@ -- source jdbconn.inc -- source mongo.inc +--disable_query_log eval SET GLOBAL connect_class_path='$MTR_SUITE_DIR/std_data/Mongo3.jar'; +--enable_query_log let $DRV= Java; let $VERS= 3; let $TYPE= JSON; diff --git a/storage/connect/mysql-test/connect/t/mongo_java_2.test b/storage/connect/mysql-test/connect/t/mongo_java_2.test index 21da5dce68f..7dcd028185e 100644 --- a/storage/connect/mysql-test/connect/t/mongo_java_2.test +++ b/storage/connect/mysql-test/connect/t/mongo_java_2.test @@ -1,7 +1,9 @@ -- source jdbconn.inc -- source mongo.inc +--disable_query_log eval SET GLOBAL connect_class_path='$MTR_SUITE_DIR/std_data/Mongo2.jar'; +--enable_query_log let $DRV= Java; let $VERS= 2; let $TYPE= MONGO; diff --git a/storage/connect/mysql-test/connect/t/mongo_java_3.test b/storage/connect/mysql-test/connect/t/mongo_java_3.test index b7584adcc7e..aab16d5e003 100644 --- a/storage/connect/mysql-test/connect/t/mongo_java_3.test +++ b/storage/connect/mysql-test/connect/t/mongo_java_3.test @@ -1,7 +1,9 @@ -- source jdbconn.inc -- source mongo.inc +--disable_query_log eval SET GLOBAL connect_class_path='$MTR_SUITE_DIR/std_data/Mongo3.jar'; +--enable_query_log let $DRV= Java; let $VERS= 3; let $TYPE= MONGO; diff --git a/storage/connect/mysql-test/connect/t/xml2.test b/storage/connect/mysql-test/connect/t/xml2.test index 0f26b8ab5c0..7bbc3dbd87c 100644 --- a/storage/connect/mysql-test/connect/t/xml2.test +++ b/storage/connect/mysql-test/connect/t/xml2.test @@ -240,24 +240,24 @@ DROP TABLE t1; --echo # --echo # Testing Cyrillic --echo # -CREATE TABLE t1 -( - c CHAR(16) CHARACTER SET utf8 -) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='cp1251.xml' - OPTION_LIST='xmlsup=libxml2,rownode=b'; -SELECT * FROM t1; -INSERT INTO t1 VALUES ('ИКЛМН'); -SELECT c, HEX(c) FROM t1; -DROP TABLE t1; -CREATE TABLE t1 -( - c CHAR(16) CHARACTER SET cp1251 -) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='cp1251.xml' - OPTION_LIST='xmlsup=libxml2,rownode=b'; -SELECT * FROM t1; -INSERT INTO t1 VALUES ('ОПРСТ'); -SELECT c, HEX(c) FROM t1; -DROP TABLE t1; +#CREATE TABLE t1 +#( +# c CHAR(16) CHARACTER SET utf8 +#) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='cp1251.xml' +# OPTION_LIST='xmlsup=libxml2,rownode=b'; +#SELECT * FROM t1; +#INSERT INTO t1 VALUES ('ИКЛМН'); +#SELECT c, HEX(c) FROM t1; +#DROP TABLE t1; +#CREATE TABLE t1 +#( +# c CHAR(16) CHARACTER SET cp1251 +#) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='cp1251.xml' +# OPTION_LIST='xmlsup=libxml2,rownode=b'; +#SELECT * FROM t1; +#INSERT INTO t1 VALUES ('ОПРСТ'); +#SELECT c, HEX(c) FROM t1; +#DROP TABLE t1; --echo # diff --git a/storage/rocksdb/mysql-test/rocksdb/r/2pc_group_commit.result b/storage/rocksdb/mysql-test/rocksdb/r/2pc_group_commit.result index a9e80f1562e..722edadb4da 100644 --- a/storage/rocksdb/mysql-test/rocksdb/r/2pc_group_commit.result +++ b/storage/rocksdb/mysql-test/rocksdb/r/2pc_group_commit.result @@ -14,16 +14,16 @@ SET GLOBAL rocksdb_flush_log_at_trx_commit=1; select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits'; select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced'; -select IF(variable_value - @b1 = 1000, 'OK', 'FAIL') as Binlog_commits +select IF(variable_value - @b1 = 1000, 'OK', variable_value - @b1) as Binlog_commits from information_schema.global_status where variable_name='Binlog_commits'; Binlog_commits OK -select IF(variable_value - @b2 = 1000, 'OK', 'FAIL') as Binlog_group_commits +select IF(variable_value - @b2 = 1000, 'OK', variable_value - @b2) as Binlog_group_commits from information_schema.global_status where variable_name='Binlog_group_commits'; Binlog_group_commits OK # Prepare operations sync, commits don't. We expect slightly more than 1K syncs: -select IF(variable_value - @b3 between 1000 and 1500, 'OK', 'FAIL') as Rocksdb_wal_synced +select IF(variable_value - @b3 between 1000 and 1500, 'OK', variable_value - @b3) as Rocksdb_wal_synced from information_schema.global_status where variable_name='Rocksdb_wal_synced'; Rocksdb_wal_synced OK @@ -33,17 +33,17 @@ OK select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits'; select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced'; -select IF(variable_value - @b1 = 10000, 'OK', 'FAIL') as Binlog_commits +select IF(variable_value - @b1 = 10000, 'OK', variable_value - @b1) as Binlog_commits from information_schema.global_status where variable_name='Binlog_commits'; Binlog_commits OK -select IF(variable_value - @b2 between 100 and 5000, 'OK', 'FAIL') as Binlog_group_commits +select IF(variable_value - @b2 between 100 and 5000, 'OK', variable_value - @b2) as Binlog_group_commits from information_schema.global_status where variable_name='Binlog_group_commits'; Binlog_group_commits OK -select IF(variable_value - @b3 between 1 and 9000, 'OK', 'FAIL') +select IF(variable_value - @b3 between 1 and 9000, 'OK', variable_value - @b3) from information_schema.global_status where variable_name='Rocksdb_wal_synced'; -IF(variable_value - @b3 between 1 and 9000, 'OK', 'FAIL') +IF(variable_value - @b3 between 1 and 9000, 'OK', variable_value - @b3) OK ## # 2PC enabled, MyRocks durability disabled, single thread @@ -53,17 +53,17 @@ SET GLOBAL rocksdb_flush_log_at_trx_commit=0; select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits'; select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced'; -select IF(variable_value - @b1 = 1000, 'OK', 'FAIL') as Binlog_commits +select IF(variable_value - @b1 = 1000, 'OK', variable_value - @b1) as Binlog_commits from information_schema.global_status where variable_name='Binlog_commits'; Binlog_commits OK -select IF(variable_value - @b2 = 1000, 'OK', 'FAIL') as Binlog_group_commits +select IF(variable_value - @b2 = 1000, 'OK', variable_value - @b2) as Binlog_group_commits from information_schema.global_status where variable_name='Binlog_group_commits'; Binlog_group_commits OK -select IF(variable_value - @b3 < 10, 'OK', 'FAIL') +select IF(variable_value - @b3 < 10, 'OK', variable_value - @b3) from information_schema.global_status where variable_name='Rocksdb_wal_synced'; -IF(variable_value - @b3 < 10, 'OK', 'FAIL') +IF(variable_value - @b3 < 10, 'OK', variable_value - @b3) OK ## # 2PC enabled, MyRocks durability disabled, concurrent workload @@ -71,17 +71,17 @@ OK select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits'; select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced'; -select IF(variable_value - @b1 = 10000, 'OK', 'FAIL') as Binlog_commits +select IF(variable_value - @b1 = 10000, 'OK', variable_value - @b1) as Binlog_commits from information_schema.global_status where variable_name='Binlog_commits'; Binlog_commits OK -select IF(variable_value - @b2 < 8000, 'OK', 'FAIL') as Binlog_group_commits +select IF(variable_value - @b2 < 8000, 'OK', variable_value - @b2) as Binlog_group_commits from information_schema.global_status where variable_name='Binlog_group_commits'; Binlog_group_commits OK -select IF(variable_value - @b3 < 10, 'OK', 'FAIL') +select IF(variable_value - @b3 < 10, 'OK', variable_value - @b3) from information_schema.global_status where variable_name='Rocksdb_wal_synced'; -IF(variable_value - @b3 < 10, 'OK', 'FAIL') +IF(variable_value - @b3 < 10, 'OK', variable_value - @b3) OK SET GLOBAL rocksdb_enable_2pc= @save_rocksdb_enable_2pc; SET GLOBAL rocksdb_flush_log_at_trx_commit= @save_rocksdb_flush_log_at_trx_commit; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test b/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test index 1a77424de39..af9d2667e82 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test @@ -31,12 +31,12 @@ select variable_value into @b1 from information_schema.global_status where varia select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced'; --exec $MYSQL_SLAP --silent --concurrency=1 --number-of-queries=1000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)" -select IF(variable_value - @b1 = 1000, 'OK', 'FAIL') as Binlog_commits +select IF(variable_value - @b1 = 1000, 'OK', variable_value - @b1) as Binlog_commits from information_schema.global_status where variable_name='Binlog_commits'; -select IF(variable_value - @b2 = 1000, 'OK', 'FAIL') as Binlog_group_commits +select IF(variable_value - @b2 = 1000, 'OK', variable_value - @b2) as Binlog_group_commits from information_schema.global_status where variable_name='Binlog_group_commits'; --echo # Prepare operations sync, commits don't. We expect slightly more than 1K syncs: -select IF(variable_value - @b3 between 1000 and 1500, 'OK', 'FAIL') as Rocksdb_wal_synced +select IF(variable_value - @b3 between 1000 and 1500, 'OK', variable_value - @b3) as Rocksdb_wal_synced from information_schema.global_status where variable_name='Rocksdb_wal_synced'; --echo ## @@ -48,11 +48,11 @@ select variable_value into @b3 from information_schema.global_status where varia --exec $MYSQL_SLAP --silent --concurrency=50 --number-of-queries=10000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)" -select IF(variable_value - @b1 = 10000, 'OK', 'FAIL') as Binlog_commits +select IF(variable_value - @b1 = 10000, 'OK', variable_value - @b1) as Binlog_commits from information_schema.global_status where variable_name='Binlog_commits'; -select IF(variable_value - @b2 between 100 and 5000, 'OK', 'FAIL') as Binlog_group_commits +select IF(variable_value - @b2 between 100 and 5000, 'OK', variable_value - @b2) as Binlog_group_commits from information_schema.global_status where variable_name='Binlog_group_commits'; -select IF(variable_value - @b3 between 1 and 9000, 'OK', 'FAIL') +select IF(variable_value - @b3 between 1 and 9000, 'OK', variable_value - @b3) from information_schema.global_status where variable_name='Rocksdb_wal_synced'; --echo ## @@ -66,11 +66,11 @@ select variable_value into @b2 from information_schema.global_status where varia select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced'; --exec $MYSQL_SLAP --silent --concurrency=1 --number-of-queries=1000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)" -select IF(variable_value - @b1 = 1000, 'OK', 'FAIL') as Binlog_commits +select IF(variable_value - @b1 = 1000, 'OK', variable_value - @b1) as Binlog_commits from information_schema.global_status where variable_name='Binlog_commits'; -select IF(variable_value - @b2 = 1000, 'OK', 'FAIL') as Binlog_group_commits +select IF(variable_value - @b2 = 1000, 'OK', variable_value - @b2) as Binlog_group_commits from information_schema.global_status where variable_name='Binlog_group_commits'; -select IF(variable_value - @b3 < 10, 'OK', 'FAIL') +select IF(variable_value - @b3 < 10, 'OK', variable_value - @b3) from information_schema.global_status where variable_name='Rocksdb_wal_synced'; --echo ## @@ -83,11 +83,11 @@ select variable_value into @b3 from information_schema.global_status where varia --exec $MYSQL_SLAP --silent --concurrency=50 --number-of-queries=10000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)" -select IF(variable_value - @b1 = 10000, 'OK', 'FAIL') as Binlog_commits +select IF(variable_value - @b1 = 10000, 'OK', variable_value - @b1) as Binlog_commits from information_schema.global_status where variable_name='Binlog_commits'; -select IF(variable_value - @b2 < 8000, 'OK', 'FAIL') as Binlog_group_commits +select IF(variable_value - @b2 < 8000, 'OK', variable_value - @b2) as Binlog_group_commits from information_schema.global_status where variable_name='Binlog_group_commits'; -select IF(variable_value - @b3 < 10, 'OK', 'FAIL') +select IF(variable_value - @b3 < 10, 'OK', variable_value - @b3) from information_schema.global_status where variable_name='Rocksdb_wal_synced'; ## diff --git a/strings/json_lib.c b/strings/json_lib.c index f6b4f15732d..4f12cbb82b5 100644 --- a/strings/json_lib.c +++ b/strings/json_lib.c @@ -1197,6 +1197,27 @@ int json_skip_to_level(json_engine_t *j, int level) } +/* + works as json_skip_level() but also counts items on the current + level skipped. +*/ +int json_skip_level_and_count(json_engine_t *j, int *n_items_skipped) +{ + int level= j->stack_p; + + *n_items_skipped= 0; + while (json_scan_next(j) == 0) + { + if (j->stack_p < level) + return 0; + if (j->stack_p == level && j->state == JST_VALUE) + (*n_items_skipped)++; + } + + return 1; +} + + int json_skip_key(json_engine_t *j) { if (json_read_value(j)) |