Commit afe15478 authored by gluh@gluh.mysql.r18.ru's avatar gluh@gluh.mysql.r18.ru

Merge sgluhov@bk-internal.mysql.com:/home/bk/mysql-4.0

into gluh.mysql.r18.ru:/home/gluh/mysql-4.0.defweek
parents 289d375f e2efb08c
......@@ -44,6 +44,7 @@ jorge@linux.jorge.mysql.com
kaj@work.mysql.com
lenz@kallisto.mysql.com
lenz@mysql.com
miguel@hegel.(none)
miguel@hegel.br
miguel@hegel.local
miguel@light.
......
......@@ -396,8 +396,8 @@ static int check_header(IO_CACHE* file)
if (buf[4] == START_EVENT)
{
uint event_len;
event_len = uint4korr(buf + 4);
old_format = (event_len < LOG_EVENT_HEADER_LEN + START_HEADER_LEN);
event_len = uint4korr(buf + EVENT_LEN_OFFSET);
old_format = (event_len < (LOG_EVENT_HEADER_LEN + START_HEADER_LEN));
}
}
my_b_seek(file, pos);
......
......@@ -494,6 +494,46 @@ dict_index_get_nth_col_pos(
return(ULINT_UNDEFINED);
}
/************************************************************************
Returns TRUE if the index contains a column or a prefix of that column. */
ibool
dict_index_contains_col_or_prefix(
/*==============================*/
/* out: TRUE if contains the column or its
prefix */
dict_index_t* index, /* in: index */
ulint n) /* in: column number */
{
dict_field_t* field;
dict_col_t* col;
ulint pos;
ulint n_fields;
ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
if (index->type & DICT_CLUSTERED) {
return(TRUE);
}
col = dict_table_get_nth_col(index->table, n);
n_fields = dict_index_get_n_fields(index);
for (pos = 0; pos < n_fields; pos++) {
field = dict_index_get_nth_field(index, pos);
if (col == field->col) {
return(TRUE);
}
}
return(FALSE);
}
/************************************************************************
Looks for a matching field in an index. The column and the prefix len have
to be the same. */
......
......@@ -569,6 +569,16 @@ dict_index_get_nth_col_pos(
dict_index_t* index, /* in: index */
ulint n); /* in: column number */
/************************************************************************
Returns TRUE if the index contains a column or a prefix of that column. */
ibool
dict_index_contains_col_or_prefix(
/*==============================*/
/* out: TRUE if contains the column or its
prefix */
dict_index_t* index, /* in: index */
ulint n); /* in: column number */
/************************************************************************
Looks for a matching field in an index. The column and the prefix len has
to be the same. */
......
......@@ -93,6 +93,6 @@ slave-bin.002 62 Query 1 168 use test; insert into t1 values (1)
slave-bin.002 122 Query 1 228 use test; drop table t1
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 Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.002 276 slave-relay-bin.002 1522 master-bin.002 Yes Yes 0 0 276 1526
127.0.0.1 root MASTER_PORT 1 master-bin.002 276 slave-relay-bin.002 1563 master-bin.002 Yes Yes 0 0 276 1567
show binlog events in 'slave-bin.005' from 4;
Error when executing command SHOW BINLOG EVENTS: Could not find target log
......@@ -21,7 +21,7 @@ Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Lo
slave start;
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 Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.001 73 slave-relay-bin.001 4 master-bin.001 No Yes 0 0 73 4
127.0.0.1 root MASTER_PORT 1 master-bin.001 73 slave-relay-bin.001 45 master-bin.001 No Yes 0 0 73 45
slave stop;
change master to master_log_pos=173;
slave start;
......
......@@ -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
......
......@@ -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 !=
......
......@@ -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));
}
......
......@@ -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)
{
......
......@@ -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;
......
......@@ -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))
{
......
......@@ -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)
{
// tell the client log name with a fake rotate_event
if (fake_rotate_event(net, packet, log_file_name, &errmsg))
/*
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))
{
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;
......
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