Skip to content

Commit

Permalink
MDEV-21612 - remove COM_MULTI from server and C/C
Browse files Browse the repository at this point in the history
The COM_MULTI did not take off. No connector is using it.
Remove related code from server, and client.
If anything it is a step simplification of already-bloated
dispatch_command(), and related code.
  • Loading branch information
vaintroub committed Jul 14, 2020
1 parent 1a2b494 commit b0d2a59
Show file tree
Hide file tree
Showing 19 changed files with 59 additions and 235 deletions.
2 changes: 1 addition & 1 deletion include/mysql.h.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
COM_SLAVE_WORKER=251,
COM_SLAVE_IO=252,
COM_SLAVE_SQL=253,
COM_MULTI=254,
COM_RESERVED_1=254,
COM_END=255
};
enum enum_indicator_type
Expand Down
9 changes: 5 additions & 4 deletions include/mysql_com.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ enum enum_server_command
COM_SLAVE_WORKER=251,
COM_SLAVE_IO=252,
COM_SLAVE_SQL=253,
COM_MULTI=254,
COM_RESERVED_1=254, /* Old COM_MULTI, now removed */
/* Must be last */
COM_END=255
};
Expand Down Expand Up @@ -296,8 +296,10 @@ enum enum_indicator_type
#define MARIADB_CLIENT_FLAGS_MASK 0xffffffff00000000ULL
/* Client support progress indicator */
#define MARIADB_CLIENT_PROGRESS (1ULL << 32)
/* support COM_MULTI */
#define MARIADB_CLIENT_COM_MULTI (1ULL << 33)

/* Old COM_MULTI experiment (functionality removed).*/
#define MARIADB_CLIENT_RESERVED_1 (1ULL << 33)

/* support of array binding */
#define MARIADB_CLIENT_STMT_BULK_OPERATIONS (1ULL << 34)
/* support of extended metadata (e.g. type/format information) */
Expand Down Expand Up @@ -341,7 +343,6 @@ enum enum_indicator_type
CLIENT_SESSION_TRACK |\
CLIENT_DEPRECATE_EOF |\
CLIENT_CONNECT_ATTRS |\
MARIADB_CLIENT_COM_MULTI |\
MARIADB_CLIENT_STMT_BULK_OPERATIONS |\
MARIADB_CLIENT_EXTENDED_METADATA|\
CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS)
Expand Down
5 changes: 2 additions & 3 deletions libmysqld/lib_sql.cc
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
arg_length= header_length;
}

result= dispatch_command(command, thd, (char *) arg, arg_length, FALSE,
FALSE);
result= dispatch_command(command, thd, (char *) arg, arg_length);
thd->cur_data= 0;
thd->mysys_var= NULL;

Expand Down Expand Up @@ -1258,7 +1257,7 @@ bool
net_send_ok(THD *thd,
uint server_status, uint statement_warn_count,
ulonglong affected_rows, ulonglong id, const char *message,
bool, bool)
bool)
{
DBUG_ENTER("emb_net_send_ok");
MYSQL_DATA *data;
Expand Down
3 changes: 1 addition & 2 deletions sql/log_event_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1900,8 +1900,7 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi,
thd->variables.sql_log_slow= !MY_TEST(global_system_variables.log_slow_disabled_statements & LOG_SLOW_DISABLE_SLAVE);
}

