Commit 1b3bd00c authored by Alexander Barkov's avatar Alexander Barkov

Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext

parents a1e52014 92f18bde
...@@ -618,3 +618,14 @@ connection default; ...@@ -618,3 +618,14 @@ connection default;
set @@global.max_allowed_packet = default; set @@global.max_allowed_packet = default;
set @@global.net_buffer_length = default; set @@global.net_buffer_length = default;
disconnect newconn; disconnect newconn;
create table t1(j longtext, p longtext);
insert into t1 values
('{"a":1,"b":2,"c":3}','$.a'),
('{"a":1,"b":2,"c":3}','$.b'),
('{"a":1,"b":2,"c":3}','$.c');
select j, p, json_remove(j, p) from t1;
j p json_remove(j, p)
{"a":1,"b":2,"c":3} $.a {"b": 2, "c": 3}
{"a":1,"b":2,"c":3} $.b {"a": 1, "c": 3}
{"a":1,"b":2,"c":3} $.c {"a": 1, "b": 2}
drop table t1;
CREATE TABLE t1 (i INT) ENGINE=InnoDB;
CREATE TABLE t2 (i INT) ENGINE=InnoDB;
CREATE OR REPLACE TRIGGER tr1
AFTER UPDATE ON t2
FOR EACH ROW
INSERT INTO tlog (i) VALUES (1);
INSERT IGNORE INTO t2 VALUES (1);
CREATE TRIGGER IF NOT EXISTS tr2
BEFORE INSERT ON t2
FOR EACH ROW
INSERT INTO tlog (i) VALUES (2);
START TRANSACTION;
INSERT INTO t1 VALUES (1);
UPDATE t2 SET i = 3;
ERROR 42S02: Table 'test.tlog' doesn't exist
INSERT INTO t1 VALUES (2);
INSERT INTO t2 VALUES (4);
ERROR 42S02: Table 'test.tlog' doesn't exist
UPDATE t1 SET i = 4 LIMIT 1;
COMMIT;
SELECT * FROM t1;
i
4
2
SELECT * FROM t2;
i
1
DROP TABLE t1,t2;
--source include/have_innodb.inc
CREATE TABLE t1 (i INT) ENGINE=InnoDB;
CREATE TABLE t2 (i INT) ENGINE=InnoDB;
CREATE OR REPLACE TRIGGER tr1
AFTER UPDATE ON t2
FOR EACH ROW
INSERT INTO tlog (i) VALUES (1);
INSERT IGNORE INTO t2 VALUES (1);
CREATE TRIGGER IF NOT EXISTS tr2
BEFORE INSERT ON t2
FOR EACH ROW
INSERT INTO tlog (i) VALUES (2);
START TRANSACTION;
INSERT INTO t1 VALUES (1);
--error ER_NO_SUCH_TABLE
UPDATE t2 SET i = 3;
INSERT INTO t1 VALUES (2);
--error ER_NO_SUCH_TABLE
INSERT INTO t2 VALUES (4);
UPDATE t1 SET i = 4 LIMIT 1;
COMMIT;
SELECT * FROM t1;
SELECT * FROM t2;
DROP TABLE t1,t2;
...@@ -263,3 +263,14 @@ set @@global.max_allowed_packet = default; ...@@ -263,3 +263,14 @@ set @@global.max_allowed_packet = default;
set @@global.net_buffer_length = default; set @@global.net_buffer_length = default;
--disconnect newconn --disconnect newconn
#
# MDEV-12262 Assertion `!null_value' failed in virtual bool Item::send on JSON_REMOVE.
#
create table t1(j longtext, p longtext);
insert into t1 values
('{"a":1,"b":2,"c":3}','$.a'),
('{"a":1,"b":2,"c":3}','$.b'),
('{"a":1,"b":2,"c":3}','$.c');
select j, p, json_remove(j, p) from t1;
drop table t1;
...@@ -2633,6 +2633,7 @@ String *Item_func_json_remove::val_str(String *str) ...@@ -2633,6 +2633,7 @@ String *Item_func_json_remove::val_str(String *str)
str->length(0); str->length(0);
if (append_simple(str, js->ptr(), rem_start - js->ptr()) || if (append_simple(str, js->ptr(), rem_start - js->ptr()) ||
(je.state == JST_KEY && n_item > 0 && str->append(",", 1)) ||
append_simple(str, rem_end, js->end() - rem_end)) append_simple(str, rem_end, js->end() - rem_end))
goto js_error; /* Out of memory. */ goto js_error; /* Out of memory. */
...@@ -2658,6 +2659,7 @@ String *Item_func_json_remove::val_str(String *str) ...@@ -2658,6 +2659,7 @@ String *Item_func_json_remove::val_str(String *str)
if (json_nice(&je, str, Item_func_json_format::LOOSE)) if (json_nice(&je, str, Item_func_json_format::LOOSE))
goto js_error; goto js_error;
null_value= 0;
return str; return str;
js_error: js_error:
......
...@@ -7448,6 +7448,8 @@ ER_GEOJSON_NOT_CLOSED ...@@ -7448,6 +7448,8 @@ ER_GEOJSON_NOT_CLOSED
eng "Incorrect GeoJSON format - polygon not closed." eng "Incorrect GeoJSON format - polygon not closed."
ER_JSON_PATH_EMPTY ER_JSON_PATH_EMPTY
eng "Path expression '$' is not allowed in argument %d to function '%s'." eng "Path expression '$' is not allowed in argument %d to function '%s'."
ER_SLAVE_SAME_ID
eng "A slave with the same server_uuid/server_id as this slave has connected to the master"
ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
eng "Illegal parameter data types %s and %s for operation '%s'" eng "Illegal parameter data types %s and %s for operation '%s'"
ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
......
...@@ -201,6 +201,9 @@ extern "C" sig_handler handle_fatal_signal(int sig) ...@@ -201,6 +201,9 @@ extern "C" sig_handler handle_fatal_signal(int sig)
case ABORT_QUERY_HARD: case ABORT_QUERY_HARD:
kreason= "ABORT_QUERY"; kreason= "ABORT_QUERY";
break; break;
case KILL_SLAVE_SAME_ID:
kreason= "KILL_SLAVE_SAME_ID";
break;
} }
my_safe_printf_stderr("%s", "\n" my_safe_printf_stderr("%s", "\n"
"Trying to get some variables.\n" "Trying to get some variables.\n"
......
...@@ -1987,6 +1987,8 @@ int killed_errno(killed_state killed) ...@@ -1987,6 +1987,8 @@ int killed_errno(killed_state killed)
case KILL_SERVER: case KILL_SERVER:
case KILL_SERVER_HARD: case KILL_SERVER_HARD:
DBUG_RETURN(ER_SERVER_SHUTDOWN); DBUG_RETURN(ER_SERVER_SHUTDOWN);
case KILL_SLAVE_SAME_ID:
DBUG_RETURN(ER_SLAVE_SAME_ID);
} }
DBUG_RETURN(0); // Keep compiler happy DBUG_RETURN(0); // Keep compiler happy
} }
......
...@@ -477,17 +477,23 @@ enum killed_state ...@@ -477,17 +477,23 @@ enum killed_state
ABORT_QUERY_HARD= 7, ABORT_QUERY_HARD= 7,
KILL_TIMEOUT= 8, KILL_TIMEOUT= 8,
KILL_TIMEOUT_HARD= 9, KILL_TIMEOUT_HARD= 9,
/*
When binlog reading thread connects to the server it kills
all the binlog threads with the same ID.
*/
KILL_SLAVE_SAME_ID= 10,
/* /*
All of the following killed states will kill the connection All of the following killed states will kill the connection
KILL_CONNECTION must be the first of these and it must start with KILL_CONNECTION must be the first of these and it must start with
an even number (becasue of HARD bit)! an even number (becasue of HARD bit)!
*/ */
KILL_CONNECTION= 10, KILL_CONNECTION= 12,
KILL_CONNECTION_HARD= 11, KILL_CONNECTION_HARD= 13,
KILL_SYSTEM_THREAD= 12, KILL_SYSTEM_THREAD= 14,
KILL_SYSTEM_THREAD_HARD= 13, KILL_SYSTEM_THREAD_HARD= 15,
KILL_SERVER= 14, KILL_SERVER= 16,
KILL_SERVER_HARD= 15 KILL_SERVER_HARD= 17,
}; };
extern int killed_errno(killed_state killed); extern int killed_errno(killed_state killed);
......
...@@ -2910,6 +2910,13 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, ...@@ -2910,6 +2910,13 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos,
THD_STAGE_INFO(thd, stage_waiting_to_finalize_termination); THD_STAGE_INFO(thd, stage_waiting_to_finalize_termination);
RUN_HOOK(binlog_transmit, transmit_stop, (thd, flags)); RUN_HOOK(binlog_transmit, transmit_stop, (thd, flags));
if (info->thd->killed == KILL_SLAVE_SAME_ID)
{
info->errmsg= "A slave with the same server_uuid/server_id as this slave "
"has connected to the master";
info->error= ER_SLAVE_SAME_ID;
}
const bool binlog_open = my_b_inited(&log); const bool binlog_open = my_b_inited(&log);
if (file >= 0) if (file >= 0)
{ {
...@@ -2921,7 +2928,8 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, ...@@ -2921,7 +2928,8 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos,
thd->variables.max_allowed_packet= old_max_allowed_packet; thd->variables.max_allowed_packet= old_max_allowed_packet;
delete info->fdev; delete info->fdev;
if (info->error == ER_MASTER_FATAL_ERROR_READING_BINLOG && binlog_open) if ((info->error == ER_MASTER_FATAL_ERROR_READING_BINLOG ||
info->error == ER_SLAVE_SAME_ID) && binlog_open)
{ {
/* /*
detailing the fatal error message with coordinates detailing the fatal error message with coordinates
...@@ -3392,7 +3400,7 @@ void kill_zombie_dump_threads(uint32 slave_server_id) ...@@ -3392,7 +3400,7 @@ void kill_zombie_dump_threads(uint32 slave_server_id)
it will be slow because it will iterate through the list it will be slow because it will iterate through the list
again. We just to do kill the thread ourselves. again. We just to do kill the thread ourselves.
*/ */
tmp->awake(KILL_QUERY); tmp->awake(KILL_SLAVE_SAME_ID);
mysql_mutex_unlock(&tmp->LOCK_thd_data); mysql_mutex_unlock(&tmp->LOCK_thd_data);
} }
} }
......
...@@ -61,7 +61,7 @@ ut_dbg_assertion_failed( ...@@ -61,7 +61,7 @@ ut_dbg_assertion_failed(
ut_dbg_assertion_failed(0, __FILE__, __LINE__) ut_dbg_assertion_failed(0, __FILE__, __LINE__)
/** Debug assertion */ /** Debug assertion */
#define ut_ad(EXPR) DBUG_ASSERT(EXPR) #define ut_ad DBUG_ASSERT
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
/** Debug statement. Does nothing unless UNIV_DEBUG is defined. */ /** Debug statement. Does nothing unless UNIV_DEBUG is defined. */
#define ut_d(EXPR) EXPR #define ut_d(EXPR) EXPR
......
...@@ -2005,10 +2005,9 @@ trx_undo_report_row_operation( ...@@ -2005,10 +2005,9 @@ trx_undo_report_row_operation(
undo->empty = FALSE; undo->empty = FALSE;
undo->top_page_no = page_no; undo->top_page_no = page_no;
undo->top_offset = offset; undo->top_offset = offset;
undo->top_undo_no = trx->undo_no; undo->top_undo_no = trx->undo_no++;
undo->guess_block = undo_block; undo->guess_block = undo_block;
trx->undo_no++;
trx->undo_rseg_space = rseg->space; trx->undo_rseg_space = rseg->space;
mutex_exit(&trx->undo_mutex); mutex_exit(&trx->undo_mutex);
......
...@@ -990,11 +990,11 @@ trx_roll_pop_top_rec_of_trx(trx_t* trx, roll_ptr_t* roll_ptr, mem_heap_t* heap) ...@@ -990,11 +990,11 @@ trx_roll_pop_top_rec_of_trx(trx_t* trx, roll_ptr_t* roll_ptr, mem_heap_t* heap)
trx_undo_t* temp = trx->rsegs.m_noredo.undo; trx_undo_t* temp = trx->rsegs.m_noredo.undo;
const undo_no_t limit = trx->roll_limit; const undo_no_t limit = trx->roll_limit;
ut_ad(!insert || !update || !insert->top_undo_no ut_ad(!insert || !update || insert->empty || update->empty
|| insert->top_undo_no != update->top_undo_no); || insert->top_undo_no != update->top_undo_no);
ut_ad(!insert || !temp || !insert->top_undo_no ut_ad(!insert || !temp || insert->empty || temp->empty
|| insert->top_undo_no != temp->top_undo_no); || insert->top_undo_no != temp->top_undo_no);
ut_ad(!update || !temp || !update->top_undo_no ut_ad(!update || !temp || update->empty || temp->empty
|| update->top_undo_no != temp->top_undo_no); || update->top_undo_no != temp->top_undo_no);
if (insert && !insert->empty && limit <= insert->top_undo_no) { if (insert && !insert->empty && limit <= insert->top_undo_no) {
......
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