diff options
author | unknown <monty@narttu.mysql.fi> | 2003-07-03 11:56:30 +0300 |
---|---|---|
committer | unknown <monty@narttu.mysql.fi> | 2003-07-03 11:56:30 +0300 |
commit | a9df65e595d6beda3057c9ef37dc3700379500a1 (patch) | |
tree | 95e4a764cfe8f03084d7c19f157c57a699ed4536 /sql | |
parent | 2373397e13d4004816b61df38a234906eb361e0d (diff) | |
parent | adcd7be93515460327127e189a7b5ca5b63f232e (diff) | |
download | mariadb-git-a9df65e595d6beda3057c9ef37dc3700379500a1.tar.gz |
Merge bk-internal.mysql.com:/home/bk/mysql-4.0
into narttu.mysql.fi:/my/mysql-4.0
mysql-test/r/innodb.result:
Auto merged
mysql-test/t/innodb.test:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_cmpfunc.cc | 2 | ||||
-rw-r--r-- | sql/mysqld.cc | 2 | ||||
-rw-r--r-- | sql/slave.cc | 31 | ||||
-rw-r--r-- | sql/slave.h | 2 | ||||
-rw-r--r-- | sql/sql_acl.cc | 6 | ||||
-rw-r--r-- | sql/sql_lex.cc | 2 | ||||
-rw-r--r-- | sql/sql_parse.cc | 3 | ||||
-rw-r--r-- | sql/sql_repl.cc | 27 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 6 |
9 files changed, 67 insertions, 14 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 78a63d84c61..5d47fa302f3 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -46,7 +46,7 @@ longlong Item_func_not::val_int() static bool convert_constant_item(Field *field, Item **item) { - if ((*item)->const_item() && (*item)->type() != Item::INT_ITEM) + if ((*item)->const_item()) { if (!(*item)->save_in_field(field, 1) && !((*item)->null_value)) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index f27ba435729..4f6f55bce0b 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2293,6 +2293,8 @@ int main(int argc, char **argv) if (!opt_noacl) udf_init(); #endif + if (opt_bootstrap) /* If running with bootstrap, do not start replication. */ + opt_skip_slave_start= 1; /* init_slave() must be called after the thread keys are created */ init_slave(); diff --git a/sql/slave.cc b/sql/slave.cc index 851c6ba4f02..aa9dd14b1c7 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1424,6 +1424,12 @@ static int count_relay_log_space(RELAY_LOG_INFO* rli) if (add_relay_log(rli,&linfo)) DBUG_RETURN(1); } while (!rli->relay_log.find_next_log(&linfo, 1)); + /* + As we have counted everything, including what may have written in a + preceding write, we must reset bytes_written, or we may count some space + twice. + */ + rli->relay_log.reset_bytes_written(); DBUG_RETURN(0); } @@ -1710,8 +1716,8 @@ st_relay_log_info::st_relay_log_info() last_slave_error[0]=0; - bzero(&info_file,sizeof(info_file)); - bzero(&cache_buf, sizeof(cache_buf)); + bzero((char *)&info_file,sizeof(info_file)); + bzero((char *)&cache_buf, sizeof(cache_buf)); pthread_mutex_init(&run_lock, MY_MUTEX_INIT_FAST); pthread_mutex_init(&data_lock, MY_MUTEX_INIT_FAST); pthread_mutex_init(&log_space_lock, MY_MUTEX_INIT_FAST); @@ -3213,8 +3219,25 @@ Log_event* next_event(RELAY_LOG_INFO* rli) hot_log=0; // Using old binary log } } - DBUG_ASSERT(my_b_tell(cur_log) >= BIN_LOG_HEADER_SIZE); - DBUG_ASSERT(my_b_tell(cur_log) == rli->relay_log_pos + rli->pending); +#ifndef DBUG_OFF + { + DBUG_ASSERT(my_b_tell(cur_log) >= BIN_LOG_HEADER_SIZE); + /* The next assertion sometimes (very rarely) fails, let's try to track it */ + char llbuf1[22], llbuf2[22]; + /* Merging man, please be careful with this; in 4.1, the assertion below is + replaced by + DBUG_ASSERT(my_b_tell(cur_log) == rli->event_relay_log_pos); + so you should not merge blindly (fortunately it won't build then), and + instead modify the merged code. Thanks. */ + DBUG_PRINT("info", ("Before assert, my_b_tell(cur_log)=%s \ +rli->relay_log_pos=%s rli->pending=%lu", + llstr(my_b_tell(cur_log),llbuf1), + llstr(rli->relay_log_pos,llbuf2), + rli->pending)); + DBUG_ASSERT(my_b_tell(cur_log) == rli->relay_log_pos + rli->pending); + } +#endif + /* Relay log is always in new format - if the master is 3.23, the I/O thread will convert the format for us diff --git a/sql/slave.h b/sql/slave.h index 66000f45e69..6a73c86d304 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -282,7 +282,7 @@ typedef struct st_master_info abort_slave(0),slave_running(0), slave_run_id(0) { host[0] = 0; user[0] = 0; password[0] = 0; - bzero(&file, sizeof(file)); + bzero((char *)&file, sizeof(file)); pthread_mutex_init(&run_lock, MY_MUTEX_INIT_FAST); pthread_mutex_init(&data_lock, MY_MUTEX_INIT_FAST); pthread_cond_init(&data_cond, NULL); diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 90497cc8b43..697b5d8ffd6 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -275,7 +275,7 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables) else { user.ssl_type=SSL_TYPE_NONE; - bzero(&(user.user_resource),sizeof(user.user_resource)); + bzero((char *)&(user.user_resource),sizeof(user.user_resource)); #ifndef TO_BE_REMOVED if (table->fields <= 13) { // Without grant @@ -506,7 +506,7 @@ ulong acl_getroot(THD *thd, const char *host, const char *ip, const char *user, *priv_user=(char*) user; DBUG_ENTER("acl_getroot"); - bzero(mqh,sizeof(USER_RESOURCES)); + bzero((char *)mqh,sizeof(USER_RESOURCES)); if (!initialized) { // If no data allow anything @@ -2250,7 +2250,7 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list, if (!initialized) { send_error(&(thd->net), ER_UNKNOWN_COM_ERROR); /* purecov: tested */ - return 1; /* purecov: tested */ + DBUG_RETURN(1); /* purecov: tested */ } if (lower_case_table_names && db) diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index d5a225d95dd..d62edf83c11 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -152,7 +152,7 @@ LEX *lex_start(THD *thd, uchar *buf,uint length) lex->ignore_space=test(thd->sql_mode & MODE_IGNORE_SPACE); lex->slave_thd_opt=0; lex->sql_command=SQLCOM_END; - bzero(&lex->mi,sizeof(lex->mi)); + bzero((char *)&lex->mi,sizeof(lex->mi)); return lex; } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index fef74262d22..f5ecb98b3be 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1160,7 +1160,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd, pos = uint4korr(packet); flags = uint2korr(packet + 4); thd->server_id=0; /* avoid suicide */ - kill_zombie_dump_threads(slave_server_id = uint4korr(packet+6)); + if ((slave_server_id= uint4korr(packet+6))) // mysqlbinlog.server_id==0 + kill_zombie_dump_threads(slave_server_id); thd->server_id = slave_server_id; mysql_binlog_send(thd, thd->strdup(packet + 10), (my_off_t) pos, flags); unregister_slave(thd,1,1); diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index ae9bd8b7727..8fb82798a45 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -522,6 +522,11 @@ Increase max_allowed_packet on master"; case LOG_READ_EOF: DBUG_PRINT("wait",("waiting for data in binary log")); + if (thd->server_id==0) // for mysqlbinlog (mysqlbinlog.server_id==0) + { + pthread_mutex_unlock(log_lock); + goto end; + } if (!thd->killed) { /* Note that the following call unlocks lock_log */ @@ -611,6 +616,7 @@ Increase max_allowed_packet on master"; } } +end: end_io_cache(&log); (void)my_close(file, MYF(MY_WME)); @@ -621,7 +627,7 @@ Increase max_allowed_packet on master"; pthread_mutex_unlock(&LOCK_thread_count); DBUG_VOID_RETURN; - err: +err: thd->proc_info = "waiting to finalize termination"; end_io_cache(&log); /* @@ -790,6 +796,25 @@ err: DBUG_RETURN(error); } +/* + + Kill all Binlog_dump threads which previously talked to the same slave + ("same" means with the same server id). Indeed, if the slave stops, if the + Binlog_dump thread is waiting (pthread_cond_wait) for binlog update, then it + will keep existing until a query is written to the binlog. If the master is + idle, then this could last long, and if the slave reconnects, we could have 2 + Binlog_dump threads in SHOW PROCESSLIST, until a query is written to the + binlog. To avoid this, when the slave reconnects and sends COM_BINLOG_DUMP, + the master kills any existing thread with the slave's server id (if this id is + not zero; it will be true for real slaves, but false for mysqlbinlog when it + sends COM_BINLOG_DUMP to get a remote binlog dump). + + SYNOPSIS + kill_zombie_dump_threads() + slave_server_id the slave's server id + +*/ + void kill_zombie_dump_threads(uint32 slave_server_id) { diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 94beff074c5..b07dca91a20 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -762,7 +762,7 @@ create: lex->create_info.db_type= (enum db_type) lex->thd->variables.table_type; } create2 - {} + {Lex->select= &Lex->select_lex;} | CREATE opt_unique_or_fulltext INDEX ident ON table_ident { LEX *lex=Lex; @@ -2587,6 +2587,7 @@ insert: opt_ignore insert2 { set_lock_for_tables($3); + Lex->select= &Lex->select_lex; } insert_field_spec {} @@ -2602,6 +2603,7 @@ replace: replace_lock_option insert2 { set_lock_for_tables($3); + Lex->select= &Lex->select_lex; } insert_field_spec {} @@ -3685,7 +3687,7 @@ grant: lex->select->db= 0; lex->ssl_type= SSL_TYPE_NOT_SPECIFIED; lex->ssl_cipher= lex->x509_subject= lex->x509_issuer= 0; - bzero(&(lex->mqh),sizeof(lex->mqh)); + bzero((char *)&(lex->mqh),sizeof(lex->mqh)); } grant_privileges ON opt_table TO_SYM user_list require_clause grant_options |