summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/Makefile.am4
-rw-r--r--sql/ha_innodb.cc11
-rw-r--r--sql/log_event.cc9
-rw-r--r--sql/mysqld.cc14
-rw-r--r--sql/nt_servc.cc2
-rw-r--r--sql/set_var.cc4
-rw-r--r--sql/sql_class.h1
-rw-r--r--sql/sql_parse.cc5
-rw-r--r--sql/sql_repl.cc50
-rw-r--r--sql/sql_yacc.yy6
10 files changed, 78 insertions, 28 deletions
diff --git a/sql/Makefile.am b/sql/Makefile.am
index a589f1379f9..e2494e50d96 100644
--- a/sql/Makefile.am
+++ b/sql/Makefile.am
@@ -114,8 +114,8 @@ sql_yacc.o: sql_yacc.cc sql_yacc.h
$(CXXCOMPILE) $(LM_CFLAGS) -c $<
lex_hash.h: lex.h gen_lex_hash.cc sql_yacc.h
- $(MAKE) gen_lex_hash
- ./gen_lex_hash > $@
+ $(MAKE) gen_lex_hash$(EXEEXT)
+ ./gen_lex_hash$(EXEEXT) > $@
# Hack to ensure that lex_hash.h is built early
sql_lex.o: lex_hash.h
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 795cffc0776..a6528209b3e 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -1863,7 +1863,11 @@ build_template(
if (prebuilt->read_just_key) {
/* MySQL has instructed us that it is enough to
- fetch the columns in the key */
+ fetch the columns in the key; looks like MySQL
+ can set this flag also when there is only a
+ prefix of the column in the key: in that case we
+ retrieve the whole column from the clustered
+ index */
fetch_all_in_key = TRUE;
} else {
@@ -1924,9 +1928,8 @@ build_template(
field = table->field[i];
if (templ_type == ROW_MYSQL_REC_FIELDS
- && !(fetch_all_in_key &&
- ULINT_UNDEFINED != dict_index_get_nth_col_pos(
- index, i))
+ && !(fetch_all_in_key
+ && dict_index_contains_col_or_prefix(index, i))
&& thd->query_id != field->query_id
&& thd->query_id != (field->query_id ^ MAX_ULONG_BIT)
&& thd->query_id !=
diff --git a/sql/log_event.cc b/sql/log_event.cc
index ff968babcf0..727b2052969 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -168,12 +168,15 @@ static void cleanup_load_tmpdir()
uint i;
if (!(dirp=my_dir(slave_load_tmpdir,MYF(MY_WME))))
return;
-
+ char fname[FN_REFLEN];
for (i=0 ; i < (uint)dirp->number_off_files; i++)
{
file=dirp->dir_entry+i;
if (is_prefix(file->name,"SQL_LOAD-"))
- my_delete(file->name, MYF(0));
+ {
+ fn_format(fname,file->name,slave_load_tmpdir,"",0);
+ my_delete(fname, MYF(0));
+ }
}
my_dirend(dirp);
@@ -813,7 +816,7 @@ Rotate_log_event::Rotate_log_event(const char* buf, int event_len,
int Rotate_log_event::write_data(IO_CACHE* file)
{
char buf[ROTATE_HEADER_LEN];
- int8store(buf, pos + R_POS_OFFSET);
+ int8store(buf + R_POS_OFFSET, pos);
return (my_b_safe_write(file, (byte*)buf, ROTATE_HEADER_LEN) ||
my_b_safe_write(file, (byte*)new_log_ident, (uint) ident_len));
}
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 0f3500248c0..5613f1eeb07 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -2322,6 +2322,12 @@ The server will not act as a slave.");
opt_binlog_index_name,LOG_BIN);
using_update_log=1;
}
+ else if (opt_log_slave_updates)
+ {
+ sql_print_error("\
+Warning: you need to use --log-bin to make --log-slave-updates work. \
+Now disabling --log-slave-updates.");
+ }
if (opt_bootstrap)
{
@@ -3179,7 +3185,8 @@ enum options {
OPT_BDB_CACHE_SIZE,
OPT_BDB_LOG_BUFFER_SIZE,
OPT_BDB_MAX_LOCK,
- OPT_ERROR_LOG_FILE
+ OPT_ERROR_LOG_FILE,
+ OPT_DEFAULT_WEEK_FORMAT
};
@@ -3988,6 +3995,11 @@ replicating a LOAD DATA INFILE command",
(gptr*) &global_system_variables.net_wait_timeout,
(gptr*) &max_system_variables.net_wait_timeout, 0, GET_ULONG,
REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
+ { "default-week-format", OPT_DEFAULT_WEEK_FORMAT,
+ "The default week format used by WEEK() functions.",
+ (gptr*) &global_system_variables.default_week_format,
+ (gptr*) &max_system_variables.default_week_format,
+ 0, GET_ULONG, REQUIRED_ARG, 0, 0, 3L, 0, 1, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/sql/nt_servc.cc b/sql/nt_servc.cc
index b917c91ce15..b18d3d00d88 100644
--- a/sql/nt_servc.cc
+++ b/sql/nt_servc.cc
@@ -462,7 +462,7 @@ BOOL NTService::SeekStatus(LPCSTR szInternName, int OperationType)
{
/* a remove operation */
if (!(service = OpenService(scm,szInternName, SERVICE_ALL_ACCESS )))
- printf("The service doesn't exists!\n");
+ printf("The service doesn't exist!\n");
else
{
SERVICE_STATUS ss;
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 1da187598c4..32603ec51d9 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -296,6 +296,8 @@ static sys_var_slave_skip_counter sys_slave_skip_counter("sql_slave_skip_counter
static sys_var_rand_seed1 sys_rand_seed1("rand_seed1");
static sys_var_rand_seed2 sys_rand_seed2("rand_seed2");
+static sys_var_thd_ulong sys_default_week_format("default_week_format",
+ &SV::default_week_format);
/*
List of all variables for initialisation and storage in hash
@@ -316,6 +318,7 @@ sys_var *sys_variables[]=
&sys_bulk_insert_buff_size,
&sys_concurrent_insert,
&sys_connect_timeout,
+ &sys_default_week_format,
&sys_convert_charset,
&sys_delay_key_write,
&sys_delayed_insert_limit,
@@ -421,6 +424,7 @@ struct show_var_st init_vars[]= {
{sys_connect_timeout.name, (char*) &sys_connect_timeout, SHOW_SYS},
{sys_convert_charset.name, (char*) &sys_convert_charset, SHOW_SYS},
{"datadir", mysql_real_data_home, SHOW_CHAR},
+ {"default_week_format", (char*) &sys_default_week_format, SHOW_SYS},
{sys_delay_key_write.name, (char*) &sys_delay_key_write, SHOW_SYS},
{sys_delayed_insert_limit.name, (char*) &sys_delayed_insert_limit,SHOW_SYS},
{sys_delayed_insert_timeout.name, (char*) &sys_delayed_insert_timeout, SHOW_SYS},
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 9857774fb84..a8a24451ecc 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -309,6 +309,7 @@ struct system_variables
ulong tmp_table_size;
ulong tx_isolation;
ulong table_type;
+ ulong default_week_format;
my_bool log_warnings;
my_bool low_priority_updates;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index bb06713ec4c..3b3da6d35b3 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -583,6 +583,11 @@ check_connections(THD *thd)
if (thd->client_capabilities & CLIENT_SSL)
{
/* Do the SSL layering. */
+ if (!ssl_acceptor_fd)
+ {
+ inc_host_errors(&thd->remote.sin_addr);
+ return(ER_HANDSHAKE_ERROR);
+ }
DBUG_PRINT("info", ("IO layer change in progress..."));
if (sslaccept(ssl_acceptor_fd, net->vio, thd->variables.net_wait_timeout))
{
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index e3af076da1f..d0ed1a19d96 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -51,7 +51,7 @@ int check_binlog_magic(IO_CACHE* log, const char** errmsg)
}
static int fake_rotate_event(NET* net, String* packet, char* log_file_name,
- const char**errmsg)
+ ulonglong position, const char**errmsg)
{
char header[LOG_EVENT_HEADER_LEN], buf[ROTATE_HEADER_LEN];
memset(header, 0, 4); // when does not matter
@@ -68,9 +68,12 @@ static int fake_rotate_event(NET* net, String* packet, char* log_file_name,
int4store(header + LOG_POS_OFFSET, 0);
packet->append(header, sizeof(header));
- /* We need to split the next statement because of problem with cxx */
- int4store(buf,4); // tell slave to skip magic number
- int4store(buf+4,0);
+ /*
+ An old comment said talked about a need for splitting the int8store below
+ into 2 int4store because of a problem with cxx; I can't understand that as
+ we already use int8store in Rotatel_log_event::write_data().
+ */
+ int8store(buf+R_POS_OFFSET,position);
packet->append(buf, ROTATE_HEADER_LEN);
packet->append(p,ident_len);
if (my_net_write(net, (char*)packet->ptr(), packet->length()))
@@ -382,17 +385,30 @@ impossible position";
*/
packet->set("\0", 1);
- // if we are at the start of the log
- if (pos == BIN_LOG_HEADER_SIZE)
+ /*
+ Before 4.0.14 we called fake_rotate_event below only if
+ (pos == BIN_LOG_HEADER_SIZE), because if this is false then the slave
+ already knows the binlog's name.
+ Now we always call fake_rotate_event; if the slave already knew the log's
+ name (ex: CHANGE MASTER TO MASTER_LOG_FILE=...) this is useless but does not
+ harm much. It is nice for 3.23 (>=.58) slaves which test Rotate events
+ to see if the master is 4.0 (then they choose to stop because they can't
+ replicate 4.0); by always calling fake_rotate_event we are sure that 3.23.58
+ and newer will detect the problem as soon as replication starts (BUG#198).
+ Always calling fake_rotate_event makes sending of normal
+ (=from-binlog) Rotate events a priori unneeded, but it is not so simple: the
+ 2 Rotate events are not equivalent, the normal one is before the Stop event,
+ the fake one is after. If we don't send the normal one, then the Stop event
+ will be interpreted (by existing 4.0 slaves) as "the master stopped", which
+ is wrong. So for safety, given that we want minimum modification of 4.0, we
+ send the normal and fake Rotates.
+ */
+ if (fake_rotate_event(net, packet, log_file_name, pos, &errmsg))
{
- // tell the client log name with a fake rotate_event
- if (fake_rotate_event(net, packet, log_file_name, &errmsg))
- {
- my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG;
- goto err;
- }
- packet->set("\0", 1);
+ my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG;
+ goto err;
}
+ packet->set("\0", 1);
while (!net->error && net->vio != 0 && !thd->killed)
{
@@ -585,10 +601,12 @@ Increase max_allowed_packet on master";
end_io_cache(&log);
(void) my_close(file, MYF(MY_WME));
- // fake Rotate_log event just in case it did not make it to the log
- // otherwise the slave make get confused about the offset
+ /*
+ Even if the previous log contained a Rotate_log_event, we still fake
+ one.
+ */
if ((file=open_binlog(&log, log_file_name, &errmsg)) < 0 ||
- fake_rotate_event(net, packet, log_file_name, &errmsg))
+ fake_rotate_event(net, packet, log_file_name, BIN_LOG_HEADER_SIZE, &errmsg))
{
my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG;
goto err;
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 4a41ad32dcc..0ff09a52a9e 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -2002,7 +2002,11 @@ simple_expr:
| USER '(' ')'
{ $$= new Item_func_user(); current_thd->safe_to_cache_query=0; }
| WEEK_SYM '(' expr ')'
- { $$= new Item_func_week($3,new Item_int((char*) "0",0,1)); }
+ {
+ LEX *lex=Lex;
+ $$= new Item_func_week($3,new Item_int((char*) "0",
+ lex->thd->variables.default_week_format,1));
+ }
| WEEK_SYM '(' expr ',' expr ')'
{ $$= new Item_func_week($3,$5); }
| YEAR_SYM '(' expr ')'