summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjani@ua72d24.elisa.omakaista.fi <>2004-03-04 17:58:36 +0000
committerjani@ua72d24.elisa.omakaista.fi <>2004-03-04 17:58:36 +0000
commit58a978b900d2616162c408fcedbb874157819c6d (patch)
tree9e9896821fbad442c2079c187c49119f392976b8
parent995b74ee0db22aeacbfe8f4d19cef94b2fa4000d (diff)
downloadmariadb-git-58a978b900d2616162c408fcedbb874157819c6d.tar.gz
Fixed Bug#2491, INSERT DELAYED causes binary log unusable by mysqlbinlog (replication is ok)
Setting insert delayed threads = 0 at mysql_init_command.
-rw-r--r--BitKeeper/etc/logging_ok1
-rw-r--r--client/mysqlbinlog.cc7
-rw-r--r--sql/mysql_priv.h2
-rw-r--r--sql/mysqld.cc8
-rw-r--r--sql/set_var.cc10
-rw-r--r--sql/sql_class.h1
-rw-r--r--sql/sql_insert.cc4
7 files changed, 22 insertions, 11 deletions
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok
index 63db9c29c60..0e69c4151b4 100644
--- a/BitKeeper/etc/logging_ok
+++ b/BitKeeper/etc/logging_ok
@@ -46,6 +46,7 @@ jani@rhols221.adsl.netsonic.fi
jani@rhols221.arenanet.fi
jani@ua126d19.elisa.omakaista.fi
jani@ua141d10.elisa.omakaista.fi
+jani@ua72d24.elisa.omakaista.fi
jcole@abel.spaceapes.com
jcole@main.burghcom.com
jcole@mugatu.spaceapes.com
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 1be4b3754d0..9d9a414ad02 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -480,7 +480,7 @@ static void die(const char* fmt, ...)
static void print_version()
{
- printf("%s Ver 2.5 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
+ printf("%s Ver 2.6 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
}
@@ -562,9 +562,12 @@ static int parse_args(int *argc, char*** argv)
static MYSQL* safe_connect()
{
MYSQL *local_mysql = mysql_init(NULL);
+
if(!local_mysql)
die("Failed on mysql_init");
-
+
+ mysql_options(local_mysql, MYSQL_INIT_COMMAND,
+ "/*!32210 SET @@session.max_insert_delayed_threads=0*/");
if (!mysql_real_connect(local_mysql, host, user, pass, 0, port, sock, 0))
die("failed on connect: %s", mysql_error(local_mysql));
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index b3c3c5648bf..2bb6bc7d867 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -688,7 +688,7 @@ extern ulong ha_read_first_count, ha_read_last_count;
extern ulong ha_read_rnd_count, ha_read_rnd_next_count;
extern ulong ha_commit_count, ha_rollback_count,table_cache_size;
extern ulong max_connections,max_connect_errors, connect_timeout;
-extern ulong max_insert_delayed_threads, max_user_connections;
+extern ulong max_user_connections;
extern ulong long_query_count, what_to_log,flush_time,opt_sql_mode;
extern ulong query_buff_size, thread_stack,thread_stack_min;
extern ulong binlog_cache_size, max_binlog_cache_size, open_files_limit;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index b4c5ce33277..8aa57d1dfa2 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -399,7 +399,7 @@ ulong select_range_check_count, select_range_count, select_scan_count;
ulong select_full_range_join_count,select_full_join_count;
ulong specialflag=0,opened_tables=0,created_tmp_tables=0,
created_tmp_disk_tables=0;
-ulong max_connections,max_insert_delayed_threads,max_used_connections,
+ulong max_connections, max_used_connections,
max_connect_errors, max_user_connections = 0;
ulong thread_id=1L,current_pid;
ulong slow_launch_threads = 0;
@@ -1726,7 +1726,8 @@ extern "C" void *signal_hand(void *arg __attribute__((unused)))
This should actually be '+ max_number_of_slaves' instead of +10,
but the +10 should be quite safe.
*/
- init_thr_alarm(max_connections+max_insert_delayed_threads+10);
+ init_thr_alarm(max_connections +
+ global_system_variables.max_insert_delayed_threads + 10);
#if SIGINT != THR_KILL_SIGNAL
if (test_flags & TEST_SIGINT)
{
@@ -3896,7 +3897,8 @@ The minimum value for this variable is 4096.",
REQUIRED_ARG, MAX_CONNECT_ERRORS, 1, ~0L, 0, 1, 0},
{"max_delayed_threads", OPT_MAX_DELAYED_THREADS,
"Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero, which means INSERT DELAYED is not used.",
- (gptr*) &max_insert_delayed_threads, (gptr*) &max_insert_delayed_threads,
+ (gptr*) &global_system_variables.max_insert_delayed_threads,
+ (gptr*) &max_system_variables.max_insert_delayed_threads,
0, GET_ULONG, REQUIRED_ARG, 20, 0, 16384, 0, 1, 0},
{"max_heap_table_size", OPT_MAX_HEP_TABLE_SIZE,
"Don't allow creation of heap tables bigger than this.",
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 9b605cacb97..539109d994c 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -155,8 +155,10 @@ sys_var_long_ptr sys_max_connections("max_connections",
fix_max_connections);
sys_var_long_ptr sys_max_connect_errors("max_connect_errors",
&max_connect_errors);
-sys_var_long_ptr sys_max_delayed_threads("max_delayed_threads",
- &max_insert_delayed_threads,
+sys_var_thd_ulong sys_max_insert_delayed_threads("max_insert_delayed_threads",
+ &SV::max_insert_delayed_threads);
+sys_var_thd_ulong sys_max_delayed_threads("max_delayed_threads",
+ &SV::max_insert_delayed_threads,
fix_max_connections);
sys_var_thd_ulong sys_max_heap_table_size("max_heap_table_size",
&SV::max_heap_table_size);
@@ -381,6 +383,7 @@ sys_var *sys_variables[]=
&sys_max_connect_errors,
&sys_max_connections,
&sys_max_delayed_threads,
+ &sys_max_insert_delayed_threads,
&sys_max_heap_table_size,
&sys_max_join_size,
&sys_max_relay_log_size,
@@ -771,7 +774,8 @@ static void fix_max_relay_log_size(THD *thd, enum_var_type type)
static void fix_max_connections(THD *thd, enum_var_type type)
{
- resize_thr_alarm(max_connections + max_insert_delayed_threads + 10);
+ resize_thr_alarm(max_connections +
+ global_system_variables.max_insert_delayed_threads + 10);
}
diff --git a/sql/sql_class.h b/sql/sql_class.h
index d96c6bb53cc..4a74e3535ad 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -310,6 +310,7 @@ struct system_variables
ulong max_heap_table_size;
ulong max_sort_length;
ulong max_tmp_tables;
+ ulong max_insert_delayed_threads;
ulong myisam_repair_threads;
ulong myisam_sort_buff_size;
ulong net_buffer_length;
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index bf3112bdf10..c2f889c42e3 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -139,7 +139,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
*/
if ((lock_type == TL_WRITE_DELAYED &&
((specialflag & (SPECIAL_NO_NEW_FUNC | SPECIAL_SAFE_MODE)) ||
- thd->slave_thread || !max_insert_delayed_threads)) ||
+ thd->slave_thread || !thd->variables.max_insert_delayed_threads)) ||
(lock_type == TL_WRITE_CONCURRENT_INSERT && duplic == DUP_REPLACE))
lock_type=TL_WRITE;
@@ -655,7 +655,7 @@ static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list)
if (!(tmp=find_handler(thd,table_list)))
{
/* Don't create more than max_insert_delayed_threads */
- if (delayed_insert_threads >= max_insert_delayed_threads)
+ if (delayed_insert_threads >= thd->variables.max_insert_delayed_threads)
DBUG_RETURN(0);
thd->proc_info="Creating delayed handler";
pthread_mutex_lock(&LOCK_delayed_create);