[MDEV-24208] SHOW RELAYLOG EVENTS command is not supported in the prepared statement protocol yet Created: 2020-11-13  Updated: 2021-01-17  Resolved: 2021-01-14

Status: Closed
Project: MariaDB Server
Component/s: Prepared Statements
Affects Version/s: 10.2, 10.3, 10.4, 10.5
Fix Version/s: 10.2.37, 10.3.28, 10.4.18, 10.5.9, 10.6.0

Type: Bug Priority: Major
Reporter: Sujatha Sivakumar (Inactive) Assignee: Dmitry Shulga
Resolution: Fixed Votes: 0
Labels: None


 Description   

Test File: show_relay_log_ps.test
SHOW RELAYLOG EVENTS;

./mtr --ps-protocol show_relay_log_ps.test

MariaDB Version 10.2.35-MariaDB-debug
 - SSL connections supported
 - binaries are debug compiled
 - binaries built with wsrep patch
Collecting tests...
Installing system database...
 
==============================================================================
 
TEST                                      RESULT   TIME (ms) or COMMENT
--------------------------------------------------------------------------
 
worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019
SHOW RELAYLOG EVENTS;
main.show_relay_log_ps                   [ fail ]
        Test ended at 2020-11-13 19:32:28
 
CURRENT_TEST: main.show_relay_log_ps
mysqltest: At line 1: query 'SHOW RELAYLOG EVENTS' failed: 1295: This command is not supported in the prepared statement protocol yet



 Comments   
Comment by Sergei Golubchik [ 2020-11-19 ]

Perhaps it needs just

diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -2369,6 +2369,14 @@ static bool check_prepared_statement(Prepared_statement >
       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);
+    }
 #endif /* EMBEDDED_LIBRARY */
   case SQLCOM_SHOW_CREATE_PROC:
     if ((res= mysql_test_show_create_routine(stmt, &sp_handler_procedure)) == >

Comment by Sergei Golubchik [ 2020-11-19 ]

after fixing this, please also remove --disable_ps_protocol and --enable_ps_protocol around SHOW RELAYLOG EVENTS in various test files.

Comment by Oleksandr Byelkin [ 2021-01-07 ]

Generally OK (I'd make "test" function but also can live with the block in case).

But I think test shoud be added:
1) it shoud return something on execution and re-execution
2) test that the command fail in PS if user has no REPL_SLAVE_ACL

Comment by Oleksandr Byelkin [ 2021-01-13 ]

OK to push!

Generated at Thu Feb 08 09:28:15 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.