Commit 738afb39 authored by unknown's avatar unknown

resolving of merging conflict


libmysql/libmysql.c:
  conflict resolved
parents eced1c93 d1026552
......@@ -29,6 +29,7 @@ heikki@rescue.
heikki@work.mysql.com
hf@bison.(none)
hf@bisonxp.(none)
hf@deer.(none)
hf@deer.mysql.r18.ru
hf@genie.(none)
igor@hundin.mysql.fi
......
This diff is collapsed.
......@@ -43,14 +43,14 @@ sqlsources = derror.cc field.cc field_conv.cc filesort.cc \
item.cc item_buff.cc item_cmpfunc.cc item_create.cc \
item_func.cc item_strfunc.cc item_sum.cc item_timefunc.cc \
item_uniq.cc item_subselect.cc item_row.cc\
key.cc lock.cc log.cc log_event.cc mf_iocache.cc\
mini_client.cc protocol.cc net_serv.cc opt_ft.cc opt_range.cc \
key.cc lock.cc log.cc log_event.cc \
protocol.cc net_serv.cc opt_ft.cc opt_range.cc \
opt_sum.cc procedure.cc records.cc sql_acl.cc \
repl_failsafe.cc slave.cc sql_load.cc sql_olap.cc \
sql_load.cc sql_olap.cc \
sql_analyse.cc sql_base.cc sql_cache.cc sql_class.cc \
sql_crypt.cc sql_db.cc sql_delete.cc sql_error.cc sql_insert.cc \
sql_lex.cc sql_list.cc sql_manager.cc sql_map.cc sql_parse.cc \
sql_prepare.cc sql_derived.cc sql_rename.cc sql_repl.cc \
sql_prepare.cc sql_derived.cc sql_rename.cc \
sql_select.cc sql_do.cc sql_show.cc set_var.cc \
sql_string.cc sql_table.cc sql_test.cc sql_udf.cc \
sql_update.cc sql_yacc.cc table.cc thr_malloc.cc time.cc \
......
This diff is collapsed.
This diff is collapsed.
......@@ -17,30 +17,32 @@
#ifndef _MINI_CLIENT_H
#define _MINI_CLIENT_H
MYSQL* mc_mysql_connect(MYSQL *mysql,const char *host, const char *user,
MYSQL *
mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
const char *passwd, const char *db,
uint port, const char *unix_socket,uint client_flag,
uint port, const char *unix_socket,ulong client_flag,
uint net_read_timeout);
int mc_simple_command(MYSQL *mysql,enum enum_server_command command,
const char *arg, uint length, my_bool skipp_check);
void mc_mysql_close(MYSQL *mysql);
MYSQL *mc_mysql_init(MYSQL *mysql);
void mc_mysql_debug(const char *debug);
ulong mc_net_safe_read(MYSQL *mysql);
char *mc_mysql_error(MYSQL *mysql);
int mc_mysql_errno(MYSQL *mysql);
my_bool mc_mysql_reconnect(MYSQL* mysql);
int mc_mysql_send_query(MYSQL* mysql, const char* query, uint length);
int mc_mysql_read_query_result(MYSQL *mysql);
int mc_mysql_query(MYSQL *mysql, const char *query, uint length);
MYSQL_RES * mc_mysql_store_result(MYSQL *mysql);
void mc_mysql_free_result(MYSQL_RES *result);
void mc_mysql_data_seek(MYSQL_RES *result, my_ulonglong row);
my_ulonglong mc_mysql_num_rows(MYSQL_RES *res);
unsigned int mc_mysql_num_fields(MYSQL_RES *res);
MYSQL_ROW STDCALL mc_mysql_fetch_row(MYSQL_RES *res);
int mc_mysql_select_db(MYSQL *mysql, const char *db);
void mc_end_server(MYSQL *mysql);
my_bool simple_command(MYSQL *mysql,enum enum_server_command command,
const char *arg, unsigned long length,
my_bool skip_check);
void mysql_close(MYSQL *mysql);
MYSQL *mysql_init(MYSQL *mysql);
void mysql_debug(const char *debug);
ulong net_safe_read(MYSQL *mysql);
const char *mysql_error(MYSQL *mysql);
unsigned int mysql_errno(MYSQL *mysql);
my_bool mysql_reconnect(MYSQL* mysql);
int mysql_send_query(MYSQL* mysql, const char* query, uint length);
my_bool mysql_read_query_result(MYSQL *mysql);
int mysql_real_query(MYSQL *mysql, const char *q, unsigned long length);
MYSQL_RES * mysql_store_result(MYSQL *mysql);
void mysql_free_result(MYSQL_RES *result);
void mysql_data_seek(MYSQL_RES *result, my_ulonglong row);
my_ulonglong mysql_num_rows(MYSQL_RES *res);
unsigned int mysql_num_fields(MYSQL_RES *res);
MYSQL_ROW STDCALL mysql_fetch_row(MYSQL_RES *res);
int mysql_select_db(MYSQL *mysql, const char *db);
void end_server(MYSQL *mysql);
#endif
......@@ -484,14 +484,15 @@ int update_slave_list(MYSQL* mysql, MASTER_INFO* mi)
int port_ind;
DBUG_ENTER("update_slave_list");
if (mc_mysql_query(mysql,"SHOW SLAVE HOSTS",16) ||
!(res = mc_mysql_store_result(mysql)))
if (mysql_real_query(mysql,"SHOW SLAVE HOSTS",16) ||
!(res = mysql_store_result(mysql)))
{
error= mc_mysql_error(mysql);
error= mysql_error(mysql);
goto err;
}
switch (mc_mysql_num_fields(res)) {
switch (mysql_num_fields(res)) {
case 5:
have_auth_info = 0;
port_ind=2;
......@@ -508,7 +509,7 @@ HOSTS";
pthread_mutex_lock(&LOCK_slave_list);
while ((row= mc_mysql_fetch_row(res)))
while ((row= mysql_fetch_row(res)))
{
uint32 server_id;
SLAVE_INFO* si, *old_si;
......@@ -541,7 +542,7 @@ HOSTS";
err:
if (res)
mc_mysql_free_result(res);
mysql_free_result(res);
if (error)
{
sql_print_error("While trying to obtain the list of slaves from the master \
......@@ -566,7 +567,7 @@ pthread_handler_decl(handle_failsafe_rpl,arg)
thd->thread_stack = (char*)&thd;
MYSQL* recovery_captain = 0;
pthread_detach_this_thread();
if (init_failsafe_rpl_thread(thd) || !(recovery_captain=mc_mysql_init(0)))
if (init_failsafe_rpl_thread(thd) || !(recovery_captain=mysql_init(0)))
{
sql_print_error("Could not initialize failsafe replication thread");
goto err;
......@@ -599,7 +600,7 @@ pthread_handler_decl(handle_failsafe_rpl,arg)
pthread_mutex_unlock(&LOCK_rpl_status);
err:
if (recovery_captain)
mc_mysql_close(recovery_captain);
mysql_close(recovery_captain);
delete thd;
my_thread_end();
pthread_exit(0);
......@@ -668,7 +669,7 @@ int connect_to_master(THD *thd, MYSQL* mysql, MASTER_INFO* mi)
strmov(mysql->net.last_error, "Master is not configured");
DBUG_RETURN(1);
}
if (!mc_mysql_connect(mysql, mi->host, mi->user, mi->password, 0,
if (!mysql_real_connect(mysql, mi->host, mi->user, mi->password, 0,
mi->port, 0, 0,
slave_net_timeout))
DBUG_RETURN(1);
......@@ -682,9 +683,9 @@ static inline void cleanup_mysql_results(MYSQL_RES* db_res,
for (; cur >= start; --cur)
{
if (*cur)
mc_mysql_free_result(*cur);
mysql_free_result(*cur);
}
mc_mysql_free_result(db_res);
mysql_free_result(db_res);
}
......@@ -692,8 +693,8 @@ static int fetch_db_tables(THD *thd, MYSQL *mysql, const char *db,
MYSQL_RES *table_res, MASTER_INFO *mi)
{
MYSQL_ROW row;
for (row = mc_mysql_fetch_row(table_res); row;
row = mc_mysql_fetch_row(table_res))
for (row = mysql_fetch_row(table_res); row;
row = mysql_fetch_row(table_res))
{
TABLE_LIST table;
const char* table_name= row[0];
......@@ -727,7 +728,7 @@ int load_master_data(THD* thd)
int error = 0;
const char* errmsg=0;
int restart_thread_mask;
mc_mysql_init(&mysql);
mysql_init(&mysql);
/*
We do not want anyone messing with the slave at all for the entire
......@@ -749,7 +750,7 @@ int load_master_data(THD* thd)
if (connect_to_master(thd, &mysql, active_mi))
{
net_printf(thd, error= ER_CONNECT_TO_MASTER,
mc_mysql_error(&mysql));
mysql_error(&mysql));
goto err;
}
......@@ -758,15 +759,15 @@ int load_master_data(THD* thd)
MYSQL_RES *db_res, **table_res, **table_res_end, **cur_table_res;
uint num_dbs;
if (mc_mysql_query(&mysql, "SHOW DATABASES", 14) ||
!(db_res = mc_mysql_store_result(&mysql)))
if (mysql_real_query(&mysql, "SHOW DATABASES", 14) ||
!(db_res = mysql_store_result(&mysql)))
{
net_printf(thd, error = ER_QUERY_ON_MASTER,
mc_mysql_error(&mysql));
mysql_error(&mysql));
goto err;
}
if (!(num_dbs = (uint) mc_mysql_num_rows(db_res)))
if (!(num_dbs = (uint) mysql_num_rows(db_res)))
goto err;
/*
In theory, the master could have no databases at all
......@@ -785,12 +786,12 @@ int load_master_data(THD* thd)
we wait to issue FLUSH TABLES WITH READ LOCK for as long as we
can to minimize the lock time.
*/
if (mc_mysql_query(&mysql, "FLUSH TABLES WITH READ LOCK", 27) ||
mc_mysql_query(&mysql, "SHOW MASTER STATUS",18) ||
!(master_status_res = mc_mysql_store_result(&mysql)))
if (mysql_real_query(&mysql, "FLUSH TABLES WITH READ LOCK", 27) ||
mysql_real_query(&mysql, "SHOW MASTER STATUS",18) ||
!(master_status_res = mysql_store_result(&mysql)))
{
net_printf(thd, error = ER_QUERY_ON_MASTER,
mc_mysql_error(&mysql));
mysql_error(&mysql));
goto err;
}
......@@ -805,7 +806,7 @@ int load_master_data(THD* thd)
cur_table_res++)
{
// since we know how many rows we have, this can never be NULL
MYSQL_ROW row = mc_mysql_fetch_row(db_res);
MYSQL_ROW row = mysql_fetch_row(db_res);
char* db = row[0];
/*
......@@ -834,12 +835,12 @@ int load_master_data(THD* thd)
goto err;
}
if (mc_mysql_select_db(&mysql, db) ||
mc_mysql_query(&mysql, "SHOW TABLES", 11) ||
!(*cur_table_res = mc_mysql_store_result(&mysql)))
if (mysql_select_db(&mysql, db) ||
mysql_real_query(&mysql, "SHOW TABLES", 11) ||
!(*cur_table_res = mysql_store_result(&mysql)))
{
net_printf(thd, error = ER_QUERY_ON_MASTER,
mc_mysql_error(&mysql));
mysql_error(&mysql));
cleanup_mysql_results(db_res, cur_table_res - 1, table_res);
goto err;
}
......@@ -857,7 +858,7 @@ int load_master_data(THD* thd)
// adjust position in the master
if (master_status_res)
{
MYSQL_ROW row = mc_mysql_fetch_row(master_status_res);
MYSQL_ROW row = mysql_fetch_row(master_status_res);
/*
We need this check because the master may not be running with
......@@ -875,13 +876,13 @@ int load_master_data(THD* thd)
active_mi->master_log_pos = BIN_LOG_HEADER_SIZE;
flush_master_info(active_mi);
}
mc_mysql_free_result(master_status_res);
mysql_free_result(master_status_res);
}
if (mc_mysql_query(&mysql, "UNLOCK TABLES", 13))
if (mysql_real_query(&mysql, "UNLOCK TABLES", 13))
{
net_printf(thd, error = ER_QUERY_ON_MASTER,
mc_mysql_error(&mysql));
mysql_error(&mysql));
goto err;
}
}
......@@ -920,7 +921,7 @@ int load_master_data(THD* thd)
UNLOCK_ACTIVE_MI;
thd->proc_info = 0;
mc_mysql_close(&mysql); // safe to call since we always do mc_mysql_init()
mysql_close(&mysql); // safe to call since we always do mysql_init()
if (!error)
send_ok(thd);
......
......@@ -1164,15 +1164,15 @@ int fetch_master_table(THD *thd, const char *db_name, const char *table_name,
if (!called_connected)
{
if (!(mysql = mc_mysql_init(NULL)))
if (!(mysql = mysql_init(NULL)))
{
send_error(thd); // EOM
DBUG_RETURN(1);
}
if (connect_to_master(thd, mysql, mi))
{
net_printf(thd, ER_CONNECT_TO_MASTER, mc_mysql_error(mysql));
mc_mysql_close(mysql);
net_printf(thd, ER_CONNECT_TO_MASTER, mysql_error(mysql));
mysql_close(mysql);
DBUG_RETURN(1);
}
if (thd->killed)
......@@ -1193,7 +1193,7 @@ int fetch_master_table(THD *thd, const char *db_name, const char *table_name,
err:
thd->net.no_send_ok = 0; // Clear up garbage after create_table_from_dump
if (!called_connected)
mc_mysql_close(mysql);
mysql_close(mysql);
if (errmsg && thd->net.vio)
send_error(thd, error, errmsg);
DBUG_RETURN(test(error)); // Return 1 on error
......@@ -1560,12 +1560,12 @@ int register_slave_on_master(MYSQL* mysql)
/* The master will fill in master_id */
int4store(pos, 0); pos+= 4;
if (mc_simple_command(mysql, COM_REGISTER_SLAVE, (char*) buf,
if (simple_command(mysql, COM_REGISTER_SLAVE, (char*) buf,
(uint) (pos- buf), 0))
{
sql_print_error("Error on COM_REGISTER_SLAVE: %d '%s'",
mc_mysql_errno(mysql),
mc_mysql_error(mysql));
mysql_errno(mysql),
mysql_error(mysql));
return 1;
}
return 0;
......@@ -1959,18 +1959,18 @@ static int request_dump(MYSQL* mysql, MASTER_INFO* mi,
int4store(buf + 6, server_id);
len = (uint) strlen(logname);
memcpy(buf + 10, logname,len);
if (mc_simple_command(mysql, COM_BINLOG_DUMP, buf, len + 10, 1))
if (simple_command(mysql, COM_BINLOG_DUMP, buf, len + 10, 1))
{
/*
Something went wrong, so we will just reconnect and retry later
in the future, we should do a better error analysis, but for
now we just fill up the error log :-)
*/
if (mc_mysql_errno(mysql) == ER_NET_READ_INTERRUPTED)
if (mysql_errno(mysql) == ER_NET_READ_INTERRUPTED)
*suppress_warnings= 1; // Suppress reconnect warning
else
sql_print_error("Error on COM_BINLOG_DUMP: %d %s, will retry in %d secs",
mc_mysql_errno(mysql), mc_mysql_error(mysql),
mysql_errno(mysql), mysql_error(mysql),
master_connect_retry);
DBUG_RETURN(1);
}
......@@ -1997,7 +1997,7 @@ static int request_table_dump(MYSQL* mysql, const char* db, const char* table)
*p++ = table_len;
memcpy(p, table, table_len);
if (mc_simple_command(mysql, COM_TABLE_DUMP, buf, p - buf + table_len, 1))
if (simple_command(mysql, COM_TABLE_DUMP, buf, p - buf + table_len, 1))
{
sql_print_error("request_table_dump: Error sending the table dump \
command");
......@@ -2041,10 +2041,10 @@ static ulong read_event(MYSQL* mysql, MASTER_INFO *mi, bool* suppress_warnings)
return packet_error;
#endif
len = mc_net_safe_read(mysql);
len = net_safe_read(mysql);
if (len == packet_error || (long) len < 1)
{
if (mc_mysql_errno(mysql) == ER_NET_READ_INTERRUPTED)
if (mysql_errno(mysql) == ER_NET_READ_INTERRUPTED)
{
/*
We are trying a normal reconnect after a read timeout;
......@@ -2056,7 +2056,7 @@ static ulong read_event(MYSQL* mysql, MASTER_INFO *mi, bool* suppress_warnings)
else
sql_print_error("Error reading packet from server: %s (\
server_errno=%d)",
mc_mysql_error(mysql), mc_mysql_errno(mysql));
mysql_error(mysql), mysql_errno(mysql));
return packet_error;
}
......@@ -2064,7 +2064,7 @@ server_errno=%d)",
{
sql_print_error("Slave: received 0 length packet from server, apparent\
master shutdown: %s",
mc_mysql_error(mysql));
mysql_error(mysql));
return packet_error;
}
......@@ -2214,7 +2214,7 @@ extern "C" pthread_handler_decl(handle_slave_io,arg)
mi->master_log_name,
llstr(mi->master_log_pos,llbuff)));
if (!(mi->mysql = mysql = mc_mysql_init(NULL)))
if (!(mi->mysql = mysql = mysql_init(NULL)))
{
sql_print_error("Slave I/O thread: error in mc_mysql_init()");
goto err;
......@@ -2269,7 +2269,7 @@ dump");
}
thd->proc_info = "Waiiting to reconnect after a failed dump request";
mc_end_server(mysql);
end_server(mysql);
/*
First time retry immediately, assuming that we can recover
right away - if first time fails, sleep between re-tries
......@@ -2319,7 +2319,7 @@ after reconnect");
if (event_len == packet_error)
{
uint mysql_error_number= mc_mysql_errno(mysql);
uint mysql_error_number= mysql_errno(mysql);
if (mysql_error_number == ER_NET_PACKET_TOO_LARGE)
{
sql_print_error("\
......@@ -2332,11 +2332,11 @@ max_allowed_packet",
if (mysql_error_number == ER_MASTER_FATAL_ERROR_READING_BINLOG)
{
sql_print_error(ER(mysql_error_number), mysql_error_number,
mc_mysql_error(mysql));
mysql_error(mysql));
goto err;
}
thd->proc_info = "Waiting to reconnect after a failed read";
mc_end_server(mysql);
end_server(mysql);
if (retry_count++)
{
if (retry_count > master_retry_count)
......@@ -2406,7 +2406,7 @@ log space");
VOID(pthread_mutex_unlock(&LOCK_thread_count));
if (mysql)
{
mc_mysql_close(mysql);
mysql_close(mysql);
mi->mysql=0;
}
thd->proc_info = "Waiting for slave mutex on exit";
......@@ -2947,22 +2947,22 @@ static int connect_to_master(THD* thd, MYSQL* mysql, MASTER_INFO* mi,
client_flag=CLIENT_COMPRESS; /* We will use compression */
while (!(slave_was_killed = io_slave_killed(thd,mi)) &&
(reconnect ? mc_mysql_reconnect(mysql) != 0:
!mc_mysql_connect(mysql, mi->host, mi->user, mi->password, 0,
(reconnect ? mysql_reconnect(mysql) != 0:
!mysql_real_connect(mysql, mi->host, mi->user, mi->password, 0,
mi->port, 0, client_flag,
thd->variables.net_read_timeout)))
{
/* Don't repeat last error */
if (mc_mysql_errno(mysql) != last_errno)
if ((int)mysql_errno(mysql) != last_errno)
{
last_errno=mc_mysql_errno(mysql);
last_errno=mysql_errno(mysql);
suppress_warnings= 0;
sql_print_error("Slave I/O thread: error %s to master \
'%s@%s:%d': \
Error: '%s' errno: %d retry-time: %d retries: %d",
(reconnect ? "reconnecting" : "connecting"),
mi->user,mi->host,mi->port,
mc_mysql_error(mysql), last_errno,
mysql_error(mysql), last_errno,
mi->connect_retry,
master_retry_count);
}
......
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