summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--myisam/mi_delete.c4
-rw-r--r--myisam/mi_delete_table.c3
-rw-r--r--myisam/mi_extra.c3
-rw-r--r--myisam/mi_locking.c3
-rw-r--r--myisam/mi_log.c1
-rw-r--r--myisam/mi_page.c3
-rw-r--r--myisam/mi_rename.c3
-rw-r--r--myisam/mi_update.c5
-rw-r--r--myisam/mi_write.c4
-rw-r--r--mysql-test/r/rpl_until.result2
-rw-r--r--mysql-test/r/subselect.result4
-rw-r--r--mysql-test/t/rpl_until.test6
-rw-r--r--mysys/charset.c14
-rw-r--r--sql/item_cmpfunc.cc15
-rw-r--r--sql/item_cmpfunc.h6
-rw-r--r--sql/mysqld.cc2
-rw-r--r--sql/set_var.cc10
-rw-r--r--sql/slave.cc2
-rw-r--r--sql/slave.h5
-rw-r--r--sql/sql_acl.cc2
-rw-r--r--sql/sql_select.cc21
21 files changed, 46 insertions, 72 deletions
diff --git a/myisam/mi_delete.c b/myisam/mi_delete.c
index a55d5b2a5ca..19cfc050ea1 100644
--- a/myisam/mi_delete.c
+++ b/myisam/mi_delete.c
@@ -20,10 +20,6 @@
#include "rt_index.h"
#include <assert.h>
-#ifdef __WIN__
-#include <errno.h>
-#endif
-
static int d_search(MI_INFO *info,MI_KEYDEF *keyinfo,uint comp_flag,
uchar *key,uint key_length,my_off_t page,uchar *anc_buff);
static int del(MI_INFO *info,MI_KEYDEF *keyinfo,uchar *key,uchar *anc_buff,
diff --git a/myisam/mi_delete_table.c b/myisam/mi_delete_table.c
index 6d842d7e6a4..6843881568d 100644
--- a/myisam/mi_delete_table.c
+++ b/myisam/mi_delete_table.c
@@ -19,9 +19,6 @@
*/
#include "fulltext.h"
-#ifdef __WIN__
-#include <errno.h>
-#endif
int mi_delete_table(const char *name)
{
diff --git a/myisam/mi_extra.c b/myisam/mi_extra.c
index 10f52f1e39a..ce072d7d57e 100644
--- a/myisam/mi_extra.c
+++ b/myisam/mi_extra.c
@@ -18,9 +18,6 @@
#ifdef HAVE_MMAP
#include <sys/mman.h>
#endif
-#ifdef __WIN__
-#include <errno.h>
-#endif
/*
Set options and buffers to optimize table handling
diff --git a/myisam/mi_locking.c b/myisam/mi_locking.c
index 67ccca52d08..816748d459a 100644
--- a/myisam/mi_locking.c
+++ b/myisam/mi_locking.c
@@ -22,9 +22,6 @@
*/
#include "myisamdef.h"
-#ifdef __WIN__
-#include <errno.h>
-#endif
/* lock table by F_UNLCK, F_RDLCK or F_WRLCK */
diff --git a/myisam/mi_log.c b/myisam/mi_log.c
index 1dcfd5250d2..13842c56828 100644
--- a/myisam/mi_log.c
+++ b/myisam/mi_log.c
@@ -21,7 +21,6 @@
#include "myisamdef.h"
#if defined(MSDOS) || defined(__WIN__)
-#include <errno.h>
#include <fcntl.h>
#ifndef __WIN__
#include <process.h>
diff --git a/myisam/mi_page.c b/myisam/mi_page.c
index c70209c2da6..16713c87e10 100644
--- a/myisam/mi_page.c
+++ b/myisam/mi_page.c
@@ -17,9 +17,6 @@
/* Read and write key blocks */
#include "myisamdef.h"
-#ifdef __WIN__
-#include <errno.h>
-#endif
/* Fetch a key-page in memory */
diff --git a/myisam/mi_rename.c b/myisam/mi_rename.c
index db44b8fe28f..8380ee1bfad 100644
--- a/myisam/mi_rename.c
+++ b/myisam/mi_rename.c
@@ -19,9 +19,6 @@
*/
#include "fulltext.h"
-#ifdef __WIN__
-#include <errno.h>
-#endif
int mi_rename(const char *old_name, const char *new_name)
{
diff --git a/myisam/mi_update.c b/myisam/mi_update.c
index d1d41ac351a..f62be133ed9 100644
--- a/myisam/mi_update.c
+++ b/myisam/mi_update.c
@@ -19,11 +19,6 @@
#include "fulltext.h"
#include "rt_index.h"
-#ifdef __WIN__
-#include <errno.h>
-#endif
-
-
int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec)
{
int flag,key_changed,save_errno;
diff --git a/myisam/mi_write.c b/myisam/mi_write.c
index 060d4431de6..88e7f070642 100644
--- a/myisam/mi_write.c
+++ b/myisam/mi_write.c
@@ -20,10 +20,6 @@
#include "rt_index.h"
#include <assert.h>
-#ifdef __WIN__
-#include <errno.h>
-#endif
-
#define MAX_POINTER_LENGTH 8
/* Functions declared in this file */
diff --git a/mysql-test/r/rpl_until.result b/mysql-test/r/rpl_until.result
index c179351551d..82b1ed233ec 100644
--- a/mysql-test/r/rpl_until.result
+++ b/mysql-test/r/rpl_until.result
@@ -31,7 +31,7 @@ n
4
show slave status;
Slave_IO_State 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 Seconds_Behind_Master
-# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 332 master-bin.000001 Yes No 0 0 244 649 Master master-bin.000001 244 No #
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 # master-bin.000001 Yes No 0 0 244 # Master master-bin.000001 244 No #
start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
select * from t1;
n
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index ded98265a1c..32e7e09fdb3 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -1340,8 +1340,8 @@ a
explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 index NULL a 5 NULL 4 Using where; Using index
-2 DEPENDENT SUBQUERY t3 index a a 5 NULL 3 Using index
-2 DEPENDENT SUBQUERY t1 ref a a 10 func,test.t3.a 1000 Using where; Using index
+2 DEPENDENT SUBQUERY t1 ref a a 5 func 1001 Using where; Using index
+2 DEPENDENT SUBQUERY t3 index a a 5 NULL 3 Using where; Using index
Warnings:
Note 1003 select high_priority test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(select 1 AS `Not_used` from test.t1 join test.t3 where ((test.t1.b = test.t3.a) and (<cache>(test.t2.a) = test.t1.a)) limit 1))
insert into t1 values (3,31);
diff --git a/mysql-test/t/rpl_until.test b/mysql-test/t/rpl_until.test
index 9bc4ea4e7b1..4508fbea194 100644
--- a/mysql-test/t/rpl_until.test
+++ b/mysql-test/t/rpl_until.test
@@ -29,7 +29,7 @@ sleep 2;
# here table should be still not deleted
select * from t1;
--replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 33 #
+--replace_column 1 # 9 # 23 # 33 #
show slave status;
# this should fail right after start
@@ -59,9 +59,9 @@ stop slave;
# this should stop immideately
start slave until master_log_file='master-bin.000001', master_log_pos=561;
-sleep 2;
+--real-sleep 2;
# here the sql slave thread should be stopped
---replace_result $MASTER_MYPORT MASTER_MYPORT
+--replace_result $MASTER_MYPORT MASTER_MYPORT bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
--replace_column 1 # 9 # 23 # 33 #
show slave status;
diff --git a/mysys/charset.c b/mysys/charset.c
index 40a026f161f..c0d8b183c17 100644
--- a/mysys/charset.c
+++ b/mysys/charset.c
@@ -538,15 +538,17 @@ static CHARSET_INFO *get_internal_charset(uint cs_number, myf flags)
*/
pthread_mutex_lock(&THR_LOCK_charset);
- cs= all_charsets[cs_number];
-
- if (cs && !(cs->state & MY_CS_COMPILED) && !(cs->state & MY_CS_LOADED))
+ if ((cs= all_charsets[cs_number]))
{
- strxmov(get_charsets_dir(buf), cs->csname, ".xml", NullS);
- my_read_charset_file(buf,flags);
+ if (!(cs->state & MY_CS_COMPILED) && !(cs->state & MY_CS_LOADED))
+ {
+ strxmov(get_charsets_dir(buf), cs->csname, ".xml", NullS);
+ my_read_charset_file(buf,flags);
+ }
+ cs= (cs->state & MY_CS_AVAILABLE) ? cs : NULL;
}
- cs= (cs && cs->state & MY_CS_AVAILABLE) ? cs : NULL;
pthread_mutex_unlock(&THR_LOCK_charset);
+ pthread_mutex_unlock(&THR_LOCK_charset);
return cs;
}
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index a79ef21e97a..5b27091321c 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1658,26 +1658,19 @@ Item_cond::Item_cond(THD *thd, Item_cond &item)
and_tables_cache(item.and_tables_cache)
{
/*
- here should be following text:
-
- List_iterator_fast<Item*> li(item.list);
- while(Item *it= li++)
- list.push_back(it);
-
- but it do not need,
- because this constructor used only for AND/OR and
- argument list will be copied by copy_andor_arguments call
+ item->list will be copied by copy_andor_arguments() call
*/
-
}
+
void Item_cond::copy_andor_arguments(THD *thd, Item_cond *item)
{
List_iterator_fast<Item> li(item->list);
- while(Item *it= li++)
+ while (Item *it= li++)
list.push_back(it->copy_andor_structure(thd));
}
+
bool
Item_cond::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
{
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 541bc47557d..f5cd608ebad 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -919,8 +919,8 @@ public:
Item* copy_andor_structure(THD *thd)
{
Item_cond_and *item;
- if((item= new Item_cond_and(thd, *this)))
- item->copy_andor_arguments(thd, this);
+ if ((item= new Item_cond_and(thd, *this)))
+ item->copy_andor_arguments(thd, this);
return item;
}
Item *neg_transformer();
@@ -940,7 +940,7 @@ public:
Item* copy_andor_structure(THD *thd)
{
Item_cond_or *item;
- if((item= new Item_cond_or(thd, *this)))
+ if ((item= new Item_cond_or(thd, *this)))
item->copy_andor_arguments(thd, this);
return item;
}
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index e81113f6111..6387e99ca05 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -4619,7 +4619,7 @@ The minimum value for this variable is 4096.",
(gptr*) &max_system_variables.net_wait_timeout, 0, GET_ULONG,
REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
{"expire_logs_days", OPT_EXPIRE_LOGS_DAYS,
- "Logs will be rotated after expire-log-days days ",
+ "Binary logs will be rotated after expire-log-days days ",
(gptr*) &expire_logs_days,
(gptr*) &expire_logs_days, 0, GET_ULONG,
REQUIRED_ARG, 0, 0, 99, 0, 1, 0},
diff --git a/sql/set_var.cc b/sql/set_var.cc
index c8b11eb0f58..ecb85440068 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -2629,11 +2629,6 @@ ulong fix_sql_mode(ulong sql_mode)
MODE_IGNORE_SPACE |
MODE_NO_KEY_OPTIONS | MODE_NO_TABLE_OPTIONS |
MODE_NO_FIELD_OPTIONS);
- if (sql_mode & MODE_MSSQL)
- sql_mode|= (MODE_PIPES_AS_CONCAT | MODE_ANSI_QUOTES |
- MODE_IGNORE_SPACE |
- MODE_NO_KEY_OPTIONS | MODE_NO_TABLE_OPTIONS |
- MODE_NO_FIELD_OPTIONS);
if (sql_mode & MODE_POSTGRESQL)
sql_mode|= (MODE_PIPES_AS_CONCAT | MODE_ANSI_QUOTES |
MODE_IGNORE_SPACE |
@@ -2644,11 +2639,6 @@ ulong fix_sql_mode(ulong sql_mode)
MODE_IGNORE_SPACE |
MODE_NO_KEY_OPTIONS | MODE_NO_TABLE_OPTIONS |
MODE_NO_FIELD_OPTIONS);
- if (sql_mode & MODE_DB2)
- sql_mode|= (MODE_PIPES_AS_CONCAT | MODE_ANSI_QUOTES |
- MODE_IGNORE_SPACE |
- MODE_NO_KEY_OPTIONS | MODE_NO_TABLE_OPTIONS |
- MODE_NO_FIELD_OPTIONS);
if (sql_mode & MODE_MAXDB)
sql_mode|= (MODE_PIPES_AS_CONCAT | MODE_ANSI_QUOTES |
MODE_IGNORE_SPACE |
diff --git a/sql/slave.cc b/sql/slave.cc
index 8af38624df6..968293369a8 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -2682,7 +2682,7 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
rli->is_until_satisfied())
{
sql_print_error("Slave SQL thread stopped because it reached its"
- " UNTIL position");
+ " UNTIL position %ld", (long) rli->until_pos());
/*
Setting abort_slave flag because we do not want additional message about
error in query execution to be printed.
diff --git a/sql/slave.h b/sql/slave.h
index e42b93a47ef..d92c44dd2ba 100644
--- a/sql/slave.h
+++ b/sql/slave.h
@@ -324,6 +324,11 @@ typedef struct st_relay_log_info
/* Check if UNTIL condition is satisfied. See slave.cc for more. */
bool is_until_satisfied();
+ inline ulonglong until_pos()
+ {
+ return ((until_condition == UNTIL_MASTER_POS) ? group_master_log_pos :
+ group_relay_log_pos);
+ }
} RELAY_LOG_INFO;
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 282a9afa038..f2e7819a51f 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -2543,7 +2543,7 @@ my_bool grant_init(THD *org_thd)
do
{
GRANT_TABLE *mem_check;
- if (!(mem_check=new GRANT_TABLE(t_table,c_table)) || mem_check->ok())
+ if (!(mem_check=new GRANT_TABLE(t_table,c_table)) || !mem_check->ok())
{
/* This could only happen if we are out memory */
grant_option= FALSE; /* purecov: deadcode */
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 5c632e686db..75a94995830 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -2689,22 +2689,35 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
do
{
uint keypart=keyuse->keypart;
- uint found_part_ref_or_null= KEY_OPTIMIZE_REF_OR_NULL;
+ table_map best_part_found_ref= 0;
+ double best_prev_record_reads= DBL_MAX;
do
{
if (!(rest_tables & keyuse->used_tables) &&
!(found_ref_or_null & keyuse->optimize))
{
found_part|=keyuse->keypart_map;
- found_ref|= keyuse->used_tables;
+ double tmp= prev_record_reads(join,
+ (found_ref |
+ keyuse->used_tables));
+ if (tmp < best_prev_record_reads)
+ {
+ best_part_found_ref= keyuse->used_tables;
+ best_prev_record_reads= tmp;
+ }
if (rec > keyuse->ref_table_rows)
rec= keyuse->ref_table_rows;
- found_part_ref_or_null&= keyuse->optimize;
+ /*
+ If there is one 'key_column IS NULL' expression, we can
+ use this ref_or_null optimsation of this field
+ */
+ found_ref_or_null|= (keyuse->optimize &
+ KEY_OPTIMIZE_REF_OR_NULL);
}
keyuse++;
- found_ref_or_null|= found_part_ref_or_null;
} while (keyuse->table == table && keyuse->key == key &&
keyuse->keypart == keypart);
+ found_ref|= best_part_found_ref;
} while (keyuse->table == table && keyuse->key == key);
/*