Commit d1d07c99 authored by unknown's avatar unknown

Indentation cleanups

Remove wait_if_global_read_lock on commit as this can cause deadlocks


BUILD/FINISH.sh:
  Cleanup
BUILD/SETUP.sh:
  Cleanup
BUILD/compile-pentium-valgrind-max:
  Don't write message twice
mysql-test/r/innodb.result:
  Removed failure as this can cause deadlocks
mysql-test/r/rpl_max_relay_size.result:
  Make test repeatable
mysql-test/t/innodb.test:
  Removed failure as this can cause deadlocks
mysql-test/t/rpl_max_relay_size.test:
  Removed failure as this can cause deadlocks
sql/handler.cc:
  Remove wait_if_global_read_lock as this can cause deadlocks
sql/opt_range.cc:
  Indentation cleanup
sql/sql_db.cc:
  Comment cleanup
sql/sql_parse.cc:
  Comment cleanup
sql/sql_repl.cc:
  Indentation cleanup
sql/sql_select.cc:
  Indentation cleanup
parent 44e3cbcf
...@@ -49,7 +49,7 @@ strip sql/mysqld" ...@@ -49,7 +49,7 @@ strip sql/mysqld"
fi fi
fi fi
if test -z "$nonono" if test -z "$just_print"
then then
eval "set -x; $commands" eval "set -x; $commands"
else else
......
...@@ -4,13 +4,13 @@ then ...@@ -4,13 +4,13 @@ then
exit 1 exit 1
fi fi
nonono= just_print=
just_configure= just_configure=
while test $# -gt 0 while test $# -gt 0
do do
case "$1" in case "$1" in
-c | --just-configure ) just_configure=1; shift ;; -c | --just-configure ) just_configure=1; shift ;;
-n | --just-print | --print ) nonono=1; shift ;; -n | --just-print | --print ) just_print=1; shift ;;
-h | --help ) cat <<EOF; exit 0 ;; -h | --help ) cat <<EOF; exit 0 ;;
Usage: $0 [-h|-n] [configure-options] Usage: $0 [-h|-n] [configure-options]
-h, --help Show this help message. -h, --help Show this help message.
......
#! /bin/sh #! /bin/sh
echo "\
********************************************************************************
Note that by default BUILD/compile-pentium-valgrind-max calls 'configure' with
--enable-assembler. When Valgrind detects an error involving an assembly
function (for example an uninitialized value used as an argument of an assembly
function), Valgrind will not print the stacktrace and 'valgrind
--gdb-attach=yes' will not work either. If you need a stacktrace in those cases,
you have to run BUILD/compile-pentium-valgrind-max with the --disable-assembler
argument.
********************************************************************************
"
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"
...@@ -24,14 +12,16 @@ extra_configs="$extra_configs --with-berkeley-db --with-innodb --without-isam -- ...@@ -24,14 +12,16 @@ extra_configs="$extra_configs --with-berkeley-db --with-innodb --without-isam --
. "$path/FINISH.sh" . "$path/FINISH.sh"
echo "\ if test -z "$just_print"
******************************************************************************** then
echo "\
******************************************************************************
Note that by default BUILD/compile-pentium-valgrind-max calls 'configure' with Note that by default BUILD/compile-pentium-valgrind-max calls 'configure' with
--enable-assembler. When Valgrind detects an error involving an assembly --enable-assembler. When Valgrind detects an error involving an assembly
function (for example an uninitialized value used as an argument of an assembly function (for example an uninitialized value used as an argument of an
function), Valgrind will not print the stacktrace and 'valgrind assembly function), Valgrind will not print the stacktrace and 'valgrind
--gdb-attach=yes' will not work either. If you need a stacktrace in those cases, --gdb-attach=yes' will not work either. If you need a stacktrace in those
you have to run BUILD/compile-pentium-valgrind-max with the --disable-assembler cases, you have to run BUILD/compile-pentium-valgrind-max with the
argument. --disable-assembler argument.
******************************************************************************** ******************************************************************************"
" fi
...@@ -256,7 +256,6 @@ start transaction; ...@@ -256,7 +256,6 @@ start transaction;
insert into t1 values (4); insert into t1 values (4);
flush tables with read lock; flush tables with read lock;
commit; commit;
ERROR HY000: Can't execute the query because you have a conflicting read lock
unlock tables; unlock tables;
commit; commit;
select * from t1; select * from t1;
......
...@@ -49,12 +49,12 @@ flush logs; ...@@ -49,12 +49,12 @@ flush logs;
create table t1 (a int); create table t1 (a int);
show slave status; show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
127.0.0.1 root MASTER_PORT 1 master-bin.000001 50535 slave-relay-bin.000009 62 master-bin.000001 Yes Yes 0 0 50535 62 None 0 No 127.0.0.1 root MASTER_PORT 1 master-bin.000001 50535 slave-relay-bin.000009 62 master-bin.000001 Yes Yes 0 0 50535 # None 0 No
flush logs; flush logs;
drop table t1; drop table t1;
show slave status; show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
127.0.0.1 root MASTER_PORT 1 master-bin.000001 50583 slave-relay-bin.000010 52 master-bin.000001 Yes Yes 0 0 50583 52 None 0 No 127.0.0.1 root MASTER_PORT 1 master-bin.000001 50583 slave-relay-bin.000010 52 master-bin.000001 Yes Yes 0 0 50583 # None 0 No
flush logs; flush logs;
show master status; show master status;
File Position Binlog_do_db Binlog_ignore_db File Position Binlog_do_db Binlog_ignore_db
......
...@@ -141,7 +141,9 @@ create table t1 (n int not null primary key) type=innodb; ...@@ -141,7 +141,9 @@ create table t1 (n int not null primary key) type=innodb;
start transaction; start transaction;
insert into t1 values (4); insert into t1 values (4);
flush tables with read lock; flush tables with read lock;
--error 1223; #
# Current code can't handle a read lock in middle of transaction
#--error 1223;
commit; commit;
unlock tables; unlock tables;
commit; commit;
......
...@@ -70,6 +70,7 @@ save_master_pos; ...@@ -70,6 +70,7 @@ save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT
--replace_column 22 #
show slave status; show slave status;
# one more rotation, to be sure Relay_log_space is correctly updated # one more rotation, to be sure Relay_log_space is correctly updated
flush logs; flush logs;
...@@ -79,6 +80,7 @@ save_master_pos; ...@@ -79,6 +80,7 @@ save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT
--replace_column 22 #
show slave status; show slave status;
connection master; connection master;
......
...@@ -359,10 +359,7 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans) ...@@ -359,10 +359,7 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans)
if (trans == &thd->transaction.all && mysql_bin_log.is_open() && if (trans == &thd->transaction.all && mysql_bin_log.is_open() &&
my_b_tell(&thd->transaction.trans_log)) my_b_tell(&thd->transaction.trans_log))
{ {
if (wait_if_global_read_lock(thd, 0))
DBUG_RETURN(1);
mysql_bin_log.write(thd, &thd->transaction.trans_log, 1); mysql_bin_log.write(thd, &thd->transaction.trans_log, 1);
start_waiting_global_read_lock(thd);
reinit_io_cache(&thd->transaction.trans_log, reinit_io_cache(&thd->transaction.trans_log,
WRITE_CACHE, (my_off_t) 0, 0, 1); WRITE_CACHE, (my_off_t) 0, 0, 1);
thd->transaction.trans_log.end_of_file= max_binlog_cache_size; thd->transaction.trans_log.end_of_file= max_binlog_cache_size;
......
...@@ -456,7 +456,7 @@ SEL_ARG *SEL_ARG::clone(SEL_ARG *new_parent,SEL_ARG **next_arg) ...@@ -456,7 +456,7 @@ SEL_ARG *SEL_ARG::clone(SEL_ARG *new_parent,SEL_ARG **next_arg)
SEL_ARG *tmp; SEL_ARG *tmp;
if (type != KEY_RANGE) if (type != KEY_RANGE)
{ {
if(!(tmp=new SEL_ARG(type))) if (!(tmp=new SEL_ARG(type)))
return 0; // out of memory return 0; // out of memory
tmp->prev= *next_arg; // Link into next/prev chain tmp->prev= *next_arg; // Link into next/prev chain
(*next_arg)->next=tmp; (*next_arg)->next=tmp;
...@@ -464,7 +464,7 @@ SEL_ARG *SEL_ARG::clone(SEL_ARG *new_parent,SEL_ARG **next_arg) ...@@ -464,7 +464,7 @@ SEL_ARG *SEL_ARG::clone(SEL_ARG *new_parent,SEL_ARG **next_arg)
} }
else else
{ {
if(!(tmp=new SEL_ARG(field,part, min_value,max_value, if (!(tmp=new SEL_ARG(field,part, min_value,max_value,
min_flag, max_flag, maybe_flag))) min_flag, max_flag, maybe_flag)))
return 0; // out of memory return 0; // out of memory
tmp->parent=new_parent; tmp->parent=new_parent;
...@@ -920,7 +920,7 @@ get_mm_parts(PARAM *param, Field *field, Item_func::Functype type, ...@@ -920,7 +920,7 @@ get_mm_parts(PARAM *param, Field *field, Item_func::Functype type,
} }
else { else {
// This key may be used later // This key may be used later
if(!(sel_arg=new SEL_ARG(SEL_ARG::MAYBE_KEY))) if (!(sel_arg=new SEL_ARG(SEL_ARG::MAYBE_KEY)))
DBUG_RETURN(0); // out of memory DBUG_RETURN(0); // out of memory
} }
sel_arg->part=(uchar) key_part->part; sel_arg->part=(uchar) key_part->part;
...@@ -1488,7 +1488,7 @@ key_or(SEL_ARG *key1,SEL_ARG *key2) ...@@ -1488,7 +1488,7 @@ key_or(SEL_ARG *key1,SEL_ARG *key2)
SEL_ARG *key2_next=key2->next; SEL_ARG *key2_next=key2->next;
if (key2_shared) if (key2_shared)
{ {
if(!(key2=new SEL_ARG(*key2))) if (!(key2=new SEL_ARG(*key2)))
return 0; // out of memory return 0; // out of memory
key2->increment_use_count(key1->use_count+1); key2->increment_use_count(key1->use_count+1);
key2->next=key2_next; // New copy of key2 key2->next=key2_next; // New copy of key2
...@@ -2333,7 +2333,7 @@ get_quick_keys(PARAM *param,QUICK_SELECT *quick,KEY_PART *key, ...@@ -2333,7 +2333,7 @@ get_quick_keys(PARAM *param,QUICK_SELECT *quick,KEY_PART *key,
} }
/* Get range for retrieving rows in QUICK_SELECT::get_next */ /* Get range for retrieving rows in QUICK_SELECT::get_next */
if(!(range= new QUICK_RANGE(param->min_key, if (!(range= new QUICK_RANGE(param->min_key,
(uint) (tmp_min_key - param->min_key), (uint) (tmp_min_key - param->min_key),
param->max_key, param->max_key,
(uint) (tmp_max_key - param->max_key), (uint) (tmp_max_key - param->max_key),
......
...@@ -393,16 +393,16 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) ...@@ -393,16 +393,16 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
start_waiting_global_read_lock(thd); start_waiting_global_read_lock(thd);
/* /*
If this database was the client's selected database, we silently change the If this database was the client's selected database, we silently change the
client's selected database to nothing (to have an empty SELECT DATABASE() in client's selected database to nothing (to have an empty SELECT DATABASE()
the future). For this we free() thd->db and set it to 0. But we don't do in the future). For this we free() thd->db and set it to 0. But we don't do
free() for the slave thread. Indeed, doing a x_free() on it leads to nasty free() for the slave thread. Indeed, doing a x_free() on it leads to nasty
problems (i.e. long painful debugging) because in this thread, thd->db is problems (i.e. long painful debugging) because in this thread, thd->db is
the same as data_buf and db of the Query_log_event which is dropping the the same as data_buf and db of the Query_log_event which is dropping the
database. So if you free() thd->db, you're freeing data_buf. You set thd->db database. So if you free() thd->db, you're freeing data_buf. You set
to 0 but not data_buf (thd->db and data_buf are two distinct pointers which thd->db to 0 but not data_buf (thd->db and data_buf are two distinct
point to the same place). Then in ~Query_log_event(), we have pointers which point to the same place). Then in ~Query_log_event(), we
'if (data_buf) free(data_buf)' have 'if (data_buf) free(data_buf)' data_buf is !=0 so this makes a
data_buf is !=0 so this makes a DOUBLE free(). DOUBLE free().
Side effects of this double free() are, randomly (depends on the machine), Side effects of this double free() are, randomly (depends on the machine),
when the slave is replicating a DROP DATABASE: when the slave is replicating a DROP DATABASE:
- garbage characters in the error message: - garbage characters in the error message:
......
...@@ -4449,7 +4449,10 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables, ...@@ -4449,7 +4449,10 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
{ {
if ((options & REFRESH_READ_LOCK) && thd) if ((options & REFRESH_READ_LOCK) && thd)
{ {
// writing to the binlog could cause deadlocks, as we don't log UNLOCK TABLES /*
Writing to the binlog could cause deadlocks, as we don't log
UNLOCK TABLES
*/
tmp_write_to_binlog= 0; tmp_write_to_binlog= 0;
if (lock_global_read_lock(thd)) if (lock_global_read_lock(thd))
return 1; return 1;
......
...@@ -730,7 +730,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report) ...@@ -730,7 +730,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
to p, no digits were found, error. If it contains '\0' it to p, no digits were found, error. If it contains '\0' it
means conversion went ok. means conversion went ok.
*/ */
if(p_end==p || *p_end) if (p_end==p || *p_end)
slave_errno=ER_BAD_SLAVE_UNTIL_COND; slave_errno=ER_BAD_SLAVE_UNTIL_COND;
} }
else else
...@@ -753,7 +753,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report) ...@@ -753,7 +753,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
ER(ER_UNTIL_COND_IGNORED)); ER(ER_UNTIL_COND_IGNORED));
if(!slave_errno) if (!slave_errno)
slave_errno = start_slave_threads(0 /*no mutex */, slave_errno = start_slave_threads(0 /*no mutex */,
1 /* wait for start */, 1 /* wait for start */,
mi, mi,
......
...@@ -5333,7 +5333,7 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure) ...@@ -5333,7 +5333,7 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure)
HAVING will be chcked after processing aggregate functions, HAVING will be chcked after processing aggregate functions,
But WHERE should checkd here (we alredy have read tables) But WHERE should checkd here (we alredy have read tables)
*/ */
if(!join->conds || join->conds->val_int()) if (!join->conds || join->conds->val_int())
{ {
if (!(error=(*end_select)(join,join_tab,0)) || error == -3) if (!(error=(*end_select)(join,join_tab,0)) || error == -3)
error=(*end_select)(join,join_tab,1); error=(*end_select)(join,join_tab,1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment