summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <konstantin@mysql.com>2003-12-05 01:29:20 +0300
committerunknown <konstantin@mysql.com>2003-12-05 01:29:20 +0300
commitcea764f387b802152387398ade48dd34d5789348 (patch)
treeeb5f2f31754c7b772f9a3eedc226b389e709eba9 /sql
parent0cc52bc7ca3718215a414c8e8df44e0af43dab9a (diff)
parent1057ca5405f678f3005a26a183a77d74b0906214 (diff)
downloadmariadb-git-cea764f387b802152387398ade48dd34d5789348.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-4.0
into mysql.com:/home/kostja/mysql/mysql-4.0-root
Diffstat (limited to 'sql')
-rw-r--r--sql/repl_failsafe.cc7
-rw-r--r--sql/slave.cc4
-rw-r--r--sql/sql_class.h9
-rw-r--r--sql/sql_insert.cc2
-rw-r--r--sql/sql_parse.cc6
5 files changed, 24 insertions, 4 deletions
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index 8deb23e8586..6b91d81b487 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -52,6 +52,13 @@ static Slave_log_event* find_slave_event(IO_CACHE* log,
const char* log_file_name,
char* errmsg);
+/*
+ All of the functions defined in this file which are not used (the ones to
+ handle failsafe) are not used; their code has not been updated for more than
+ one year now so should be considered as BADLY BROKEN. Do not enable it.
+ The used functions (to handle LOAD DATA FROM MASTER, plus some small
+ functions like register_slave()) are working.
+*/
static int init_failsafe_rpl_thread(THD* thd)
{
diff --git a/sql/slave.cc b/sql/slave.cc
index 5bc31fd6a21..25eeb34e3a7 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -2021,7 +2021,9 @@ improper_arguments: %d timed_out: %d",
static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
{
DBUG_ENTER("init_slave_thread");
- thd->system_thread = thd->bootstrap = 1;
+ thd->system_thread = (thd_type == SLAVE_THD_SQL) ?
+ SYSTEM_THREAD_SLAVE_SQL : SYSTEM_THREAD_SLAVE_IO;
+ thd->bootstrap= 1;
thd->host_or_ip= "";
thd->client_capabilities = 0;
my_net_init(&thd->net, 0);
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 58543a3d230..9287a0c8c79 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -460,7 +460,7 @@ public:
long dbug_thread_id;
pthread_t real_id;
uint current_tablenr,tmp_table,cond_count;
- uint server_status,open_options;
+ uint server_status,open_options,system_thread;
uint32 query_length;
uint32 db_length;
/* variables.transaction_isolation is reset to this after each commit */
@@ -470,7 +470,7 @@ public:
bool set_query_id,locked,count_cuted_fields,some_tables_deleted;
bool no_errors, allow_sum_func, password, fatal_error;
bool query_start_used,last_insert_id_used,insert_id_used,rand_used;
- bool system_thread,in_lock_tables,global_read_lock;
+ bool in_lock_tables,global_read_lock;
bool query_error, bootstrap, cleanup_done;
bool safe_to_cache_query;
bool volatile killed;
@@ -592,6 +592,11 @@ public:
CHANGED_TABLE_LIST * changed_table_dup(const char *key, long key_length);
};
+/* Flags for the THD::system_thread (bitmap) variable */
+#define SYSTEM_THREAD_DELAYED_INSERT 1
+#define SYSTEM_THREAD_SLAVE_IO 2
+#define SYSTEM_THREAD_SLAVE_SQL 4
+
/*
Used to hold information about file and file structure in exchainge
via non-DB file (...INTO OUTFILE..., ...LOAD DATA...)
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 3aefee61c27..3414e76e092 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -550,7 +550,7 @@ public:
thd.command=COM_DELAYED_INSERT;
bzero((char*) &thd.net,sizeof(thd.net)); // Safety
- thd.system_thread=1;
+ thd.system_thread= SYSTEM_THREAD_DELAYED_INSERT;
thd.host_or_ip= "";
bzero((char*) &info,sizeof(info));
pthread_mutex_init(&mutex,MY_MUTEX_INIT_FAST);
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 0789a1768d1..2d40d6fcf36 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2902,6 +2902,12 @@ mysql_init_query(THD *thd)
thd->lex.select_lex.table_list.first=0;
thd->lex.select_lex.table_list.next= (byte**) &thd->lex.select_lex.table_list.first;
thd->lex.select_lex.next=0;
+ /*
+ select_lex.options is also inited in dispatch_command(), but for
+ replication (which bypasses dispatch_command() and calls mysql_parse()
+ directly) we must do it here.
+ */
+ thd->lex.select_lex.options=0;
thd->lex.olap=0;
thd->lex.select->olap= UNSPECIFIED_OLAP_TYPE;
thd->fatal_error=0; // Safety