mysql_parse(thd, thd->query(), thd->query_length(), &parser_state,
FALSE, FALSE);
mysql_parse(thd, thd->query(), thd->query_length(), &parser_state);
/* Finalize server status flags after executing a statement. */
thd->update_server_status();
log_slow_statement(thd);
Expand Down
3 changes: 1 addition & 2 deletions sql/mysqld.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3330,7 +3330,6 @@ SHOW_VAR com_status_vars[]= {
{"kill", STMT_STATUS(SQLCOM_KILL)},
{"load", STMT_STATUS(SQLCOM_LOAD)},
{"lock_tables", STMT_STATUS(SQLCOM_LOCK_TABLES)},
{"multi", COM_STATUS(com_multi)},
{"optimize", STMT_STATUS(SQLCOM_OPTIMIZE)},
{"preload_keys", STMT_STATUS(SQLCOM_PRELOAD_KEYS)},
{"prepare_sql", STMT_STATUS(SQLCOM_PREPARE)},
Expand Down Expand Up @@ -3842,7 +3841,7 @@ static int init_common_variables()
of SQLCOM_ constants.
*/
compile_time_assert(sizeof(com_status_vars)/sizeof(com_status_vars[0]) - 1 ==
SQLCOM_END + 11);
SQLCOM_END + 10);
#endif

if (get_options(&remaining_argc, &remaining_argv))
Expand Down
19 changes: 8 additions & 11 deletions sql/protocol.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static const unsigned int PACKET_BUFFER_EXTRA_ALLOC= 1024;
bool net_send_error_packet(THD *, uint, const char *, const char *);
/* Declared non-static only because of the embedded library. */
bool net_send_ok(THD *, uint, uint, ulonglong, ulonglong, const char *,
bool, bool);
bool);
/* Declared non-static only because of the embedded library. */
bool net_send_eof(THD *thd, uint server_status, uint statement_warn_count);
#ifndef EMBEDDED_LIBRARY
Expand Down Expand Up @@ -211,8 +211,7 @@ bool
net_send_ok(THD *thd,
uint server_status, uint statement_warn_count,
ulonglong affected_rows, ulonglong id, const char *message,
bool is_eof,
bool skip_flush)
bool is_eof)
{
NET *net= &thd->net;
StringBuffer<MYSQL_ERRMSG_SIZE + 10> store;
Expand Down Expand Up @@ -285,7 +284,7 @@ net_send_ok(THD *thd,
DBUG_ASSERT(store.length() <= MAX_PACKET_LENGTH);

error= my_net_write(net, (const unsigned char*)store.ptr(), store.length());
if (likely(!error) && (!skip_flush || is_eof))
if (likely(!error))
error= net_flush(net);

thd->server_status&= ~SERVER_SESSION_STATE_CHANGED;
Expand Down Expand Up @@ -340,7 +339,7 @@ net_send_eof(THD *thd, uint server_status, uint statement_warn_count)
(thd->get_command() != COM_BINLOG_DUMP ))
{
error= net_send_ok(thd, server_status, statement_warn_count, 0, 0, NULL,
true, false);
true);
DBUG_RETURN(error);
}

Expand Down Expand Up @@ -607,16 +606,14 @@ void Protocol::end_statement()
thd->get_stmt_da()->statement_warn_count(),
thd->get_stmt_da()->affected_rows(),
thd->get_stmt_da()->last_insert_id(),
thd->get_stmt_da()->message(),
thd->get_stmt_da()->skip_flush());
thd->get_stmt_da()->message());
break;
case Diagnostics_area::DA_DISABLED:
break;
case Diagnostics_area::DA_EMPTY:
default:
DBUG_ASSERT(0);
error= send_ok(thd->server_status, 0, 0, 0, NULL,
thd->get_stmt_da()->skip_flush());
error= send_ok(thd->server_status, 0, 0, 0, NULL);
break;
}
if (likely(!error))
Expand All @@ -635,12 +632,12 @@ void Protocol::end_statement()

bool Protocol::send_ok(uint server_status, uint statement_warn_count,
ulonglong affected_rows, ulonglong last_insert_id,
const char *message, bool skip_flush)
const char *message)
{
DBUG_ENTER("Protocol::send_ok");
const bool retval=
net_send_ok(thd, server_status, statement_warn_count,
affected_rows, last_insert_id, message, false, skip_flush);
affected_rows, last_insert_id, message, false);
DBUG_RETURN(retval);
}

Expand Down
2 changes: 1 addition & 1 deletion sql/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class Protocol

virtual bool send_ok(uint server_status, uint statement_warn_count,
ulonglong affected_rows, ulonglong last_insert_id,
const char *message, bool skip_flush);
const char *message);

virtual bool send_eof(uint server_status, uint statement_warn_count);

Expand Down
11 changes: 4 additions & 7 deletions sql/share/errmsg-utf8.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7537,13 +7537,10 @@ ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS
# MariaDB extra error numbers starts from 4000
skip-to-error-number 4000

ER_COMMULTI_BADCONTEXT 0A000
eng "COM_MULTI can't return a result set in the given context"
ger "COM_MULTI kann im gegebenen Kontext keine Ergebnismenge zurückgeben"
ukr "COM_MULTI не може повернути результати у цьому контексті"
ER_BAD_COMMAND_IN_MULTI
eng "Command '%s' is not allowed for COM_MULTI"
ukr "Команда '%s' не дозволена для COM_MULTI"
ER_UNUSED_26 0A000
eng "This error never happens"
ER_UNUSED_27
eng "This error never happens"
ER_WITH_COL_WRONG_LIST
eng "WITH column list and SELECT field list have different column counts"
ER_TOO_MANY_DEFINITIONS_IN_WITH_CLAUSE
Expand Down
3 changes: 1 addition & 2 deletions sql/slave.cc
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,7 @@ gtid_pos_table_creation(THD *thd, plugin_ref engine, LEX_CSTRING *table_name)
err= parser_state.init(thd, thd->query(), thd->query_length());
if (err)
goto end;
mysql_parse(thd, thd->query(), thd->query_length(), &parser_state,
FALSE, FALSE);
mysql_parse(thd, thd->query(), thd->query_length(), &parser_state);
if (unlikely(thd->is_error()))
err= 1;
/* The warning is relevant to 10.3 and earlier. */
Expand Down
5 changes: 0 additions & 5 deletions sql/sql_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,6 @@ typedef struct system_status_var
ulong com_create_tmp_table;
ulong com_drop_tmp_table;
ulong com_other;
ulong com_multi;

ulong com_stmt_prepare;
ulong com_stmt_reprepare;
Expand Down Expand Up @@ -6902,10 +6901,6 @@ class select_dumpvar :public select_result_interceptor {
#define CF_SKIP_WSREP_CHECK 0
#endif /* WITH_WSREP */

/**
Do not allow it for COM_MULTI batch
*/
#define CF_NO_COM_MULTI (1U << 3)

/* Inline functions */

Expand Down
1 change: 0 additions & 1 deletion sql/sql_error.cc
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ void
Diagnostics_area::reset_diagnostics_area()
{
DBUG_ENTER("reset_diagnostics_area");
m_skip_flush= FALSE;
#ifdef DBUG_OFF
m_can_overwrite_status= FALSE;
/** Don't take chances in production */
Expand Down
11 changes: 0 additions & 11 deletions sql/sql_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -1022,14 +1022,6 @@ class Diagnostics_area: public Sql_state_errno,
{ DBUG_ASSERT(m_status == DA_ERROR || m_status == DA_OK ||
m_status == DA_OK_BULK); return m_message; }

bool skip_flush() const
{
DBUG_ASSERT(m_status == DA_OK || m_status == DA_OK_BULK);
return m_skip_flush;
}

void set_skip_flush()
{ m_skip_flush= TRUE; }

uint sql_errno() const
{
Expand Down Expand Up @@ -1215,9 +1207,6 @@ class Diagnostics_area: public Sql_state_errno,
/** Set to make set_error_status after set_{ok,eof}_status possible. */
bool m_can_overwrite_status;

/** Skip flushing network buffer after writing OK (for COM_MULTI) */
bool m_skip_flush;

/** Message buffer. Can be used by OK or ERROR status. */
char m_message[MYSQL_ERRMSG_SIZE];

Expand Down
Loading

0 comments on commit b0d2a59

Please sign in to comment.