Commit 933278a5 authored by monty@mysql.com's avatar monty@mysql.com

merge with 4.0 (to get compiler error fixes for innodb)

parents 00630a26 f375eb50
...@@ -870,18 +870,22 @@ int do_exec(struct st_query* q) ...@@ -870,18 +870,22 @@ int do_exec(struct st_query* q)
char buf[1024]; char buf[1024];
FILE *res_file; FILE *res_file;
char *cmd= q->first_argument; char *cmd= q->first_argument;
DBUG_ENTER("do_exec");
while (*cmd && my_isspace(charset_info, *cmd)) while (*cmd && my_isspace(charset_info, *cmd))
cmd++; cmd++;
if (!*cmd) if (!*cmd)
die("Missing argument in exec\n"); die("Missing argument in exec\n");
if (disable_result_log) DBUG_PRINT("info", ("Executing '%s'", cmd));
{
if (!(res_file= popen(cmd, "r")) && q->abort_on_error) if (!(res_file= popen(cmd, "r")) && q->abort_on_error)
die("popen() failed\n"); die("popen() failed\n");
while (fgets(buf, sizeof(buf), res_file));
pclose(res_file); if (disable_result_log)
{
while (fgets(buf, sizeof(buf), res_file))
{}
} }
else else
{ {
...@@ -893,11 +897,8 @@ int do_exec(struct st_query* q) ...@@ -893,11 +897,8 @@ int do_exec(struct st_query* q)
else else
ds= &ds_res; ds= &ds_res;
if (!(res_file= popen(cmd, "r")) && q->abort_on_error)
die("popen() failed\n");
while (fgets(buf, sizeof(buf), res_file)) while (fgets(buf, sizeof(buf), res_file))
replace_dynstr_append_mem(ds, buf, strlen(buf)); replace_dynstr_append_mem(ds, buf, strlen(buf));
pclose(res_file);
if (glob_replace) if (glob_replace)
free_replace(); free_replace();
...@@ -916,8 +917,9 @@ int do_exec(struct st_query* q) ...@@ -916,8 +917,9 @@ int do_exec(struct st_query* q)
if (ds == &ds_tmp) if (ds == &ds_tmp)
dynstr_free(&ds_tmp); dynstr_free(&ds_tmp);
} }
pclose(res_file);
return error; DBUG_RETURN(error);
} }
int var_query_set(VAR* v, const char* p, const char** p_end) int var_query_set(VAR* v, const char* p, const char** p_end)
...@@ -1052,7 +1054,7 @@ int do_system(struct st_query* q) ...@@ -1052,7 +1054,7 @@ int do_system(struct st_query* q)
eval_expr(&v, p, 0); /* NULL terminated */ eval_expr(&v, p, 0); /* NULL terminated */
if (v.str_val_len) if (v.str_val_len)
{ {
char expr_buf[512]; char expr_buf[1024];
if ((uint)v.str_val_len > sizeof(expr_buf) - 1) if ((uint)v.str_val_len > sizeof(expr_buf) - 1)
v.str_val_len = sizeof(expr_buf) - 1; v.str_val_len = sizeof(expr_buf) - 1;
memcpy(expr_buf, v.str_val, v.str_val_len); memcpy(expr_buf, v.str_val, v.str_val_len);
...@@ -1797,11 +1799,12 @@ int read_query(struct st_query** q_ptr) ...@@ -1797,11 +1799,12 @@ int read_query(struct st_query** q_ptr)
char *p = read_query_buf, * p1 ; char *p = read_query_buf, * p1 ;
int expected_errno; int expected_errno;
struct st_query* q; struct st_query* q;
DBUG_ENTER("read_query_buf");
if (parser.current_line < parser.read_lines) if (parser.current_line < parser.read_lines)
{ {
get_dynamic(&q_lines, (gptr) q_ptr, parser.current_line) ; get_dynamic(&q_lines, (gptr) q_ptr, parser.current_line) ;
return 0; DBUG_RETURN(0);
} }
if (!(*q_ptr= q= (struct st_query*) my_malloc(sizeof(*q), MYF(MY_WME))) || if (!(*q_ptr= q= (struct st_query*) my_malloc(sizeof(*q), MYF(MY_WME))) ||
insert_dynamic(&q_lines, (gptr) &q)) insert_dynamic(&q_lines, (gptr) &q))
...@@ -1820,7 +1823,7 @@ int read_query(struct st_query** q_ptr) ...@@ -1820,7 +1823,7 @@ int read_query(struct st_query** q_ptr)
q->type = Q_UNKNOWN; q->type = Q_UNKNOWN;
q->query_buf= q->query= 0; q->query_buf= q->query= 0;
if (read_line(read_query_buf, sizeof(read_query_buf))) if (read_line(read_query_buf, sizeof(read_query_buf)))
return 1; DBUG_RETURN(1);
if (*p == '#') if (*p == '#')
{ {
...@@ -1874,7 +1877,7 @@ int read_query(struct st_query** q_ptr) ...@@ -1874,7 +1877,7 @@ int read_query(struct st_query** q_ptr)
q->first_argument= p; q->first_argument= p;
q->end= strend(q->query); q->end= strend(q->query);
parser.read_lines++; parser.read_lines++;
return 0; DBUG_RETURN(0);
} }
...@@ -2392,10 +2395,12 @@ void get_query_type(struct st_query* q) ...@@ -2392,10 +2395,12 @@ void get_query_type(struct st_query* q)
{ {
char save; char save;
uint type; uint type;
DBUG_ENTER("get_query_type");
if (*q->query == '}') if (*q->query == '}')
{ {
q->type = Q_END_BLOCK; q->type = Q_END_BLOCK;
return; DBUG_VOID_RETURN;
} }
if (q->type != Q_COMMENT_WITH_COMMAND) if (q->type != Q_COMMENT_WITH_COMMAND)
q->type = Q_QUERY; q->type = Q_QUERY;
...@@ -2406,8 +2411,10 @@ void get_query_type(struct st_query* q) ...@@ -2406,8 +2411,10 @@ void get_query_type(struct st_query* q)
q->query[q->first_word_len]=save; q->query[q->first_word_len]=save;
if (type > 0) if (type > 0)
q->type=(enum enum_commands) type; /* Found command */ q->type=(enum enum_commands) type; /* Found command */
DBUG_VOID_RETURN;
} }
static byte *get_var_key(const byte* var, uint* len, static byte *get_var_key(const byte* var, uint* len,
my_bool __attribute__((unused)) t) my_bool __attribute__((unused)) t)
{ {
......
...@@ -63,6 +63,7 @@ extern const char *client_errors[]; /* Error messages */ ...@@ -63,6 +63,7 @@ extern const char *client_errors[]; /* Error messages */
#define CR_PROBE_MASTER_CONNECT 2025 #define CR_PROBE_MASTER_CONNECT 2025
#define CR_SSL_CONNECTION_ERROR 2026 #define CR_SSL_CONNECTION_ERROR 2026
#define CR_MALFORMED_PACKET 2027 #define CR_MALFORMED_PACKET 2027
#define CR_WRONG_LICENSE 2028
/* new 4.1 error codes */ /* new 4.1 error codes */
#define CR_NULL_POINTER 2028 #define CR_NULL_POINTER 2028
......
...@@ -23,4 +23,9 @@ ...@@ -23,4 +23,9 @@
/* mysqld compile time options */ /* mysqld compile time options */
#endif /* _CUSTOMCONFIG_ */ #endif /* _CUSTOMCONFIG_ */
#ifndef LICENSE
#define LICENSE "GPL"
#endif /* LICENSE */
#endif /* _mysql_version_h */ #endif /* _mysql_version_h */
...@@ -668,15 +668,15 @@ does nothing! */ ...@@ -668,15 +668,15 @@ does nothing! */
void void
que_thr_handle_error( que_thr_handle_error(
/*=================*/ /*=================*/
que_thr_t* thr __attribute((unused)), que_thr_t* thr __attribute__((unused)),
/* in: query thread */ /* in: query thread */
ulint err_no __attribute((unused)), ulint err_no __attribute__((unused)),
/* in: error number */ /* in: error number */
byte* err_str __attribute((unused)), byte* err_str __attribute__((unused)),
/* in, own: error string or NULL; NOTE: the /* in, own: error string or NULL; NOTE: the
function will take care of freeing of the function will take care of freeing of the
string! */ string! */
ulint err_len __attribute((unused))) ulint err_len __attribute__((unused)))
/* in: error string length */ /* in: error string length */
{ {
/* Does nothing */ /* Does nothing */
......
...@@ -52,6 +52,7 @@ const char *client_errors[]= ...@@ -52,6 +52,7 @@ const char *client_errors[]=
"Error connecting to master:", "Error connecting to master:",
"SSL connection error", "SSL connection error",
"Malformed packet", "Malformed packet",
"This client library is licensed only for use with MySQL servers having '%s' license",
"Invalid use of null pointer", "Invalid use of null pointer",
"Statement not prepared", "Statement not prepared",
"Parameters data was not supplied", "Parameters data was not supplied",
...@@ -110,6 +111,7 @@ const char *client_errors[]= ...@@ -110,6 +111,7 @@ const char *client_errors[]=
"Error connecting to master:", "Error connecting to master:",
"SSL connection error", "SSL connection error",
"Malformed packet", "Malformed packet",
"This client library is licensed only for use with MySQL servers having '%s' license",
"Invalid use of null pointer", "Invalid use of null pointer",
"Statement not prepared", "Statement not prepared",
"Parameters data was not supplied", "Parameters data was not supplied",
...@@ -166,6 +168,7 @@ const char *client_errors[]= ...@@ -166,6 +168,7 @@ const char *client_errors[]=
"Error connecting to master:", "Error connecting to master:",
"SSL connection error", "SSL connection error",
"Malformed packet", "Malformed packet",
"This client library is licensed only for use with MySQL servers having '%s' license",
"Invalid use of null pointer", "Invalid use of null pointer",
"Statement not prepared", "Statement not prepared",
"Not all parameters data supplied", "Not all parameters data supplied",
......
...@@ -603,6 +603,57 @@ mysql_connect(MYSQL *mysql,const char *host, ...@@ -603,6 +603,57 @@ mysql_connect(MYSQL *mysql,const char *host,
#endif #endif
#ifdef CHECK_LICENSE
/*
Check server side variable 'license'.
If the variable does not exist or does not contain 'Commercial',
we're talking to non-commercial server from commercial client.
SYNOPSIS
check_license()
RETURN VALUE
0 success
!0 network error or the server is not commercial.
Error code is saved in mysql->net.last_errno.
*/
static int check_license(MYSQL *mysql)
{
MYSQL_ROW row;
MYSQL_RES *res;
NET *net= &mysql->net;
static const char query[]= "SELECT @@license";
static const char required_license[]= LICENSE;
if (mysql_real_query(mysql, query, sizeof(query)-1))
{
if (net->last_errno == ER_UNKNOWN_SYSTEM_VARIABLE)
{
net->last_errno= CR_WRONG_LICENSE;
sprintf(net->last_error, ER(net->last_errno), required_license);
}
return 1;
}
if (!(res= mysql_use_result(mysql)))
return 1;
row= mysql_fetch_row(res);
/*
If no rows in result set, or column value is NULL (none of these
two is ever true for server variables now), or column value
mismatch, set wrong license error.
*/
if (!net->last_errno &&
(!row || !row[0] ||
strncmp(row[0], required_license, sizeof(required_license))))
{
net->last_errno= CR_WRONG_LICENSE;
sprintf(net->last_error, ER(net->last_errno), required_license);
}
mysql_free_result(res);
return net->last_errno;
}
#endif /* CHECK_LICENSE */
/************************************************************************** /**************************************************************************
Change user and database Change user and database
**************************************************************************/ **************************************************************************/
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
# Access Definitions # Access Definitions
#-- #--
DB=test DB=test
DBPASSWD= DBPASSWD=""
VERBOSE="" VERBOSE=""
USE_MANAGER=0 USE_MANAGER=0
MY_TZ=GMT-3 MY_TZ=GMT-3
...@@ -469,12 +469,13 @@ if [ x$SOURCE_DIST = x1 ] ; then ...@@ -469,12 +469,13 @@ if [ x$SOURCE_DIST = x1 ] ; then
MYSQL_TEST="strace -o $MYSQL_TEST_DIR/var/log/mysqltest.strace $MYSQL_TEST" MYSQL_TEST="strace -o $MYSQL_TEST_DIR/var/log/mysqltest.strace $MYSQL_TEST"
fi fi
MYSQLADMIN="$BASEDIR/client/mysqladmin" CLIENT_BINDIR="$BASEDIR/client"
MYSQLADMIN="$CLIENT_BINDIR/mysqladmin"
WAIT_PID="$BASEDIR/extra/mysql_waitpid" WAIT_PID="$BASEDIR/extra/mysql_waitpid"
MYSQL_MANAGER_CLIENT="$BASEDIR/client/mysqlmanagerc" MYSQL_MANAGER_CLIENT="$CLIENT_BINDIR/mysqlmanagerc"
MYSQL_MANAGER="$BASEDIR/tools/mysqlmanager" MYSQL_MANAGER="$BASEDIR/tools/mysqlmanager"
MYSQL_MANAGER_PWGEN="$BASEDIR/client/mysqlmanager-pwgen" MYSQL_MANAGER_PWGEN="$CLIENT_BINDIR/mysqlmanager-pwgen"
MYSQL="$BASEDIR/client/mysql" MYSQL="$CLIENT_BINDIR/mysql"
LANGUAGE="$BASEDIR/sql/share/english/" LANGUAGE="$BASEDIR/sql/share/english/"
CHARSETSDIR="$BASEDIR/sql/share/charsets" CHARSETSDIR="$BASEDIR/sql/share/charsets"
INSTALL_DB="./install_test_db" INSTALL_DB="./install_test_db"
...@@ -486,17 +487,18 @@ else ...@@ -486,17 +487,18 @@ else
else else
MYSQLD="$VALGRIND $BASEDIR/bin/mysqld" MYSQLD="$VALGRIND $BASEDIR/bin/mysqld"
fi fi
MYSQL_TEST="$BASEDIR/bin/mysqltest" CLIENT_BINDIR="$BASEDIR/bin"
MYSQL_DUMP="$BASEDIR/bin/mysqldump" MYSQL_TEST="$CLIENT_BINDIR/mysqltest"
MYSQL_BINLOG="$BASEDIR/bin/mysqlbinlog" MYSQL_DUMP="$CLIENT_BINDIR/mysqldump"
MYSQLADMIN="$BASEDIR/bin/mysqladmin" MYSQL_BINLOG="$CLIENT_BINDIR/mysqlbinlog"
WAIT_PID="$BASEDIR/bin/mysql_waitpid" MYSQLADMIN="$CLIENT_BINDIR/mysqladmin"
MYSQL_MANAGER="$BASEDIR/bin/mysqlmanager" WAIT_PID="$CLIENT_BINDIR/mysql_waitpid"
MYSQL_MANAGER_CLIENT="$BASEDIR/bin/mysqlmanagerc" MYSQL_MANAGER="$CLIENT_BINDIR/mysqlmanager"
MYSQL_MANAGER_PWGEN="$BASEDIR/bin/mysqlmanager-pwgen" MYSQL_MANAGER_CLIENT="$CLIENT_BINDIR/mysqlmanagerc"
MYSQL="$BASEDIR/bin/mysql" MYSQL_MANAGER_PWGEN="$CLIENT_BINDIR/mysqlmanager-pwgen"
MYSQL="$CLIENT_BINDIR/mysql"
INSTALL_DB="./install_test_db --bin" INSTALL_DB="./install_test_db --bin"
MYSQL_FIX_SYSTEM_TABLES="$BASEDIR/bin/mysql_fix_privilege_tables" MYSQL_FIX_SYSTEM_TABLES="$CLIENT_BINDIR/mysql_fix_privilege_tables"
if test -d "$BASEDIR/share/mysql/english" if test -d "$BASEDIR/share/mysql/english"
then then
LANGUAGE="$BASEDIR/share/mysql/english/" LANGUAGE="$BASEDIR/share/mysql/english/"
...@@ -507,11 +509,12 @@ else ...@@ -507,11 +509,12 @@ else
fi fi
fi fi
MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK $EXTRA_MYSQLDUMP_OPT" MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR $EXTRA_MYSQLBINLOG_OPT" MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR $EXTRA_MYSQLBINLOG_OPT"
MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=" MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --bindir=$CLIENT_BINDIR"
MYSQL="$MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=" MYSQL="$MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD"
export MYSQL MYSQL_DUMP MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES export MYSQL MYSQL_DUMP MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES CLIENT_BINDIR
if [ -z "$MASTER_MYSQLD" ] if [ -z "$MASTER_MYSQLD" ]
then then
......
#
# This is the test for mysql_fix_privilege_tables
#
-- disable_query_log
-- source include/create_old_system_tables.inc
-- exec $MYSQL_FIX_SYSTEM_TABLES --database=test > nil 2>nil
-- enable_query_log
-- source include/system_db_struct.inc
-- disable_query_log
-- source include/drop_system_tables.inc
-- enable_query_log
...@@ -118,6 +118,21 @@ connection slave; ...@@ -118,6 +118,21 @@ connection slave;
sync_with_master; sync_with_master;
select * from mysqltest.t1; select * from mysqltest.t1;
# Check that LOAD DATA FROM MASTER is able to create master.info
# if needed (if RESET SLAVE was used before), before writing to it (BUG#2922).
stop slave;
reset slave;
load data from master;
start slave;
# see if replication coordinates were restored fine
connection master;
insert into bar.t1 values (5, 'five bar');
save_master_pos;
connection slave;
sync_with_master;
select * from bar.t1;
# Check that LOAD DATA FROM MASTER reports the error if it can't drop a # Check that LOAD DATA FROM MASTER reports the error if it can't drop a
# table to be overwritten. # table to be overwritten.
# DISABLED FOR NOW AS chmod IS NOT PORTABLE ON NON-UNIX # DISABLED FOR NOW AS chmod IS NOT PORTABLE ON NON-UNIX
......
#
# This is the test for mysql_fix_privilege_tables
#
-- disable_result_log
-- disable_query_log
use test;
# create system tables as in mysql-3.20
CREATE TABLE db (
Host char(60) binary DEFAULT '' NOT NULL,
Db char(32) binary DEFAULT '' NOT NULL,
User char(16) binary DEFAULT '' NOT NULL,
Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,
Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,
Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,
Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,
Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,
Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,
PRIMARY KEY Host (Host,Db,User),
KEY User (User)
)
type=ISAM;
INSERT INTO db VALUES ('%','test', '','Y','Y','Y','Y','Y','Y');
INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y');
CREATE TABLE host (
Host char(60) binary DEFAULT '' NOT NULL,
Db char(32) binary DEFAULT '' NOT NULL,
Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,
Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,
Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,
Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,
Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,
Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,
PRIMARY KEY Host (Host,Db)
)
type=ISAM;
CREATE TABLE user (
Host char(60) binary DEFAULT '' NOT NULL,
User char(16) binary DEFAULT '' NOT NULL,
Password char(16),
Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,
Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,
Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,
Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,
Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,
Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,
Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL,
Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL,
Process_priv enum('N','Y') DEFAULT 'N' NOT NULL,
PRIMARY KEY Host (Host,User)
)
type=ISAM;
INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y');
INSERT INTO user VALUES ('localhost','', '','N','N','N','N','N','N','N','N','N');
-- exec $MYSQL_FIX_SYSTEM_TABLES --database=test
-- enable_query_log
-- enable_result_log
-- source include/system_db_struct.inc
-- disable_query_log
DROP TABLE db;
DROP TABLE host;
DROP TABLE user;
DROP TABLE func;
DROP TABLE tables_priv;
DROP TABLE columns_priv;
-- enable_query_log
...@@ -13,6 +13,7 @@ args="" ...@@ -13,6 +13,7 @@ args=""
port="" port=""
socket="" socket=""
database="mysql" database="mysql"
bindir=""
file=mysql_fix_privilege_tables.sql file=mysql_fix_privilege_tables.sql
...@@ -40,6 +41,7 @@ parse_arguments() { ...@@ -40,6 +41,7 @@ parse_arguments() {
--port=*) port=`echo "$arg" | sed -e "s;--port=;;"` ;; --port=*) port=`echo "$arg" | sed -e "s;--port=;;"` ;;
--socket=*) socket=`echo "$arg" | sed -e "s;--socket=;;"` ;; --socket=*) socket=`echo "$arg" | sed -e "s;--socket=;;"` ;;
--database=*) database=`echo "$arg" | sed -e "s;--database=;;"` ;; --database=*) database=`echo "$arg" | sed -e "s;--database=;;"` ;;
--bindir=*) bindir=`echo "$arg" | sed -e "s;--bindir=;;"` ;;
*) *)
if test -n "$pick_args" if test -n "$pick_args"
then then
...@@ -76,11 +78,17 @@ parse_arguments PICK-ARGS-FROM-ARGV "$@" ...@@ -76,11 +78,17 @@ parse_arguments PICK-ARGS-FROM-ARGV "$@"
if test -z "$basedir" if test -z "$basedir"
then then
basedir=@prefix@ basedir=@prefix@
if test -z "$bindir"
then
bindir=@bindir@ bindir=@bindir@
fi
execdir=@libexecdir@ execdir=@libexecdir@
pkgdatadir=@pkgdatadir@ pkgdatadir=@pkgdatadir@
else else
if test -z "$bindir"
then
bindir="$basedir/bin" bindir="$basedir/bin"
fi
if test -x "$basedir/libexec/mysqld" if test -x "$basedir/libexec/mysqld"
then then
execdir="$basedir/libexec" execdir="$basedir/libexec"
......
...@@ -895,7 +895,7 @@ int load_master_data(THD* thd) ...@@ -895,7 +895,7 @@ int load_master_data(THD* thd)
cleanup_mysql_results(db_res, cur_table_res - 1, table_res); cleanup_mysql_results(db_res, cur_table_res - 1, table_res);
// adjust position in the master // adjust replication coordinates from the master
if (master_status_res) if (master_status_res)
{ {
MYSQL_ROW row = mysql_fetch_row(master_status_res); MYSQL_ROW row = mysql_fetch_row(master_status_res);
...@@ -908,10 +908,18 @@ int load_master_data(THD* thd) ...@@ -908,10 +908,18 @@ int load_master_data(THD* thd)
*/ */
if (row && row[0] && row[1]) if (row && row[0] && row[1])
{ {
/*
If the slave's master info is not inited, we init it, then we write
the new coordinates to it. Must call init_master_info() *before*
setting active_mi, because init_master_info() sets active_mi with
defaults.
*/
if (init_master_info(active_mi, master_info_file, relay_log_info_file, 0))
send_error(&thd->net, ER_MASTER_INFO);
strmake(active_mi->master_log_name, row[0], strmake(active_mi->master_log_name, row[0],
sizeof(active_mi->master_log_name)); sizeof(active_mi->master_log_name));
active_mi->master_log_pos = strtoull(row[1], (char**) 0, 10); active_mi->master_log_pos = strtoull(row[1], (char**) 0, 10);
/* don't hit the magic number */ /* at least in recent versions, the condition below should be false */
if (active_mi->master_log_pos < BIN_LOG_HEADER_SIZE) if (active_mi->master_log_pos < BIN_LOG_HEADER_SIZE)
active_mi->master_log_pos = BIN_LOG_HEADER_SIZE; active_mi->master_log_pos = BIN_LOG_HEADER_SIZE;
/* /*
......
...@@ -424,14 +424,12 @@ static sys_var_thd_ulong sys_default_week_format("default_week_format", ...@@ -424,14 +424,12 @@ static sys_var_thd_ulong sys_default_week_format("default_week_format",
sys_var_thd_ulong sys_group_concat_max_len("group_concat_max_len", sys_var_thd_ulong sys_group_concat_max_len("group_concat_max_len",
&SV::group_concat_max_len); &SV::group_concat_max_len);
static const char license[]= "GPL";
/* Read only variables */ /* Read only variables */
sys_var_const_str sys_os("version_compile_os", SYSTEM_TYPE); sys_var_const_str sys_os("version_compile_os", SYSTEM_TYPE);
sys_var_const_str sys_license("license", license);
/* Global read-only variable describing server license */ /* Global read-only variable describing server license */
sys_var_const_str sys_license("license", LICENSE);
......
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