summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_parse.cc3
-rw-r--r--sql/sys_vars.cc21
2 files changed, 11 insertions, 13 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 05f3c85e9be..4bd346a6d63 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1638,8 +1638,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
if (thd->variables.batch_mode &&
- !thd->killed && !thd->is_error() &&
- vio_io_wait(thd->net.vio, VIO_IO_EVENT_READ, 0) > 0)
+ !thd->killed && !thd->is_error())
{
/* More commands follow, skip flush */
thd->get_stmt_da()->set_skip_flush();
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 913e1c8bdc7..d3a1fd7d68c 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -5236,29 +5236,28 @@ static Sys_var_mybool Sys_query_cache_strip_comments(
DEFAULT(FALSE));
+extern "C" int vio_set_nodelay(Vio *vio, int nodelay);
static bool fix_batch_mode(sys_var *self, THD *thd, enum_var_type type)
{
+#ifndef EMBEDDED_SERVER
if (type == OPT_SESSION)
{
- my_bool set_batch_mode= thd->variables.batch_mode;
- if (set_batch_mode)
+ int err = vio_set_nodelay(thd->net.vio, thd->variables.batch_mode ? 0:1);
+ if (err)
{
- my_bool has_more_data
- = (my_bool) vio_io_wait(thd->net.vio, VIO_IO_EVENT_READ, 0) > 0;
- thd->get_stmt_da()->set_skip_flush(has_more_data);
- }
- else
- {
- thd->get_stmt_da()->set_skip_flush(FALSE);
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
+ "Could not %s Nagle's algorithm, socket error %d",
+ thd->variables.batch_mode?"enable":"disable", socket_errno);
}
}
+#endif
return false;
}
static Sys_var_mybool Sys_batch_mode(
"batch_mode",
- "Client sends multiple queries without waiting for response",
- SESSION_VAR(batch_mode), CMD_LINE(OPT_ARG),
+ "Improve the efficiency of TCP/IP networks by reducing the number of packets that need to be sent over the network via Nagle's algoritm",
+ SESSION_ONLY(batch_mode), CMD_LINE(OPT_ARG),
DEFAULT(FALSE),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_batch_mode));