mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 03:17:20 +02:00
MDEV-24208 SHOW RELAYLOG EVENTS command is not supported in the prepared statement protocol yet
Added sending of metadata in response to preparing request for the commands SQLCOM_SHOW_BINLOG_EVENTS, SQLCOM_SHOW_RELAYLOG_EVENTS
This commit is contained in:
parent
ab271ee7e2
commit
9e4a5a81fc
5 changed files with 149 additions and 11 deletions
65
mysql-test/r/ps_show_log.result
Normal file
65
mysql-test/r/ps_show_log.result
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
#
|
||||
# MDEV-24208 SHOW RELAYLOG EVENTS command is not supported in the prepared
|
||||
# statement protocol yet
|
||||
#
|
||||
CREATE USER u1;
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
connection master;
|
||||
CREATE TABLE t1(n INT);
|
||||
DROP TABLE t1;
|
||||
connection slave;
|
||||
PREPARE stmt_1 FROM 'SHOW BINLOG EVENTS';
|
||||
EXECUTE stmt_1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
# # Format_desc # # #
|
||||
# # Gtid_list # # []
|
||||
# # Binlog_checkpoint # # #
|
||||
# # Gtid # # GTID 0-1-1
|
||||
# # Query # # use `test`; CREATE TABLE t1(n INT)
|
||||
# # Gtid # # GTID 0-1-2
|
||||
# # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
|
||||
# Execute the same prepared statement the second time to check that
|
||||
# no internal structures used for handling the statement
|
||||
# 'SHOW BINLOG EVENTS' were damaged.
|
||||
EXECUTE stmt_1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
# # Format_desc # # #
|
||||
# # Gtid_list # # []
|
||||
# # Binlog_checkpoint # # #
|
||||
# # Gtid # # GTID 0-1-1
|
||||
# # Query # # use `test`; CREATE TABLE t1(n INT)
|
||||
# # Gtid # # GTID 0-1-2
|
||||
# # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
|
||||
DEALLOCATE PREPARE stmt_1;
|
||||
connection slave;
|
||||
PREPARE stmt_1 FROM 'SHOW RELAYLOG EVENTS';
|
||||
EXECUTE stmt_1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
slave-relay-bin.000001 # Format_desc # # #
|
||||
slave-relay-bin.000001 # Rotate # # #
|
||||
# Execute the same prepared statement the second time to check that
|
||||
# no internal structures used for handling the statement
|
||||
# 'SHOW RELAYLOG EVENTS' were damaged.
|
||||
EXECUTE stmt_1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
slave-relay-bin.000001 # Format_desc # # #
|
||||
slave-relay-bin.000001 # Rotate # # #
|
||||
DEALLOCATE PREPARE stmt_1;
|
||||
# Create the user u1 without the REPLICATION SLAVE privilege required
|
||||
# for running the statements SHOW BINLOG EVENTS/SHOW RELAYLOG EVENTS
|
||||
# and check that attempt to execute the statements SHOW BINLOG EVENTS/
|
||||
# SHOW RELAYLOG EVENTS as a prepred statements by a user without required
|
||||
# privileges results in error.
|
||||
connect con2,localhost,u1,,test;
|
||||
PREPARE stmt_1 FROM 'SHOW BINLOG EVENTS';
|
||||
EXECUTE stmt_1;
|
||||
ERROR 42000: Access denied; you need (at least one of) the REPLICATION SLAVE privilege(s) for this operation
|
||||
PREPARE stmt_1 FROM 'SHOW RELAYLOG EVENTS';
|
||||
EXECUTE stmt_1;
|
||||
ERROR 42000: Access denied; you need (at least one of) the REPLICATION SLAVE privilege(s) for this operation
|
||||
DEALLOCATE PREPARE stmt_1;
|
||||
include/rpl_end.inc
|
||||
connection default;
|
||||
DROP USER u1;
|
||||
# End of 10.2 tests
|
||||
|
|
@ -7,11 +7,6 @@ connection slave;
|
|||
--source include/have_innodb.inc
|
||||
connection master;
|
||||
|
||||
# Bug#18326: Do not lock table for writing during prepare of statement
|
||||
# The use of the ps protocol causes extra table maps in the binlog, so
|
||||
# we disable the ps-protocol for this statement.
|
||||
--disable_ps_protocol
|
||||
|
||||
# Set the default storage engine to different values on master and
|
||||
# slave. We need to stop the slave for the server variable to take
|
||||
# effect, since the variable is only read on start-up.
|
||||
|
|
|
|||
|
|
@ -4,10 +4,4 @@
|
|||
|
||||
let $rename_event_pos= `select @binlog_start_pos + 819`;
|
||||
|
||||
# Bug#18326: Do not lock table for writing during prepare of statement
|
||||
# The use of the ps protocol causes extra table maps in the binlog, so
|
||||
# we disable the ps-protocol for this statement.
|
||||
|
||||
--disable_ps_protocol
|
||||
-- source extra/rpl_tests/rpl_flsh_tbls.test
|
||||
--enable_ps_protocol
|
||||
|
|
|
|||
73
mysql-test/t/ps_show_log.test
Normal file
73
mysql-test/t/ps_show_log.test
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
--echo #
|
||||
--echo # MDEV-24208 SHOW RELAYLOG EVENTS command is not supported in the prepared
|
||||
--echo # statement protocol yet
|
||||
--echo #
|
||||
|
||||
CREATE USER u1;
|
||||
|
||||
--source include/have_binlog_format_statement.inc
|
||||
--source include/master-slave.inc
|
||||
--connection master
|
||||
CREATE TABLE t1(n INT);
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--sync_slave_with_master
|
||||
PREPARE stmt_1 FROM 'SHOW BINLOG EVENTS';
|
||||
|
||||
--replace_column 2 # 4 # 5 #
|
||||
--replace_regex /Server ver:.*Binlog ver: .*/#/ /slave-bin.*/#/
|
||||
EXECUTE stmt_1;
|
||||
|
||||
--echo # Execute the same prepared statement the second time to check that
|
||||
--echo # no internal structures used for handling the statement
|
||||
--echo # 'SHOW BINLOG EVENTS' were damaged.
|
||||
|
||||
--replace_column 2 # 4 # 5 #
|
||||
--replace_regex /Server ver:.*Binlog ver: .*/#/ /slave-bin.*/#/
|
||||
EXECUTE stmt_1;
|
||||
|
||||
DEALLOCATE PREPARE stmt_1;
|
||||
|
||||
--connection slave
|
||||
PREPARE stmt_1 FROM 'SHOW RELAYLOG EVENTS';
|
||||
--replace_column 2 # 4 # 5 #
|
||||
--replace_regex /Server ver:.*Binlog ver: .*/#/ /slave-relay-bin.*;pos=.*/#/
|
||||
EXECUTE stmt_1;
|
||||
|
||||
--echo # Execute the same prepared statement the second time to check that
|
||||
--echo # no internal structures used for handling the statement
|
||||
--echo # 'SHOW RELAYLOG EVENTS' were damaged.
|
||||
|
||||
--replace_column 2 # 4 # 5 #
|
||||
--replace_regex /Server ver:.*Binlog ver: .*/#/ /slave-relay-bin.*;pos=.*/#/
|
||||
EXECUTE stmt_1;
|
||||
|
||||
DEALLOCATE PREPARE stmt_1;
|
||||
|
||||
--echo # Create the user u1 without the REPLICATION SLAVE privilege required
|
||||
--echo # for running the statements SHOW BINLOG EVENTS/SHOW RELAYLOG EVENTS
|
||||
--echo # and check that attempt to execute the statements SHOW BINLOG EVENTS/
|
||||
--echo # SHOW RELAYLOG EVENTS as a prepred statements by a user without required
|
||||
--echo # privileges results in error.
|
||||
|
||||
--connect (con2,localhost,u1,,test)
|
||||
PREPARE stmt_1 FROM 'SHOW BINLOG EVENTS';
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
EXECUTE stmt_1;
|
||||
|
||||
PREPARE stmt_1 FROM 'SHOW RELAYLOG EVENTS';
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
EXECUTE stmt_1;
|
||||
|
||||
DEALLOCATE PREPARE stmt_1;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
|
||||
--connection default
|
||||
# Clean up
|
||||
DROP USER u1;
|
||||
|
||||
--echo # End of 10.2 tests
|
||||
|
|
@ -121,6 +121,7 @@ When one supplies long data for a placeholder:
|
|||
static const uint PARAMETER_FLAG_UNSIGNED= 128U << 8;
|
||||
#endif
|
||||
#include "lock.h" // MYSQL_OPEN_FORCE_SHARED_MDL
|
||||
#include "log_event.h" // class Log_event
|
||||
#include "sql_handler.h"
|
||||
#include "transaction.h" // trans_rollback_implicit
|
||||
#include "wsrep_mysqld.h"
|
||||
|
|
@ -2521,6 +2522,16 @@ static bool check_prepared_statement(Prepared_statement *stmt)
|
|||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
break;
|
||||
case SQLCOM_SHOW_BINLOG_EVENTS:
|
||||
case SQLCOM_SHOW_RELAYLOG_EVENTS:
|
||||
{
|
||||
List<Item> field_list;
|
||||
Log_event::init_show_field_list(thd, &field_list);
|
||||
|
||||
if ((res= send_stmt_metadata(thd, stmt, &field_list)) == 2)
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
break;
|
||||
#endif /* EMBEDDED_LIBRARY */
|
||||
case SQLCOM_SHOW_CREATE_PROC:
|
||||
if ((res= mysql_test_show_create_routine(stmt, TYPE_ENUM_PROCEDURE)) == 2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue