Commit 600751e7 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.7 into 10.8

parents 0e0a3580 712b443a
......@@ -10,7 +10,6 @@
#
##############################################################################
GCF-1081 : MDEV-18283 Galera test failure on galera.GCF-1081
GCF-939 : MDEV-21520 galera.GCF-939
MW-329 : MDEV-19962 Galera test failure on MW-329
galera_as_slave_ctas : MDEV-28378 timeout
......@@ -20,10 +19,7 @@ galera_bf_kill_debug : MDEV-24485 wsrep::client_state::do_acquire_ownership(): A
galera_bf_lock_wait : MDEV-21597 wsrep::transaction::start_transaction(): Assertion `active() == false' failed
galera_encrypt_tmp_files : Get error failed to enable encryption of temporary files
galera_gcache_recover_manytrx : MDEV-18834 Galera test failure
galera_kill_largechanges : MDEV-18179 Galera test failure on galera.galera_kill_largechanges
galera_mdl_race : MDEV-21524 galera.galera_mdl_race
galera_parallel_simple : MDEV-20318 galera.galera_parallel_simple fails
galera_pc_ignore_sb : MDEV-20888 galera.galera_pc_ignore_sb
galera_pc_recovery : MDEV-25199 cluster fails to start up
galera_shutdown_nonprim : MDEV-21493 galera.galera_shutdown_nonprim
galera_sst_mysqldump : MDEV-26501 : galera.galera_sst_mysqldump MTR failed: galera SST with mysqldump failed
......
connection node_2;
connection node_1;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, 0), (3, 0);
CREATE PROCEDURE proc_update ()
BEGIN
UPDATE t1 SET f2 = 1 where f1 > 0;
END|
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
connection node_1;
CALL proc_update ();;
connection node_1a;
SET SESSION wsrep_sync_wait = 0;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
connection node_1a;
SET GLOBAL DEBUG = 'd,sync.wsrep_before_BF_victim_unlock';
Warnings:
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
connection node_2;
INSERT INTO t1 VALUES (2, 2);;
connection node_1a;
SET SESSION DEBUG_SYNC = 'now WAIT_FOR sync.wsrep_before_BF_victim_unlock_reached';
SET GLOBAL DEBUG = '';
Warnings:
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
connection node_1a;
SET GLOBAL wsrep_provider_options = 'dbug=';
SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
connection node_2;
SELECT * FROM t1;
f1 f2
1 1
2 2
3 1
connection node_1;
SELECT * FROM t1;
f1 f2
1 1
2 2
3 1
wsrep_local_replays
1
DROP PROCEDURE proc_update;
DROP TABLE t1;
connection node_2;
connection node_1;
connection node_1;
connection node_2;
connection node_1;
SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10),(11);
CREATE TABLE t1 (f1 VARCHAR(128)) ENGINE=InnoDB;
connection node_2;
Killing server ...
connection node_1;
INSERT INTO t1 SELECT REPEAT('a', 128) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6;
connection node_2;
connection node_2a;
SELECT COUNT(*) FROM t1;
COUNT(*)
1771561
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE
2
connection node_1;
DROP TABLE t1;
DROP TABLE ten;
......@@ -12,9 +12,9 @@ connection node_2;
TRUNCATE TABLE t1;
connection node_1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
SELECT COUNT(*) FROM t1;
COUNT(*)
0
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1;
connection node_1;
......@@ -27,9 +27,9 @@ SET DEBUG_SYNC = 'now WAIT_FOR before_cert';
connection node_2;
TRUNCATE TABLE t1;
connection node_1;
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
1
SELECT COUNT(*) FROM t1;
COUNT(*)
0
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1;
connection node_1;
......@@ -44,18 +44,17 @@ connection node_2;
TRUNCATE TABLE t1;
connection node_1a;
SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached';
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
SELECT COUNT(*) FROM t1;
COUNT(*)
0
SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue WAIT_FOR before_cert';
connection node_2;
TRUNCATE TABLE t1;
connection node_1a;
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
SELECT COUNT(*) FROM t1;
COUNT(*)
0
connection node_1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
SET DEBUG_SYNC = 'RESET';
SET GLOBAL debug_dbug = NULL;
DROP TABLE t1;
......@@ -66,8 +65,8 @@ SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit';
SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue EXECUTE 64';
INSERT INTO t1 VALUES (5);
connection node_1;
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
SELECT COUNT(*) FROM t1;
COUNT(*)
1
SET DEBUG_SYNC = 'RESET';
SET GLOBAL debug_dbug = NULL;
......
#
# GCF-1081 - Assertion `!thd->sp_runtime_ctx`
#
# Test replaying of stored procedures
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/have_debug_sync.inc
--source include/galera_have_debug_sync.inc
--connection node_1
--let $wsrep_local_replays_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, 0), (3, 0);
DELIMITER |;
CREATE PROCEDURE proc_update ()
BEGIN
UPDATE t1 SET f2 = 1 where f1 > 0;
END|
DELIMITER ;|
# Block the SP
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
--let $galera_sync_point = commit_monitor_master_enter_sync
--source include/galera_set_sync_point.inc
--connection node_1
--send CALL proc_update ();
# Wait until SP is blocked
--connection node_1a
SET SESSION wsrep_sync_wait = 0;
--source include/galera_wait_sync_point.inc
# Issue a conflicting insert on node #2
--connection node_1a
SET GLOBAL debug_dbug = 'd,sync.wsrep_before_BF_victim_unlock';
--connection node_2
--send INSERT INTO t1 VALUES (2, 2);
# Wait until it BF aborts the SP
--connection node_1a
SET SESSION DEBUG_SYNC = 'now WAIT_FOR sync.wsrep_before_BF_victim_unlock_reached';
SET GLOBAL debug_dbug = '';
# Unblock the SP
--connection node_1a
--source include/galera_clear_sync_point.inc
--source include/galera_signal_sync_point.inc
--connection node_2
--reap
SELECT * FROM t1;
# SP succeeds
--connection node_1
--reap
SELECT * FROM t1;
# wsrep_local_replays has increased by 1
--let $wsrep_local_replays_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
--disable_query_log
--eval SELECT $wsrep_local_replays_new - $wsrep_local_replays_old AS wsrep_local_replays;
--enable_query_log
DROP PROCEDURE proc_update;
DROP TABLE t1;
#
# This test kill -9-s a slave while a large update has been performed on the master. SST is performed.
#
--source include/big_test.inc
--source include/galera_cluster.inc
# Save original auto_increment_offset values.
--let $node_1=node_1
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
--connection node_1
# Enable the master to continue running during the split-brain situation that
# occurs when the slave is killed
--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options`
SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10),(11);
CREATE TABLE t1 (f1 VARCHAR(128)) ENGINE=InnoDB;
--connection node_2
--source include/kill_galera.inc
--connection node_1
# We create a 128Mb (or so) transaction that is larger than gcache. The size of the gcache is not adjustable dynamically
INSERT INTO t1 SELECT REPEAT('a', 128) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6;
--connection node_2
--source include/start_mysqld.inc
--let $galera_connection_name = node_2a
--let $galera_server_number = 2
--source include/galera_connect.inc
--connection node_2a
SELECT COUNT(*) FROM t1;
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--connection node_1
--disable_query_log
--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig';
--enable_query_log
--let $node_2=node_2a
--source include/auto_increment_offset_restore.inc
DROP TABLE t1;
DROP TABLE ten;
!include ../galera_2nodes.cnf
[mysqld]
wsrep_debug=1
[mysqld.1]
wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true'
[mysqld.2]
wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true'
......@@ -30,7 +30,7 @@ TRUNCATE TABLE t1;
--connection node_1
--error ER_LOCK_DEADLOCK
--reap
SELECT COUNT(*) = 0 FROM t1;
SELECT COUNT(*) FROM t1;
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1;
......@@ -54,8 +54,9 @@ SET DEBUG_SYNC = 'now WAIT_FOR before_cert';
TRUNCATE TABLE t1;
--connection node_1
--error 0,ER_LOCK_DEADLOCK
--reap
SELECT COUNT(*) = 1 FROM t1;
SELECT COUNT(*) FROM t1;
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1;
......@@ -82,17 +83,17 @@ TRUNCATE TABLE t1;
--connection node_1a
SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached';
SELECT COUNT(*) = 0 FROM t1;
SELECT COUNT(*) FROM t1;
SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue WAIT_FOR before_cert';
--connection node_2
TRUNCATE TABLE t1;
--connection node_1a
SELECT COUNT(*) = 0 FROM t1;
SELECT COUNT(*) FROM t1;
--connection node_1
--error ER_LOCK_DEADLOCK
--error 0,ER_LOCK_DEADLOCK
--reap
SET DEBUG_SYNC = 'RESET';
......@@ -126,7 +127,7 @@ while ($count)
--connection node_1a
SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached';
SELECT COUNT(*) = 1 FROM t1;
SELECT COUNT(*) FROM t1;
SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue';
--dec $count
......@@ -135,8 +136,9 @@ while ($count)
--enable_query_log
--connection node_1
--error 0,ER_LOCK_DEADLOCK
--reap
SELECT COUNT(*) = 1 FROM t1;
SELECT COUNT(*) FROM t1;
SET DEBUG_SYNC = 'RESET';
SET GLOBAL debug_dbug = NULL;
......
......@@ -10,8 +10,5 @@
#
##############################################################################
GCF-1018B : MDEV-18534 wsrep::transaction::adopt(): Assertion `transaction.is_streaming()' failed
GCF-1060 : MDEV-20848 galera_sr.GCF_1060
GCF-585 : MDEV-24698 galera_sr.GCF-585 MTR failed with SIGABRT: no such a transition REPLICATING -> APPLYING
GCF-1060 : MDEV-26528 wrong usage of mutex LOCK_thd_kill and LOCK_thd_kill
galera_sr_shutdown_master : MDEV-23612: galera_sr.galera_sr_shutdown_master MTR failed: WSREP_SST: [ERROR] Possible timeout in receving first data from donor in gtid stage
......@@ -57,14 +57,14 @@ Jeans {"color": "blue", "price": 50} blue
select * from t1 right join json_table(t1.item_props,'$' columns( color varchar(100) path '$.color')) as T on 1;
ERROR 42S22: Unknown column 't1.item_props' in 'JSON_TABLE argument'
DROP TABLE t1;
select * from JSON_TABLE( '[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default '101' on empty, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt;
select * from JSON_TABLE( '[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default 101 on empty, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt;
a b
101 11
101 111
2 22
2 222
3 NULL
select * from JSON_TABLE( '[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default '202' on error, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt;
select * from JSON_TABLE( '[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default 202 on error, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt;
a b
NULL 11
NULL 111
......@@ -957,6 +957,20 @@ converted original
Warnings:
Warning 1264 Out of range value for column 'converted' at row 2
Warning 1366 Incorrect integer value: 'foo' for column ``.`(temporary)`.`converted` at row 3
select * from
json_table('[{"color": "blue", "price": { "high": 10, "low": 5}},
{"color": "white", "price": "pretty low"},
{"color": "yellow", "price": 256.20},
{"color": "red", "price": { "high": 20, "low": 8}}]',
'$[*]' columns(color varchar(100) path '$.color',
price json path '$.price'
)
) as T;
color price
blue { "high": 10, "low": 5}
white "pretty low"
yellow 256.20
red { "high": 20, "low": 8}
#
# MDEV-27696 Json table columns accept redundant COLLATE syntax
#
......
......@@ -40,7 +40,7 @@ id jpath jsn_path jexst
2 2 2 0
3 33 {"x":33} 1
4 0 0 0
5 66 NULL 0
5 66 [1,2] 0
select * from
json_table(
'[{"a":"3"},{"a":2},{"b":1},{"a":0.33},{"a":"asd"}]',
......@@ -55,11 +55,11 @@ jsn_path json path '$.a' default '{"x":33}' on empty,
jexst int exists path '$.b')
) as tt;
id jpath_i jpath_r jsn_path jexst
1 3 3 3 0
1 3 3 "3" 0
2 2 2 2 0
3 33 33.3 {"x":33} 1
4 0 0.33 0.33 0
5 0 0 asd 0
5 0 0 "asd" 0
Warnings:
Warning 1366 Incorrect integer value: 'asd' for column ``.`(temporary)`.`jpath_i` at row 5
Warning 1366 Incorrect double value: 'asd' for column ``.`(temporary)`.`jpath_r` at row 5
......@@ -78,7 +78,7 @@ id jpath jsn_path jexst
2 2 2 0
3 33 {"x":33} 1
4 0 0 0
5 66 NULL 0
5 66 [1,2] 0
select * from
json_table(
'[{"a":"3"},{"a":2},{"b":1},{"a":0}]',
......@@ -88,7 +88,7 @@ json_path json path '$.a',
jexst int exists path '$.b')
) as tt;
id jpath json_path jexst
1 3 3 0
1 3 "3" 0
2 2 2 0
3 NULL NULL 1
4 0 0 0
......@@ -319,24 +319,24 @@ id1 jpath jexst id2 id3 jpath_3 id4 jpath_4
1 3 0 2 1 a1 NULL NULL
1 3 0 2 2 a2 NULL NULL
1 3 0 3 1 c NULL NULL
1 3 0 NULL NULL NULL 1 NULL
1 3 0 NULL NULL NULL 2 NULL
1 3 0 NULL NULL NULL 3 NULL
1 3 0 NULL NULL NULL 1 {"ll":["b1","b2","b3"]}
1 3 0 NULL NULL NULL 2 {"ll": ["a1","a2"]}
1 3 0 NULL NULL NULL 3 {"ll":["c"]}
2 2 0 1 1 1 NULL NULL
2 2 0 1 2 11 NULL NULL
2 2 0 1 3 111 NULL NULL
2 2 0 2 1 2 NULL NULL
2 2 0 NULL NULL NULL 1 NULL
2 2 0 NULL NULL NULL 2 NULL
2 2 0 NULL NULL NULL 1 {"ll":[1,11,111]}
2 2 0 NULL NULL NULL 2 {"ll":[2]}
3 NULL 1 1 1 zzz NULL NULL
3 NULL 1 NULL NULL NULL 1 NULL
3 NULL 1 NULL NULL NULL 1 {"ll":["zzz"]}
4 0 0 1 1 0.1 NULL NULL
4 0 0 1 2 0.01 NULL NULL
4 0 0 2 1 0.02 NULL NULL
4 0 0 2 2 0.002 NULL NULL
4 0 0 2 3 0.0002 NULL NULL
4 0 0 NULL NULL NULL 1 NULL
4 0 0 NULL NULL NULL 2 NULL
4 0 0 NULL NULL NULL 1 {"ll":[0.1,0.01]}
4 0 0 NULL NULL NULL 2 {"ll":[0.02,0.002,0.0002]}
ord should be 1,1,1,2, which tells that first two values of 'l' are
from the same object, and next two are from different objects
SELECT *
......@@ -555,10 +555,12 @@ JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT NULL ON ERROR)) jt;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL ON ERROR)) jt' at line 2
SELECT * FROM
JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT 0 ON EMPTY)) jt;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '0 ON EMPTY)) jt' at line 2
x
0
SELECT * FROM
JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT 0 ON ERROR)) jt;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '0 ON ERROR)) jt' at line 2
x
NULL
SELECT * FROM
JSON_TABLE('{}', '$' COLUMNS (x DATE
PATH '$.x'
......@@ -608,7 +610,7 @@ SELECT * FROM JSON_TABLE('{"a":"1"}',
o FOR ORDINALITY)) AS jt
WHERE o = 1;
jpath o
1 1
"1" 1
#
# Bug#25427982: ASSERTION `DERIVED' FAILED IN SQL/TABLE.H
#
......
......@@ -30,9 +30,9 @@ select * from t1 right join json_table(t1.item_props,'$' columns( color varchar(
DROP TABLE t1;
select * from JSON_TABLE( '[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default '101' on empty, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt;
select * from JSON_TABLE( '[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default 101 on empty, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt;
select * from JSON_TABLE( '[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default '202' on error, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt;
select * from JSON_TABLE( '[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default 202 on error, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt;
select * from JSON_TABLE( '[ {"a": [1, 2], "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default '101' on empty, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt;
......@@ -814,6 +814,16 @@ select * from json_table('{"a":"foo", "b":1, "c":1000}', '$.*' columns(converted
select * from json_table('{"a":"foo", "b":1, "c":1000}', '$.*' columns(converted tinyint path '$', original text path '$')) as jt order by original;
select * from
json_table('[{"color": "blue", "price": { "high": 10, "low": 5}},
{"color": "white", "price": "pretty low"},
{"color": "yellow", "price": 256.20},
{"color": "red", "price": { "high": 20, "low": 8}}]',
'$[*]' columns(color varchar(100) path '$.color',
price json path '$.price'
)
) as T;
--echo #
--echo # MDEV-27696 Json table columns accept redundant COLLATE syntax
--echo #
......
......@@ -453,13 +453,11 @@ SELECT * FROM
SELECT * FROM
JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT NULL ON ERROR)) jt;
# The DEFAULT value must be a string on JSON format for now.
--error 1064
SELECT * FROM
JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT 0 ON EMPTY)) jt;
--error 1064
SELECT * FROM
JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT 0 ON ERROR)) jt;
# We don't accept dates in DEFAULT
--error 1064
SELECT * FROM
JSON_TABLE('{}', '$' COLUMNS (x DATE
......
......@@ -19,6 +19,7 @@
#include "sql_priv.h"
#include "sql_class.h" /* TMP_TABLE_PARAM */
#include "table.h"
#include "sql_type_json.h"
#include "item_jsonfunc.h"
#include "json_table.h"
#include "sql_show.h"
......@@ -377,6 +378,25 @@ static void store_json_in_field(Field *f, const json_engine_t *je)
}
static int store_json_in_json(Field *f, json_engine_t *je)
{
const uchar *from= je->value_begin;
const uchar *to;
if (json_value_scalar(je))
to= je->value_end;
else
{
int error;
if ((error= json_skip_level(je)))
return error;
to= je->s.c_str;
}
f->store((const char *) from, (uint32) (to - from), je->s.cs);
return 0;
}
bool Json_table_nested_path::check_error(const char *str)
{
if (m_engine.s.error)
......@@ -541,7 +561,12 @@ int ha_json_table::fill_column_values(THD *thd, uchar * buf, uchar *pos)
}
else
{
if (!(error= !json_value_scalar(&je)))
if (jc->m_format_json)
{
if (!(error= store_json_in_json(*f, &je)))
error= er_handler.errors;
}
else if (!(error= !json_value_scalar(&je)))
{
store_json_in_field(*f, &je);
error= er_handler.errors;
......@@ -869,6 +894,10 @@ int Json_table_column::set(THD *thd, enum_type ctype, const LEX_CSTRING &path,
anctual content. Not sure though if we should.
*/
m_path.s.c_str= (const uchar *) path.str;
if (ctype == PATH)
m_format_json= m_field->type_handler() == &type_handler_long_blob_json;
return 0;
}
......
......@@ -147,6 +147,7 @@ class Json_table_column : public Sql_alloc
};
enum_type m_column_type;
bool m_format_json;
json_path_t m_path;
On_response m_on_error;
On_response m_on_empty;
......
......@@ -1315,6 +1315,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
TEXT_STRING
NCHAR_STRING
json_text_literal
json_text_literal_or_num
%type <lex_str_ptr>
opt_table_alias_clause
......@@ -11252,6 +11253,26 @@ json_text_literal:
}
;
json_text_literal_or_num:
json_text_literal
| NUM
{
Lex->json_table->m_text_literal_cs= NULL;
}
| LONG_NUM
{
Lex->json_table->m_text_literal_cs= NULL;
}
| DECIMAL_NUM
{
Lex->json_table->m_text_literal_cs= NULL;
}
| FLOAT_NUM
{
Lex->json_table->m_text_literal_cs= NULL;
}
;
join_table_list:
derived_table_list { MYSQL_YYABORT_UNLESS($$=$1); }
;
......@@ -11366,7 +11387,7 @@ json_on_response:
{
$$.m_response= Json_table_column::RESPONSE_NULL;
}
| DEFAULT json_text_literal
| DEFAULT json_text_literal_or_num
{
$$.m_response= Json_table_column::RESPONSE_DEFAULT;
$$.m_default= $2;
......
Warnings:
Warning 1105 No file name. Table will use t1.xml
#
# Testing changing table type (not in-place)
#
......
Warnings:
Warning 1105 No file name. Table will use t1.xml
create table t1 (i int) engine=Connect table_type=XML option_list='xmlsup=libxml2';
Warnings:
Warning 1105 No file name. Table will use t1.xml
......
Warnings:
Warning 1105 No file name. Table will use t1.xml
SET NAMES utf8;
#
# Testing tag values
......
Warnings:
Warning 1105 No file name. Table will use t1.xml
#
# Beginning of grant.inc
#
......
Warnings:
Warning 1105 No file name. Table will use t1.xml
SET NAMES utf8;
#
# Testing HTML like XML file
......
Warnings:
Warning 1105 No file name. Table will use t1.xml
SET NAMES utf8;
CREATE TABLE t1 (i INT UNIQUE NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xt1.xml' OPTION_LIST='xmlsup=libxml2,Rownode=N';
ERROR HY000: Table type XML is not indexable
......
Warnings:
Warning 1105 No file name. Table will use t1.xml
SET NAMES utf8;
#
# Testing expanded values
......
Warnings:
Warning 1105 No file name. Table will use t1.xml
#
# Testing zipped XML tables
#
......
--disable_query_log
--disable_warnings
--error 0,ER_UNKNOWN_ERROR
CREATE TABLE t1 (a VARCHAR(10))
ENGINE=CONNECT TABLE_TYPE=XML OPTION_LIST='xmlsup=libxml2';
......@@ -12,6 +13,7 @@ if (!`SELECT count(*) FROM INFORMATION_SCHEMA.TABLES
Skip Need LIBXML2;
}
DROP TABLE t1;
--enable_warnings
--enable_query_log
--source have_libxml2.inc
# Overlong table type
--error ER_UNKNOWN_ERROR
......
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2018, 2021, MariaDB Corporation.
Copyright (c) 2018, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
......@@ -154,9 +154,8 @@ page_cur_tuple_insert(
MY_ATTRIBUTE((nonnull, warn_unused_result));
/***********************************************************//**
Inserts a record next to page cursor on an uncompressed page.
Returns pointer to inserted record if succeed, i.e., enough
space available, NULL otherwise. The cursor stays at the same position.
@return pointer to record if succeed, NULL otherwise */
@return pointer to record
@retval nullptr if not enough space was available */
rec_t*
page_cur_insert_rec_low(
/*====================*/
......
......@@ -901,7 +901,7 @@ class trx_sys_t
/**
@return TRX_RSEG_HISTORY length (number of committed transactions to purge)
*/
uint32_t history_size();
size_t history_size();
/**
......@@ -909,13 +909,13 @@ class trx_sys_t
@param threshold number of committed transactions
@return whether TRX_RSEG_HISTORY length exceeds the threshold
*/
bool history_exceeds(uint32_t threshold);
bool history_exceeds(size_t threshold);
/**
@return approximate history_size(), without latch protection
*/
TPOOL_SUPPRESS_TSAN uint32_t history_size_approx() const;
TPOOL_SUPPRESS_TSAN size_t history_size_approx() const;
/**
......
......@@ -4359,7 +4359,7 @@ lock_print_info_summary(
fprintf(file,
"Purge done for trx's n:o < " TRX_ID_FMT
" undo n:o < " TRX_ID_FMT " state: %s\n"
"History list length %u\n",
"History list length %zu\n",
purge_sys.tail.trx_no,
purge_sys.tail.undo_no,
purge_sys.enabled()
......
......@@ -2,7 +2,7 @@
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2018, 2021, MariaDB Corporation.
Copyright (c) 2018, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
......@@ -1284,9 +1284,8 @@ inline void mtr_t::page_insert(const buf_block_t &block, bool reuse,
/***********************************************************//**
Inserts a record next to page cursor on an uncompressed page.
Returns pointer to inserted record if succeed, i.e., enough
space available, NULL otherwise. The cursor stays at the same position.
@return pointer to record if succeed, NULL otherwise */
@return pointer to record
@retval nullptr if not enough space was available */
rec_t*
page_cur_insert_rec_low(
/*====================*/
......@@ -1580,8 +1579,12 @@ page_cur_insert_rec_low(
const byte *r= rec;
const byte *c= cur->rec;
const byte *c_end= cur->rec + data_size;
static_assert(REC_N_OLD_EXTRA_BYTES == REC_N_NEW_EXTRA_BYTES + 1, "");
if (c <= insert_buf && c_end > insert_buf)
c_end= insert_buf;
else if (c_end < next_rec &&
c_end >= next_rec - REC_N_OLD_EXTRA_BYTES + comp)
c_end= next_rec - REC_N_OLD_EXTRA_BYTES + comp;
else
c_end= std::min<const byte*>(c_end, block->page.frame + srv_page_size -
PAGE_DIR - PAGE_DIR_SLOT_SIZE *
......
......@@ -514,7 +514,7 @@ static srv_sys_t srv_sys;
struct purge_coordinator_state
{
/** Snapshot of the last history length before the purge call.*/
uint32 m_history_length;
size_t m_history_length;
Atomic_counter<int> m_running;
private:
ulint count;
......@@ -1586,7 +1586,7 @@ static bool srv_purge_should_exit()
return true;
/* Slow shutdown was requested. */
const uint32_t history_size= trx_sys.history_size();
const size_t history_size= trx_sys.history_size();
if (history_size)
{
static time_t progress_time;
......@@ -1596,9 +1596,9 @@ static bool srv_purge_should_exit()
progress_time= now;
#if defined HAVE_SYSTEMD && !defined EMBEDDED_LIBRARY
service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL,
"InnoDB: to purge %u transactions",
"InnoDB: to purge %zu transactions",
history_size);
ib::info() << "to purge " << history_size << " transactions";
sql_print_information("InnoDB: to purge %zu transactions", history_size);
#endif
}
return false;
......
/*****************************************************************************
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2021, MariaDB Corporation.
Copyright (c) 2017, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
......@@ -206,10 +206,10 @@ void trx_sys_t::create()
rw_trx_hash.init();
}
uint32_t trx_sys_t::history_size()
size_t trx_sys_t::history_size()
{
ut_ad(is_initialised());
uint32_t size= 0;
size_t size= 0;
for (auto &rseg : rseg_array)
{
rseg.latch.rd_lock(SRW_LOCK_CALL);
......@@ -220,10 +220,10 @@ uint32_t trx_sys_t::history_size()
return size;
}
bool trx_sys_t::history_exceeds(uint32_t threshold)
bool trx_sys_t::history_exceeds(size_t threshold)
{
ut_ad(is_initialised());
uint32_t size= 0;
size_t size= 0;
bool exceeds= false;
size_t i;
for (i= 0; i < array_elements(rseg_array); i++)
......@@ -251,10 +251,10 @@ TPOOL_SUPPRESS_TSAN bool trx_sys_t::history_exists()
return false;
}
TPOOL_SUPPRESS_TSAN uint32_t trx_sys_t::history_size_approx() const
TPOOL_SUPPRESS_TSAN size_t trx_sys_t::history_size_approx() const
{
ut_ad(is_initialised());
uint32_t size= 0;
size_t size= 0;
for (auto &rseg : rseg_array)
size+= rseg.history_size;
return size;
......
......@@ -196,6 +196,21 @@ Warnings:
Warning 1287 The table parameter 'buffer_size' is deprecated and will be removed in a future release
DROP TABLE tbl_a;
DROP TABLE tbl_b;
# MDEV-27926 Deprecate spider_init_sql_alloc_size
SET spider_init_sql_alloc_size = 1;
Warnings:
Warning 1287 '@@spider_init_sql_alloc_size' is deprecated and will be removed in a future release
SHOW VARIABLES LIKE "spider_init_sql_alloc_size";
Variable_name Value
spider_init_sql_alloc_size 1
CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='isa "1"';
Warnings:
Warning 1287 The table parameter 'isa' is deprecated and will be removed in a future release
CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='init_sql_alloc_size "1"';
Warnings:
Warning 1287 The table parameter 'init_sql_alloc_size' is deprecated and will be removed in a future release
DROP TABLE tbl_a;
DROP TABLE tbl_b;
DROP DATABASE auto_test_local;
for master_1
for child2
......
......@@ -117,6 +117,15 @@ eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='buffer_size "1"';
DROP TABLE tbl_a;
DROP TABLE tbl_b;
--echo # MDEV-27926 Deprecate spider_init_sql_alloc_size
SET spider_init_sql_alloc_size = 1;
SHOW VARIABLES LIKE "spider_init_sql_alloc_size";
eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='isa "1"';
eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='init_sql_alloc_size "1"';
DROP TABLE tbl_a;
DROP TABLE tbl_b;
DROP DATABASE auto_test_local;
--disable_query_log
......
......@@ -576,7 +576,7 @@ longlong spider_param_semi_split_read_limit(
*/
static MYSQL_THDVAR_INT(
init_sql_alloc_size, /* name */
PLUGIN_VAR_RQCMDARG, /* opt */
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Initial sql string alloc size", /* comment */
NULL, /* check */
spider_use_table_value_deprecated, /* update */
......
......@@ -2345,6 +2345,7 @@ int spider_parse_connect_info(
#endif
SPIDER_PARAM_STR_LIST("fds", tgt_filedsns);
SPIDER_PARAM_LONGLONG("frd", first_read, 0);
SPIDER_PARAM_DEPRECATED_WARNING("isa");
SPIDER_PARAM_INT("isa", init_sql_alloc_size, 0);
SPIDER_PARAM_INT_WITH_MAX("idl", internal_delayed, 0, 1);
SPIDER_PARAM_DEPRECATED_WARNING("ilm");
......@@ -2629,6 +2630,7 @@ int spider_parse_connect_info(
error_num = connect_string_parse.print_param_error();
goto error;
case 19:
SPIDER_PARAM_DEPRECATED_WARNING("init_sql_alloc_size");
SPIDER_PARAM_INT("init_sql_alloc_size", init_sql_alloc_size, 0);
SPIDER_PARAM_INT_WITH_MAX(
"auto_increment_mode", auto_increment_mode, 0, 3);
......@@ -6959,8 +6961,9 @@ int spider_db_init(
if (my_gethwaddr((uchar *) addr))
{
my_printf_error(ER_SPIDER_CANT_NUM, ER_SPIDER_CANT_STR1, MYF(0),
my_printf_error(ER_SPIDER_CANT_NUM, ER_SPIDER_CANT_STR1, MYF(ME_WARNING),
"get hardware address with error ", errno);
bzero(addr,6);
}
spider_unique_id.str = spider_unique_id_buf;
spider_unique_id.length = my_sprintf(spider_unique_id_buf,
......
/* Copyright (C) 2021, MariaDB Corporation.
/* Copyright (C) 2021, 2022, MariaDB Corporation.
This program is free software; you can redistribute itand /or modify
it under the terms of the GNU General Public License as published by
......@@ -137,8 +137,8 @@ class aio_uring final : public tpool::aio
io_uring_cqe *cqe;
if (int ret= io_uring_wait_cqe(&aio->uring_, &cqe))
{
if (ret == -EINTR) // this may occur during shutdown
break;
if (ret == -EINTR)
continue;
my_printf_error(ER_UNKNOWN_ERROR,
"io_uring_wait_cqe() returned %d\n",
ME_ERROR_LOG | ME_FATAL, ret);
......@@ -147,7 +147,7 @@ class aio_uring final : public tpool::aio
auto *iocb= static_cast<tpool::aiocb*>(io_uring_cqe_get_data(cqe));
if (!iocb)
break;
break; // ~aio_uring() told us to terminate
int res= cqe->res;
if (res < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment