mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-4.0
into mysql.r18.ru:/usr/home/ram/work/4.0
This commit is contained in:
@ -71,6 +71,7 @@ mysqldev@build.mysql2.com
|
||||
nick@mysql.com
|
||||
nick@nick.leippe.com
|
||||
paul@central.snake.net
|
||||
paul@ice.local
|
||||
paul@teton.kitebird.com
|
||||
pem@mysql.com
|
||||
peter@linux.local
|
||||
|
@ -38,11 +38,13 @@ $opt_export_only= undef;
|
||||
$opt_help= $opt_verbose= 0;
|
||||
$opt_log= undef;
|
||||
$opt_mail= "";
|
||||
$opt_revision= undef;
|
||||
$opt_suffix= "";
|
||||
$opt_test= undef;
|
||||
$opt_skip_check= undef;
|
||||
$opt_skip_manual= undef;
|
||||
$version= "unknown";
|
||||
$major=$minor=$release=0;
|
||||
|
||||
GetOptions(
|
||||
"build-command|b=s",
|
||||
@ -149,6 +151,7 @@ if (!$opt_dry_run)
|
||||
{
|
||||
m/^AM_INIT_AUTOMAKE\(mysql, ([1-9]\.[0-9]{1,2}\.[0-9]{1,2}.*)\)/;
|
||||
$version= $1;
|
||||
($major, $minor, $release) = split(/\./,$version);
|
||||
}
|
||||
&logger("Found version string: $version");
|
||||
|
||||
@ -218,7 +221,7 @@ if (defined $opt_changelog)
|
||||
{
|
||||
if (!$opt_revision)
|
||||
{
|
||||
$revision= `bk changes -t -d':REV:' -n $REPO | head -1`;
|
||||
$revision= `bk changes -t -d':REV:::TAG:' -n $REPO | grep mysql-$major.$minor | head -1 | cut -f1 -d ":"`;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -111,7 +111,7 @@ static void usage(void)
|
||||
{
|
||||
print_version();
|
||||
puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n");
|
||||
printf("Print a description for a system error code or a error code from\na MyISAM/ISAM/BDB table handler.\n");
|
||||
printf("Print a description for a system error code or an error code from\na MyISAM/ISAM/BDB table handler.\n");
|
||||
printf("If you want to get the error for a negative error code, you should use\n-- before the first error code to tell perror that there was no more options.\n\n");
|
||||
printf("Usage: %s [OPTIONS] [ERRORCODE [ERRORCODE...]]\n",my_progname);
|
||||
my_print_help(my_long_options);
|
||||
|
@ -175,7 +175,11 @@ os_file_create(
|
||||
file is created (if exists, error), OS_FILE_OVERWRITE
|
||||
if a new file is created or an old overwritten */
|
||||
ulint purpose,/* in: OS_FILE_AIO, if asynchronous, non-buffered i/o
|
||||
is desired, OS_FILE_NORMAL, if any normal file */
|
||||
is desired, OS_FILE_NORMAL, if any normal file;
|
||||
NOTE that it also depends on type, os_aio_.. and srv_..
|
||||
variables whether we really use async i/o or
|
||||
unbuffered i/o: look in the function source code for
|
||||
the exact rules */
|
||||
ulint type, /* in: OS_DATA_FILE or OS_LOG_FILE */
|
||||
ibool* success);/* out: TRUE if succeed, FALSE if error */
|
||||
/***************************************************************************
|
||||
|
@ -168,6 +168,7 @@ what these mean */
|
||||
#define SRV_UNIX_O_DSYNC 2
|
||||
#define SRV_UNIX_LITTLESYNC 3
|
||||
#define SRV_UNIX_NOSYNC 4
|
||||
#define SRV_UNIX_O_DIRECT 5
|
||||
|
||||
/* Alternatives for file i/o in Windows */
|
||||
#define SRV_WIN_IO_NORMAL 1
|
||||
|
@ -211,9 +211,9 @@ os_file_get_last_error(void)
|
||||
if (err != ERROR_DISK_FULL && err != ERROR_FILE_EXISTS) {
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: Operating system error number %li in a file operation.\n"
|
||||
" InnoDB: Operating system error number %lu in a file operation.\n"
|
||||
"InnoDB: See http://www.innodb.com/ibman.html for installation help.\n",
|
||||
(long) err);
|
||||
err);
|
||||
|
||||
if (err == ERROR_PATH_NOT_FOUND) {
|
||||
fprintf(stderr,
|
||||
@ -255,9 +255,9 @@ os_file_get_last_error(void)
|
||||
ut_print_timestamp(stderr);
|
||||
|
||||
fprintf(stderr,
|
||||
" InnoDB: Operating system error number %li in a file operation.\n"
|
||||
" InnoDB: Operating system error number %lu in a file operation.\n"
|
||||
"InnoDB: See http://www.innodb.com/ibman.html for installation help.\n",
|
||||
(long) err);
|
||||
err);
|
||||
|
||||
if (err == ENOENT) {
|
||||
fprintf(stderr,
|
||||
@ -351,7 +351,8 @@ os_file_handle_error(
|
||||
fprintf(stderr, "InnoDB: File name %s\n", name);
|
||||
}
|
||||
|
||||
fprintf(stderr, "InnoDB: System call %s.\n", operation);
|
||||
fprintf(stderr, "InnoDB: File operation call: '%s'.\n",
|
||||
operation);
|
||||
fprintf(stderr, "InnoDB: Cannot continue operation.\n");
|
||||
|
||||
fflush(stderr);
|
||||
@ -599,7 +600,11 @@ os_file_create(
|
||||
file is created (if exists, error), OS_FILE_OVERWRITE
|
||||
if a new is created or an old overwritten */
|
||||
ulint purpose,/* in: OS_FILE_AIO, if asynchronous, non-buffered i/o
|
||||
is desired, OS_FILE_NORMAL, if any normal file */
|
||||
is desired, OS_FILE_NORMAL, if any normal file;
|
||||
NOTE that it also depends on type, os_aio_.. and srv_..
|
||||
variables whether we really use async i/o or
|
||||
unbuffered i/o: look in the function source code for
|
||||
the exact rules */
|
||||
ulint type, /* in: OS_DATA_FILE or OS_LOG_FILE */
|
||||
ibool* success)/* out: TRUE if succeed, FALSE if error */
|
||||
{
|
||||
@ -624,8 +629,8 @@ try_again:
|
||||
}
|
||||
|
||||
if (purpose == OS_FILE_AIO) {
|
||||
/* use asynchronous (overlapped) io and no buffering
|
||||
of writes in the OS */
|
||||
/* If specified, use asynchronous (overlapped) io and no
|
||||
buffering of writes in the OS */
|
||||
attributes = 0;
|
||||
#ifdef WIN_ASYNC_IO
|
||||
if (os_aio_use_native_aio) {
|
||||
@ -633,17 +638,13 @@ try_again:
|
||||
}
|
||||
#endif
|
||||
#ifdef UNIV_NON_BUFFERED_IO
|
||||
if (type == OS_LOG_FILE) {
|
||||
if (type == OS_LOG_FILE && srv_flush_log_at_trx_commit == 2) {
|
||||
/* Do not use unbuffered i/o to log files because
|
||||
to allow group commit to work when MySQL binlogging
|
||||
is used we must separate log file write and log
|
||||
file flush to disk. */
|
||||
} else {
|
||||
if (srv_win_file_flush_method ==
|
||||
value 2 denotes that we do not flush the log at every
|
||||
commit, but only once per second */
|
||||
} else if (srv_win_file_flush_method ==
|
||||
SRV_WIN_IO_UNBUFFERED) {
|
||||
attributes = attributes
|
||||
| FILE_FLAG_NO_BUFFERING;
|
||||
}
|
||||
attributes = attributes | FILE_FLAG_NO_BUFFERING;
|
||||
}
|
||||
#endif
|
||||
} else if (purpose == OS_FILE_NORMAL) {
|
||||
@ -653,12 +654,9 @@ try_again:
|
||||
/* Do not use unbuffered i/o to log files because
|
||||
value 2 denotes that we do not flush the log at every
|
||||
commit, but only once per second */
|
||||
} else {
|
||||
if (srv_win_file_flush_method ==
|
||||
} else if (srv_win_file_flush_method ==
|
||||
SRV_WIN_IO_UNBUFFERED) {
|
||||
attributes = attributes
|
||||
| FILE_FLAG_NO_BUFFERING;
|
||||
}
|
||||
attributes = attributes | FILE_FLAG_NO_BUFFERING;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
@ -700,29 +698,69 @@ try_again:
|
||||
os_file_t file;
|
||||
int create_flag;
|
||||
ibool retry;
|
||||
const char* mode_str = NULL;
|
||||
const char* type_str = NULL;
|
||||
const char* purpose_str = NULL;
|
||||
|
||||
try_again:
|
||||
ut_a(name);
|
||||
|
||||
if (create_mode == OS_FILE_OPEN) {
|
||||
mode_str = "OPEN";
|
||||
|
||||
create_flag = O_RDWR;
|
||||
} else if (create_mode == OS_FILE_CREATE) {
|
||||
mode_str = "CREATE";
|
||||
|
||||
create_flag = O_RDWR | O_CREAT | O_EXCL;
|
||||
} else if (create_mode == OS_FILE_OVERWRITE) {
|
||||
mode_str = "OVERWRITE";
|
||||
|
||||
create_flag = O_RDWR | O_CREAT | O_TRUNC;
|
||||
} else {
|
||||
create_flag = 0;
|
||||
ut_error;
|
||||
}
|
||||
|
||||
UT_NOT_USED(purpose);
|
||||
if (type == OS_LOG_FILE) {
|
||||
type_str = "LOG";
|
||||
} else if (type == OS_DATA_FILE) {
|
||||
type_str = "DATA";
|
||||
} else {
|
||||
ut_a(0);
|
||||
}
|
||||
|
||||
if (purpose == OS_FILE_AIO) {
|
||||
purpose_str = "AIO";
|
||||
} else if (purpose == OS_FILE_NORMAL) {
|
||||
purpose_str = "NORMAL";
|
||||
} else {
|
||||
ut_a(0);
|
||||
}
|
||||
|
||||
/* printf("Opening file %s, mode %s, type %s, purpose %s\n",
|
||||
name, mode_str, type_str, purpose_str); */
|
||||
#ifdef O_SYNC
|
||||
if ((!srv_use_doublewrite_buf || type != OS_DATA_FILE)
|
||||
/* We let O_SYNC only affect log files; note that we map O_DSYNC to
|
||||
O_SYNC because the datasync options seemed to corrupt files in 2001
|
||||
in both Linux and Solaris */
|
||||
if (type == OS_LOG_FILE
|
||||
&& srv_unix_file_flush_method == SRV_UNIX_O_DSYNC) {
|
||||
|
||||
/* printf("Using O_SYNC for file %s\n", name); */
|
||||
|
||||
create_flag = create_flag | O_SYNC;
|
||||
}
|
||||
#endif
|
||||
#ifdef O_DIRECT
|
||||
/* We let O_DIRECT only affect data files */
|
||||
if (type != OS_LOG_FILE
|
||||
&& srv_unix_file_flush_method == SRV_UNIX_O_DIRECT) {
|
||||
|
||||
/* printf("Using O_DIRECT for file %s\n", name); */
|
||||
|
||||
create_flag = create_flag | O_DIRECT;
|
||||
}
|
||||
#endif
|
||||
if (create_mode == OS_FILE_CREATE) {
|
||||
file = open(name, create_flag, os_innodb_umask);
|
||||
@ -1319,6 +1357,7 @@ os_file_write(
|
||||
DWORD high;
|
||||
ulint i;
|
||||
ulint n_retries = 0;
|
||||
ulint err;
|
||||
|
||||
ut_a((offset & 0xFFFFFFFF) == offset);
|
||||
|
||||
@ -1386,18 +1425,27 @@ retry:
|
||||
|
||||
if (!os_has_said_disk_full) {
|
||||
|
||||
err = (ulint)GetLastError();
|
||||
|
||||
ut_print_timestamp(stderr);
|
||||
|
||||
fprintf(stderr,
|
||||
" InnoDB: Error: Write to file %s failed at offset %lu %lu.\n"
|
||||
"InnoDB: %lu bytes should have been written, only %lu were written.\n"
|
||||
"InnoDB: Operating system error number %lu.\n"
|
||||
"InnoDB: Look from section 13.2 at http://www.innodb.com/ibman.html\n"
|
||||
"InnoDB: what the error number means.\n"
|
||||
"InnoDB: Check that your OS and file system support files of this size.\n"
|
||||
"InnoDB: Check also that the disk is not full or a disk quota exceeded.\n",
|
||||
name, offset_high, offset, n, (ulint)len,
|
||||
(ulint)GetLastError());
|
||||
err);
|
||||
|
||||
if (strerror((int)err) != NULL) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Error number %lu means '%s'.\n", err, strerror((int)err));
|
||||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"InnoDB: See also section 13.2 at http://www.innodb.com/ibman.html\n"
|
||||
"InnoDB: about operating system error numbers.\n");
|
||||
|
||||
os_has_said_disk_full = TRUE;
|
||||
}
|
||||
@ -1421,12 +1469,19 @@ retry:
|
||||
" InnoDB: Error: Write to file %s failed at offset %lu %lu.\n"
|
||||
"InnoDB: %lu bytes should have been written, only %ld were written.\n"
|
||||
"InnoDB: Operating system error number %lu.\n"
|
||||
"InnoDB: Look from section 13.2 at http://www.innodb.com/ibman.html\n"
|
||||
"InnoDB: what the error number means or use the perror program of MySQL.\n"
|
||||
"InnoDB: Check that your OS and file system support files of this size.\n"
|
||||
"InnoDB: Check also that the disk is not full or a disk quota exceeded.\n",
|
||||
name, offset_high, offset, n, (long int)ret,
|
||||
(ulint)errno);
|
||||
if (strerror(errno) != NULL) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Error number %lu means '%s'.\n", (ulint)errno, strerror(errno));
|
||||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"InnoDB: See also section 13.2 at http://www.innodb.com/ibman.html\n"
|
||||
"InnoDB: about operating system error numbers.\n");
|
||||
|
||||
os_has_said_disk_full = TRUE;
|
||||
}
|
||||
|
||||
|
@ -1758,9 +1758,9 @@ srv_conc_enter_innodb(
|
||||
|
||||
return;
|
||||
}
|
||||
retry:
|
||||
os_fast_mutex_lock(&srv_conc_mutex);
|
||||
|
||||
os_fast_mutex_lock(&srv_conc_mutex);
|
||||
retry:
|
||||
if (trx->declared_to_be_inside_innodb) {
|
||||
ut_print_timestamp(stderr);
|
||||
|
||||
@ -1769,6 +1769,9 @@ retry:
|
||||
fprintf(stderr,
|
||||
" InnoDB: Error: trying to declare trx to enter InnoDB, but\n"
|
||||
"InnoDB: it already is declared.\n%s\n", err_buf);
|
||||
os_fast_mutex_unlock(&srv_conc_mutex);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (srv_conc_n_threads < (lint)srv_thread_concurrency) {
|
||||
@ -1782,8 +1785,8 @@ retry:
|
||||
return;
|
||||
}
|
||||
|
||||
/* If the transaction is not holding resources, let it sleep
|
||||
for 100 milliseconds, and try again then */
|
||||
/* If the transaction is not holding resources, let it sleep for 50
|
||||
milliseconds, and try again then */
|
||||
|
||||
if (!has_slept && !trx->has_search_latch
|
||||
&& NULL == UT_LIST_GET_FIRST(trx->trx_locks)) {
|
||||
@ -1791,9 +1794,15 @@ retry:
|
||||
has_slept = TRUE; /* We let is sleep only once to avoid
|
||||
starvation */
|
||||
|
||||
srv_conc_n_waiting_threads++;
|
||||
|
||||
os_fast_mutex_unlock(&srv_conc_mutex);
|
||||
|
||||
os_thread_sleep(100000);
|
||||
os_thread_sleep(50000);
|
||||
|
||||
os_fast_mutex_lock(&srv_conc_mutex);
|
||||
|
||||
srv_conc_n_waiting_threads--;
|
||||
|
||||
goto retry;
|
||||
}
|
||||
@ -2111,6 +2120,7 @@ srv_suspend_mysql_thread(
|
||||
double wait_time;
|
||||
trx_t* trx;
|
||||
ibool had_dict_lock = FALSE;
|
||||
ibool was_declared_inside_innodb = FALSE;
|
||||
|
||||
ut_ad(!mutex_own(&kernel_mutex));
|
||||
|
||||
@ -2158,11 +2168,16 @@ srv_suspend_mysql_thread(
|
||||
|
||||
mutex_exit(&kernel_mutex);
|
||||
|
||||
/* We must declare this OS thread to exit InnoDB, since a possible
|
||||
other thread holding a lock which this thread waits for must be
|
||||
allowed to enter, sooner or later */
|
||||
if (trx->declared_to_be_inside_innodb) {
|
||||
|
||||
srv_conc_force_exit_innodb(thr_get_trx(thr));
|
||||
was_declared_inside_innodb = TRUE;
|
||||
|
||||
/* We must declare this OS thread to exit InnoDB, since a
|
||||
possible other thread holding a lock which this thread waits
|
||||
for must be allowed to enter, sooner or later */
|
||||
|
||||
srv_conc_force_exit_innodb(trx);
|
||||
}
|
||||
|
||||
/* Release possible foreign key check latch */
|
||||
if (trx->dict_operation_lock_mode == RW_S_LATCH) {
|
||||
@ -2183,9 +2198,12 @@ srv_suspend_mysql_thread(
|
||||
row_mysql_freeze_data_dictionary(trx);
|
||||
}
|
||||
|
||||
if (was_declared_inside_innodb) {
|
||||
|
||||
/* Return back inside InnoDB */
|
||||
|
||||
srv_conc_force_enter_innodb(thr_get_trx(thr));
|
||||
srv_conc_force_enter_innodb(trx);
|
||||
}
|
||||
|
||||
mutex_enter(&kernel_mutex);
|
||||
|
||||
|
@ -1055,6 +1055,10 @@ innobase_start_or_create_for_mysql(void)
|
||||
(char*)"O_DSYNC")) {
|
||||
srv_unix_file_flush_method = SRV_UNIX_O_DSYNC;
|
||||
|
||||
} else if (0 == ut_strcmp(srv_file_flush_method_str,
|
||||
(char*)"O_DIRECT")) {
|
||||
srv_unix_file_flush_method = SRV_UNIX_O_DIRECT;
|
||||
|
||||
} else if (0 == ut_strcmp(srv_file_flush_method_str,
|
||||
(char*)"littlesync")) {
|
||||
srv_unix_file_flush_method = SRV_UNIX_LITTLESYNC;
|
||||
|
@ -9,7 +9,7 @@ insert into t1 values (1),(1);
|
||||
Duplicate entry '1' for key 1
|
||||
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 9306 1 master-bin.001 213 slave-relay-bin.002 254 master-bin.001 Yes Yes 0 0 213 254
|
||||
127.0.0.1 root MASTER_PORT 1 master-bin.001 213 slave-relay-bin.002 254 master-bin.001 Yes Yes 0 0 213 254
|
||||
show tables like 't1';
|
||||
Tables_in_test (t1)
|
||||
drop table t1;
|
||||
|
@ -12,6 +12,9 @@ save_master_pos;
|
||||
connection slave;
|
||||
# as the t1 table is ignored on the slave, the slave should be able to sync
|
||||
sync_with_master;
|
||||
# The port number is different when doing the release build with
|
||||
# Do-compile, hence we have to replace the port number here accordingly
|
||||
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
|
||||
show slave status;
|
||||
# check that the table has been ignored, because otherwise the test is nonsense
|
||||
show tables like 't1';
|
||||
|
@ -346,7 +346,7 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans)
|
||||
bool transaction_commited= 0;
|
||||
|
||||
/* Update the binary log if we have cached some queries */
|
||||
if (trans == &thd->transaction.all && mysql_bin_log.is_open() &&
|
||||
if (trans == &thd->transaction.all && mysql_bin_log.is_open(1) &&
|
||||
my_b_tell(&thd->transaction.trans_log))
|
||||
{
|
||||
mysql_bin_log.write(thd, &thd->transaction.trans_log);
|
||||
@ -385,7 +385,7 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans)
|
||||
if (transaction_commited && thd->transaction.changed_tables)
|
||||
query_cache.invalidate(thd->transaction.changed_tables);
|
||||
#endif /*HAVE_QUERY_CACHE*/
|
||||
if (error && trans == &thd->transaction.all && mysql_bin_log.is_open())
|
||||
if (error && trans == &thd->transaction.all && mysql_bin_log.is_open(1))
|
||||
sql_print_error("Error: Got error during commit; Binlog is not up to date!");
|
||||
thd->variables.tx_isolation=thd->session_tx_isolation;
|
||||
if (operation_done)
|
||||
|
@ -1504,7 +1504,7 @@ void item_user_lock_free(void)
|
||||
void item_user_lock_release(ULL *ull)
|
||||
{
|
||||
ull->locked=0;
|
||||
if (mysql_bin_log.is_open())
|
||||
if (mysql_bin_log.is_open(1))
|
||||
{
|
||||
char buf[256];
|
||||
String tmp(buf,sizeof(buf));
|
||||
|
110
sql/log.cc
110
sql/log.cc
@ -82,12 +82,14 @@ static int find_uniq_filename(char *name)
|
||||
|
||||
MYSQL_LOG::MYSQL_LOG()
|
||||
:bytes_written(0), last_time(0), query_start(0), name(0),
|
||||
file_id(1), open_count(1), log_type(LOG_CLOSED), write_error(0), inited(0),
|
||||
no_rotate(0), need_start_event(1)
|
||||
file_id(1), open_count(1), log_type(LOG_CLOSED), write_error(0),
|
||||
need_start_event(1)
|
||||
{
|
||||
/*
|
||||
We don't want to intialize LOCK_Log here as the thread system may
|
||||
not have been initailized yet. We do it instead at 'open'.
|
||||
We don't want to initialize LOCK_Log here as such initialization depends on
|
||||
safe_mutex (when using safe_mutex) which depends on MY_INIT(), which is
|
||||
called only in main(). Doing initialization here would make it happen before
|
||||
main().
|
||||
*/
|
||||
index_file_name[0] = 0;
|
||||
bzero((char*) &log_file,sizeof(log_file));
|
||||
@ -100,18 +102,35 @@ MYSQL_LOG::~MYSQL_LOG()
|
||||
cleanup();
|
||||
}
|
||||
|
||||
void MYSQL_LOG::cleanup()
|
||||
void MYSQL_LOG::cleanup() /* this is called only once */
|
||||
{
|
||||
if (inited)
|
||||
{
|
||||
close(1);
|
||||
inited= 0;
|
||||
(void) pthread_mutex_destroy(&LOCK_log);
|
||||
(void) pthread_mutex_destroy(&LOCK_index);
|
||||
(void) pthread_cond_destroy(&update_cond);
|
||||
}
|
||||
}
|
||||
|
||||
bool MYSQL_LOG::is_open(bool need_mutex)
|
||||
{
|
||||
/*
|
||||
Since MySQL 4.0.14, LOCK_log is always inited:
|
||||
* for log/update_log/slow_log/bin_log which are global objects, this is done in
|
||||
main(), even if the server does not use these logs.
|
||||
* for relay_log which belongs to rli which belongs to active_mi, this is
|
||||
done in the constructor of rli.
|
||||
In older versions, we were never 100% sure that LOCK_log was inited, which
|
||||
was a problem.
|
||||
*/
|
||||
if (need_mutex)
|
||||
{
|
||||
pthread_mutex_lock(&LOCK_log);
|
||||
bool res= (log_type != LOG_CLOSED);
|
||||
pthread_mutex_unlock(&LOCK_log);
|
||||
return res;
|
||||
}
|
||||
else
|
||||
return (log_type != LOG_CLOSED);
|
||||
}
|
||||
|
||||
int MYSQL_LOG::generate_new_name(char *new_name, const char *log_name)
|
||||
{
|
||||
@ -142,16 +161,15 @@ void MYSQL_LOG::init(enum_log_type log_type_arg,
|
||||
no_auto_events = no_auto_events_arg;
|
||||
max_size=max_size_arg;
|
||||
DBUG_PRINT("info",("log_type: %d max_size: %lu", log_type, max_size));
|
||||
if (!inited)
|
||||
{
|
||||
inited= 1;
|
||||
(void) pthread_mutex_init(&LOCK_log,MY_MUTEX_INIT_SLOW);
|
||||
(void) pthread_mutex_init(&LOCK_index, MY_MUTEX_INIT_SLOW);
|
||||
(void) pthread_cond_init(&update_cond, 0);
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
void MYSQL_LOG::init_pthread_objects()
|
||||
{
|
||||
(void) pthread_mutex_init(&LOCK_log,MY_MUTEX_INIT_SLOW);
|
||||
(void) pthread_mutex_init(&LOCK_index, MY_MUTEX_INIT_SLOW);
|
||||
(void) pthread_cond_init(&update_cond, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
Open a (new) log file.
|
||||
@ -182,8 +200,6 @@ bool MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
|
||||
last_time=query_start=0;
|
||||
write_error=0;
|
||||
|
||||
if (!inited && log_type_arg == LOG_BIN && *fn_ext(log_name))
|
||||
no_rotate = 1;
|
||||
init(log_type_arg,io_cache_type_arg,no_auto_events_arg,max_size);
|
||||
|
||||
if (!(name=my_strdup(log_name,MYF(MY_WME))))
|
||||
@ -631,7 +647,7 @@ int MYSQL_LOG::purge_first_log(struct st_relay_log_info* rli)
|
||||
Assume that we have previously read the first log and
|
||||
stored it in rli->relay_log_name
|
||||
*/
|
||||
DBUG_ASSERT(is_open());
|
||||
DBUG_ASSERT(is_open(1));
|
||||
DBUG_ASSERT(rli->slave_running == 1);
|
||||
DBUG_ASSERT(!strcmp(rli->linfo.log_file_name,rli->relay_log_name));
|
||||
DBUG_ASSERT(rli->linfo.index_file_offset ==
|
||||
@ -705,7 +721,6 @@ err:
|
||||
|
||||
RETURN VALUES
|
||||
0 ok
|
||||
LOG_INFO_PURGE_NO_ROTATE Binary file that can't be rotated
|
||||
LOG_INFO_EOF to_log not found
|
||||
*/
|
||||
|
||||
@ -715,9 +730,6 @@ int MYSQL_LOG::purge_logs(THD* thd, const char* to_log)
|
||||
LOG_INFO log_info;
|
||||
DBUG_ENTER("purge_logs");
|
||||
|
||||
if (no_rotate)
|
||||
DBUG_RETURN(LOG_INFO_PURGE_NO_ROTATE);
|
||||
|
||||
pthread_mutex_lock(&LOCK_index);
|
||||
if ((error=find_log_pos(&log_info, to_log, 0 /*no mutex*/)))
|
||||
goto err;
|
||||
@ -770,14 +782,11 @@ err:
|
||||
|
||||
void MYSQL_LOG::make_log_name(char* buf, const char* log_ident)
|
||||
{
|
||||
if (inited) // QQ When is this not true ?
|
||||
{
|
||||
uint dir_len = dirname_length(log_file_name);
|
||||
if (dir_len > FN_REFLEN)
|
||||
dir_len=FN_REFLEN-1;
|
||||
strnmov(buf, log_file_name, dir_len);
|
||||
strmake(buf+dir_len, log_ident, FN_REFLEN - dir_len);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -787,7 +796,7 @@ void MYSQL_LOG::make_log_name(char* buf, const char* log_ident)
|
||||
|
||||
bool MYSQL_LOG::is_active(const char *log_file_name_arg)
|
||||
{
|
||||
return inited && !strcmp(log_file_name, log_file_name_arg);
|
||||
return !strcmp(log_file_name, log_file_name_arg);
|
||||
}
|
||||
|
||||
|
||||
@ -809,7 +818,7 @@ void MYSQL_LOG::new_file(bool need_lock)
|
||||
enum_log_type save_log_type;
|
||||
|
||||
DBUG_ENTER("MYSQL_LOG::new_file");
|
||||
if (!is_open())
|
||||
if (!is_open(need_lock))
|
||||
{
|
||||
DBUG_PRINT("info",("log is closed"));
|
||||
DBUG_VOID_RETURN;
|
||||
@ -826,12 +835,6 @@ void MYSQL_LOG::new_file(bool need_lock)
|
||||
// Reuse old name if not binlog and not update log
|
||||
new_name_ptr= name;
|
||||
|
||||
/*
|
||||
Only rotate open logs that are marked non-rotatable
|
||||
(binlog with constant name are non-rotatable)
|
||||
*/
|
||||
if (!no_rotate)
|
||||
{
|
||||
/*
|
||||
If user hasn't specified an extension, generate a new log name
|
||||
We have to do this here and not in open as we want to store the
|
||||
@ -870,13 +873,14 @@ void MYSQL_LOG::new_file(bool need_lock)
|
||||
*/
|
||||
signal_update();
|
||||
}
|
||||
}
|
||||
old_name=name;
|
||||
save_log_type=log_type;
|
||||
name=0; // Don't free name
|
||||
close();
|
||||
|
||||
// TODO: at this place is_open() will see the log closed, which is BUG#791.
|
||||
/*
|
||||
Note that at this point, log_type == LOG_CLOSED (important for is_open()).
|
||||
*/
|
||||
|
||||
open(old_name, save_log_type, new_name_ptr, index_file_name, io_cache_type,
|
||||
no_auto_events, max_size);
|
||||
@ -967,12 +971,11 @@ err:
|
||||
bool MYSQL_LOG::write(THD *thd,enum enum_server_command command,
|
||||
const char *format,...)
|
||||
{
|
||||
if (is_open() && (what_to_log & (1L << (uint) command)))
|
||||
if (what_to_log & (1L << (uint) command))
|
||||
{
|
||||
int error=0;
|
||||
VOID(pthread_mutex_lock(&LOCK_log));
|
||||
|
||||
/* Test if someone closed between the is_open test and lock */
|
||||
if (is_open())
|
||||
{
|
||||
time_t skr;
|
||||
@ -1055,14 +1058,13 @@ bool MYSQL_LOG::write(Log_event* event_info)
|
||||
bool error=0;
|
||||
DBUG_ENTER("MYSQL_LOG::write(event)");
|
||||
|
||||
if (!inited) // Can't use mutex if not init
|
||||
{
|
||||
DBUG_PRINT("error",("not initied"));
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
pthread_mutex_lock(&LOCK_log);
|
||||
|
||||
/* In most cases this is only called if 'is_open()' is true */
|
||||
/*
|
||||
In most cases this is only called if 'is_open()' is true; in fact this is
|
||||
mostly called if is_open() *was* true a few instructions before, but it
|
||||
could have changed since.
|
||||
*/
|
||||
if (is_open())
|
||||
{
|
||||
bool should_rotate = 0;
|
||||
@ -1076,7 +1078,14 @@ bool MYSQL_LOG::write(Log_event* event_info)
|
||||
#endif
|
||||
if ((thd && !(thd->options & OPTION_BIN_LOG) &&
|
||||
(thd->master_access & SUPER_ACL)) ||
|
||||
(local_db && !db_ok(local_db, binlog_do_db, binlog_ignore_db)))
|
||||
(local_db && !db_ok(local_db, binlog_do_db, binlog_ignore_db))
|
||||
/*
|
||||
This is the place for future tests like "do the involved tables match
|
||||
(to be implemented) binlog_[wild_]{do|ignore}_table?" (WL#1049):
|
||||
we will add a
|
||||
&& ... to the if().
|
||||
*/
|
||||
)
|
||||
{
|
||||
VOID(pthread_mutex_unlock(&LOCK_log));
|
||||
DBUG_PRINT("error",("!db_ok"));
|
||||
@ -1380,8 +1389,6 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
|
||||
time_t query_start_arg)
|
||||
{
|
||||
bool error=0;
|
||||
if (is_open())
|
||||
{
|
||||
time_t current_time;
|
||||
VOID(pthread_mutex_lock(&LOCK_log));
|
||||
if (is_open())
|
||||
@ -1493,7 +1500,6 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
|
||||
}
|
||||
}
|
||||
VOID(pthread_mutex_unlock(&LOCK_log));
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
@ -1591,14 +1597,12 @@ void MYSQL_LOG::set_max_size(ulong max_size_arg)
|
||||
uses the old_max_size argument, so max_size_arg has been overwritten and
|
||||
it's like if the SET command was never run.
|
||||
*/
|
||||
if (is_open())
|
||||
{
|
||||
DBUG_ENTER("MYSQL_LOG::set_max_size");
|
||||
pthread_mutex_lock(&LOCK_log);
|
||||
pthread_mutex_lock(&LOCK_index);
|
||||
if (is_open())
|
||||
max_size= max_size_arg;
|
||||
pthread_mutex_unlock(&LOCK_index);
|
||||
pthread_mutex_unlock(&LOCK_log);
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2167,7 +2167,7 @@ int Rand_log_event::exec_event(struct st_relay_log_info* rli)
|
||||
|
||||
int Slave_log_event::exec_event(struct st_relay_log_info* rli)
|
||||
{
|
||||
if (mysql_bin_log.is_open())
|
||||
if (mysql_bin_log.is_open(1))
|
||||
mysql_bin_log.write(this);
|
||||
return Log_event::exec_event(rli);
|
||||
}
|
||||
@ -2217,7 +2217,7 @@ int Create_file_log_event::exec_event(struct st_relay_log_info* rli)
|
||||
slave_print_error(rli,my_errno, "Write to '%s' failed", fname_buf);
|
||||
goto err;
|
||||
}
|
||||
if (mysql_bin_log.is_open())
|
||||
if (mysql_bin_log.is_open(1))
|
||||
mysql_bin_log.write(this);
|
||||
error=0; // Everything is ok
|
||||
|
||||
@ -2237,7 +2237,7 @@ int Delete_file_log_event::exec_event(struct st_relay_log_info* rli)
|
||||
(void) my_delete(fname, MYF(MY_WME));
|
||||
memcpy(p, ".info", 6);
|
||||
(void) my_delete(fname, MYF(MY_WME));
|
||||
if (mysql_bin_log.is_open())
|
||||
if (mysql_bin_log.is_open(1))
|
||||
mysql_bin_log.write(this);
|
||||
return Log_event::exec_event(rli);
|
||||
}
|
||||
@ -2260,7 +2260,7 @@ int Append_block_log_event::exec_event(struct st_relay_log_info* rli)
|
||||
slave_print_error(rli,my_errno, "Write to '%s' failed", fname);
|
||||
goto err;
|
||||
}
|
||||
if (mysql_bin_log.is_open())
|
||||
if (mysql_bin_log.is_open(1))
|
||||
mysql_bin_log.write(this);
|
||||
error=0;
|
||||
|
||||
@ -2319,7 +2319,7 @@ int Execute_load_log_event::exec_event(struct st_relay_log_info* rli)
|
||||
(void) my_delete(fname, MYF(MY_WME));
|
||||
memcpy(p, ".data", 6);
|
||||
(void) my_delete(fname, MYF(MY_WME));
|
||||
if (mysql_bin_log.is_open())
|
||||
if (mysql_bin_log.is_open(1))
|
||||
mysql_bin_log.write(this);
|
||||
error = 0;
|
||||
|
||||
|
@ -1966,13 +1966,10 @@ bool open_log(MYSQL_LOG *log, const char *hostname,
|
||||
if (type == LOG_BIN)
|
||||
{
|
||||
char *p = fn_ext(opt_name);
|
||||
if (p)
|
||||
{
|
||||
uint length=(uint) (p-opt_name);
|
||||
strmake(tmp,opt_name,min(length,FN_REFLEN));
|
||||
opt_name=tmp;
|
||||
}
|
||||
}
|
||||
return log->open(opt_name, type, 0, index_file_name,
|
||||
(read_append) ? SEQ_READ_APPEND : WRITE_CACHE,
|
||||
no_auto_events, max_size);
|
||||
@ -2019,6 +2016,17 @@ int main(int argc, char **argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
Init mutexes for the global MYSQL_LOG objects.
|
||||
As safe_mutex depends on what MY_INIT() does, we can't init the mutexes of
|
||||
global MYSQL_LOGs in their constructors, because then they would be inited
|
||||
before MY_INIT(). So we do it here.
|
||||
*/
|
||||
mysql_log.init_pthread_objects();
|
||||
mysql_update_log.init_pthread_objects();
|
||||
mysql_slow_log.init_pthread_objects();
|
||||
mysql_bin_log.init_pthread_objects();
|
||||
|
||||
if (gethostname(glob_hostname,sizeof(glob_hostname)-4) < 0)
|
||||
strmov(glob_hostname,"mysql");
|
||||
strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5);
|
||||
|
@ -265,7 +265,7 @@ int translate_master(THD* thd, LEX_MASTER_INFO* mi, char* errmsg)
|
||||
LINT_INIT(cmp_res);
|
||||
DBUG_ENTER("translate_master");
|
||||
|
||||
if (!mysql_bin_log.is_open())
|
||||
if (!mysql_bin_log.is_open(1))
|
||||
{
|
||||
strmov(errmsg,"Binary log is not open");
|
||||
DBUG_RETURN(1);
|
||||
|
14
sql/slave.cc
14
sql/slave.cc
@ -1736,6 +1736,7 @@ st_relay_log_info::st_relay_log_info()
|
||||
pthread_cond_init(&start_cond, NULL);
|
||||
pthread_cond_init(&stop_cond, NULL);
|
||||
pthread_cond_init(&log_space_cond, NULL);
|
||||
relay_log.init_pthread_objects();
|
||||
}
|
||||
|
||||
|
||||
@ -3443,14 +3444,18 @@ void rotate_relay_log(MASTER_INFO* mi)
|
||||
{
|
||||
DBUG_ENTER("rotate_relay_log");
|
||||
RELAY_LOG_INFO* rli= &mi->rli;
|
||||
/* If this server is not a slave (or RESET SLAVE has just been run) */
|
||||
|
||||
lock_slave_threads(mi);
|
||||
pthread_mutex_lock(&rli->data_lock);
|
||||
/*
|
||||
We need to test inited because otherwise, new_file() will attempt to lock
|
||||
LOCK_log, which may not be inited (if we're not a slave).
|
||||
*/
|
||||
if (!rli->inited)
|
||||
{
|
||||
DBUG_PRINT("info", ("rli->inited == 0"));
|
||||
DBUG_VOID_RETURN;
|
||||
goto end;
|
||||
}
|
||||
lock_slave_threads(mi);
|
||||
pthread_mutex_lock(&rli->data_lock);
|
||||
|
||||
/* If the relay log is closed, new_file() will do nothing. */
|
||||
rli->relay_log.new_file(1);
|
||||
@ -3469,6 +3474,7 @@ void rotate_relay_log(MASTER_INFO* mi)
|
||||
0 as they probably have been harvested.
|
||||
*/
|
||||
rli->relay_log.harvest_bytes_written(&rli->log_space_total);
|
||||
end:
|
||||
pthread_mutex_unlock(&rli->data_lock);
|
||||
unlock_slave_threads(mi);
|
||||
DBUG_VOID_RETURN;
|
||||
|
@ -574,7 +574,7 @@ void close_temporary_tables(THD *thd)
|
||||
next=table->next;
|
||||
close_temporary(table);
|
||||
}
|
||||
if (query && found_user_tables && mysql_bin_log.is_open())
|
||||
if (query && found_user_tables && mysql_bin_log.is_open(1))
|
||||
{
|
||||
/* The -1 is to remove last ',' */
|
||||
Query_log_event qinfo(thd, query, (ulong)(end-query)-1, 0);
|
||||
|
@ -39,7 +39,6 @@ enum enum_delay_key_write { DELAY_KEY_WRITE_NONE, DELAY_KEY_WRITE_ON,
|
||||
#define LOG_INFO_IO -2
|
||||
#define LOG_INFO_INVALID -3
|
||||
#define LOG_INFO_SEEK -4
|
||||
#define LOG_INFO_PURGE_NO_ROTATE -5
|
||||
#define LOG_INFO_MEM -6
|
||||
#define LOG_INFO_FATAL -7
|
||||
#define LOG_INFO_IN_USE -8
|
||||
@ -61,6 +60,11 @@ class Log_event;
|
||||
|
||||
class MYSQL_LOG {
|
||||
private:
|
||||
/*
|
||||
LOCK_log is inited by MYSQL_LOG::init(), so one should try to lock it only
|
||||
if he is sure MYSQL_LOG::init() has been called (i.e. if 'inited' is true).
|
||||
Same for LOCK_index.
|
||||
*/
|
||||
pthread_mutex_t LOCK_log, LOCK_index;
|
||||
pthread_cond_t update_cond;
|
||||
ulonglong bytes_written;
|
||||
@ -80,8 +84,7 @@ class MYSQL_LOG {
|
||||
*/
|
||||
volatile enum_log_type log_type;
|
||||
enum cache_type io_cache_type;
|
||||
bool write_error,inited;
|
||||
bool no_rotate;
|
||||
bool write_error;
|
||||
bool need_start_event;
|
||||
bool no_auto_events; // for relay binlog
|
||||
/*
|
||||
@ -123,6 +126,7 @@ public:
|
||||
void init(enum_log_type log_type_arg,
|
||||
enum cache_type io_cache_type_arg,
|
||||
bool no_auto_events_arg, ulong max_size);
|
||||
void init_pthread_objects();
|
||||
void cleanup();
|
||||
bool open(const char *log_name,enum_log_type log_type,
|
||||
const char *new_name, const char *index_file_name_arg,
|
||||
@ -158,8 +162,8 @@ public:
|
||||
int find_next_log(LOG_INFO* linfo, bool need_mutex);
|
||||
int get_current_log(LOG_INFO* linfo);
|
||||
uint next_file_id();
|
||||
bool is_open(bool need_mutex=0);
|
||||
|
||||
inline bool is_open() { return log_type != LOG_CLOSED; }
|
||||
inline char* get_index_fname() { return index_file_name;}
|
||||
inline char* get_log_fname() { return log_file_name; }
|
||||
inline pthread_mutex_t* get_log_lock() { return &LOCK_log; }
|
||||
|
@ -84,7 +84,7 @@ int mysql_create_db(THD *thd, char *db, uint create_options, bool silent)
|
||||
}
|
||||
{
|
||||
mysql_update_log.write(thd,thd->query, thd->query_length);
|
||||
if (mysql_bin_log.is_open())
|
||||
if (mysql_bin_log.is_open(1))
|
||||
{
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
|
||||
mysql_bin_log.write(&qinfo);
|
||||
@ -174,7 +174,7 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
|
||||
thd->query= path;
|
||||
}
|
||||
mysql_update_log.write(thd, thd->query, thd->query_length);
|
||||
if (mysql_bin_log.is_open())
|
||||
if (mysql_bin_log.is_open(1))
|
||||
{
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
|
||||
mysql_bin_log.write(&qinfo);
|
||||
|
@ -172,7 +172,7 @@ cleanup:
|
||||
if (deleted && (error <= 0 || !transactional_table))
|
||||
{
|
||||
mysql_update_log.write(thd,thd->query, thd->query_length);
|
||||
if (mysql_bin_log.is_open())
|
||||
if (mysql_bin_log.is_open(1))
|
||||
{
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length,
|
||||
log_delayed);
|
||||
@ -476,7 +476,7 @@ bool multi_delete::send_eof()
|
||||
if (deleted && (error <= 0 || normal_tables))
|
||||
{
|
||||
mysql_update_log.write(thd,thd->query,thd->query_length);
|
||||
if (mysql_bin_log.is_open())
|
||||
if (mysql_bin_log.is_open(1))
|
||||
{
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length,
|
||||
log_delayed);
|
||||
@ -588,7 +588,7 @@ end:
|
||||
if (!error)
|
||||
{
|
||||
mysql_update_log.write(thd,thd->query,thd->query_length);
|
||||
if (mysql_bin_log.is_open())
|
||||
if (mysql_bin_log.is_open(1))
|
||||
{
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length,
|
||||
thd->tmp_table);
|
||||
|
@ -308,7 +308,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
|
||||
if ((info.copied || info.deleted) && (error <= 0 || !transactional_table))
|
||||
{
|
||||
mysql_update_log.write(thd, thd->query, thd->query_length);
|
||||
if (mysql_bin_log.is_open())
|
||||
if (mysql_bin_log.is_open(1))
|
||||
{
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length,
|
||||
log_delayed);
|
||||
@ -1143,7 +1143,7 @@ bool delayed_insert::handle_inserts(void)
|
||||
{
|
||||
int error;
|
||||
uint max_rows;
|
||||
bool using_ignore=0, using_bin_log=mysql_bin_log.is_open();
|
||||
bool using_ignore=0, using_bin_log=mysql_bin_log.is_open(1);
|
||||
delayed_row *row;
|
||||
DBUG_ENTER("handle_inserts");
|
||||
|
||||
@ -1361,7 +1361,7 @@ void select_insert::send_error(uint errcode,const char *err)
|
||||
if (last_insert_id)
|
||||
thd->insert_id(last_insert_id); // For binary log
|
||||
mysql_update_log.write(thd,thd->query,thd->query_length);
|
||||
if (mysql_bin_log.is_open())
|
||||
if (mysql_bin_log.is_open(1))
|
||||
{
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length,
|
||||
table->file->has_transactions());
|
||||
@ -1387,7 +1387,7 @@ bool select_insert::send_eof()
|
||||
thd->insert_id(last_insert_id); // For binary log
|
||||
/* Write to binlog before commiting transaction */
|
||||
mysql_update_log.write(thd,thd->query,thd->query_length);
|
||||
if (mysql_bin_log.is_open())
|
||||
if (mysql_bin_log.is_open(1))
|
||||
{
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length,
|
||||
table->file->has_transactions());
|
||||
|
@ -219,7 +219,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
||||
DBUG_RETURN(-1); // Can't allocate buffers
|
||||
}
|
||||
|
||||
if (!opt_old_rpl_compat && mysql_bin_log.is_open())
|
||||
if (!opt_old_rpl_compat && mysql_bin_log.is_open(1))
|
||||
{
|
||||
lf_info.thd = thd;
|
||||
lf_info.ex = ex;
|
||||
@ -281,7 +281,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
||||
{
|
||||
if (transactional_table)
|
||||
ha_autocommit_or_rollback(thd,error);
|
||||
if (!opt_old_rpl_compat && mysql_bin_log.is_open())
|
||||
if (!opt_old_rpl_compat && mysql_bin_log.is_open(1))
|
||||
{
|
||||
if (lf_info.wrote_create_file)
|
||||
{
|
||||
@ -315,7 +315,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
||||
|
||||
if (!log_delayed)
|
||||
thd->options|=OPTION_STATUS_NO_TRANS_UPDATE;
|
||||
if (mysql_bin_log.is_open())
|
||||
if (mysql_bin_log.is_open(1))
|
||||
{
|
||||
if (opt_old_rpl_compat)
|
||||
{
|
||||
@ -607,7 +607,7 @@ READ_INFO::READ_INFO(File file_par, uint tot_length, String &field_term,
|
||||
cache.read_function = _my_b_net_read;
|
||||
|
||||
need_end_io_cache = 1;
|
||||
if (!opt_old_rpl_compat && mysql_bin_log.is_open())
|
||||
if (!opt_old_rpl_compat && mysql_bin_log.is_open(1))
|
||||
cache.pre_read = cache.pre_close =
|
||||
(IO_CACHE_CALLBACK) log_loaded_block;
|
||||
}
|
||||
|
@ -2432,7 +2432,7 @@ mysql_execute_command(void)
|
||||
lex->sql_command == SQLCOM_REVOKE)))
|
||||
{
|
||||
mysql_update_log.write(thd, thd->query, thd->query_length);
|
||||
if (mysql_bin_log.is_open())
|
||||
if (mysql_bin_log.is_open(1))
|
||||
{
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
|
||||
mysql_bin_log.write(&qinfo);
|
||||
@ -2452,7 +2452,7 @@ mysql_execute_command(void)
|
||||
if (!res)
|
||||
{
|
||||
mysql_update_log.write(thd, thd->query, thd->query_length);
|
||||
if (mysql_bin_log.is_open())
|
||||
if (mysql_bin_log.is_open(1))
|
||||
{
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
|
||||
mysql_bin_log.write(&qinfo);
|
||||
|
@ -80,7 +80,7 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list)
|
||||
if (!error)
|
||||
{
|
||||
mysql_update_log.write(thd,thd->query,thd->query_length);
|
||||
if (mysql_bin_log.is_open())
|
||||
if (mysql_bin_log.is_open(1))
|
||||
{
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
|
||||
mysql_bin_log.write(&qinfo);
|
||||
|
@ -269,7 +269,7 @@ int purge_master_logs(THD* thd, const char* to_log)
|
||||
const char* errmsg = 0;
|
||||
int res;
|
||||
|
||||
if (!mysql_bin_log.is_open())
|
||||
if (!mysql_bin_log.is_open(1))
|
||||
goto end;
|
||||
|
||||
mysql_bin_log.make_log_name(search_file_name, to_log);
|
||||
@ -282,8 +282,6 @@ int purge_master_logs(THD* thd, const char* to_log)
|
||||
case LOG_INFO_INVALID: errmsg = "Server configuration does not permit \
|
||||
binlog purge"; break;
|
||||
case LOG_INFO_SEEK: errmsg = "Failed on fseek()"; break;
|
||||
case LOG_INFO_PURGE_NO_ROTATE: errmsg = "Cannot purge unrotatable log";
|
||||
break;
|
||||
case LOG_INFO_MEM: errmsg = "Out of memory"; break;
|
||||
case LOG_INFO_FATAL: errmsg = "Fatal error during purge"; break;
|
||||
case LOG_INFO_IN_USE: errmsg = "A purgeable log is in use, will not purge";
|
||||
@ -335,7 +333,7 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos,
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!mysql_bin_log.is_open())
|
||||
if (!mysql_bin_log.is_open(1))
|
||||
{
|
||||
errmsg = "Binary log is not open";
|
||||
my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG;
|
||||
@ -972,7 +970,7 @@ int change_master(THD* thd, MASTER_INFO* mi)
|
||||
|
||||
int reset_master(THD* thd)
|
||||
{
|
||||
if (!mysql_bin_log.is_open())
|
||||
if (!mysql_bin_log.is_open(1))
|
||||
{
|
||||
my_error(ER_FLUSH_MASTER_BINLOG_CLOSED, MYF(ME_BELL+ME_WAITTANG));
|
||||
return 1;
|
||||
@ -1010,7 +1008,7 @@ int show_binlog_events(THD* thd)
|
||||
if (send_fields(thd, field_list, 1))
|
||||
DBUG_RETURN(-1);
|
||||
|
||||
if (mysql_bin_log.is_open())
|
||||
if (mysql_bin_log.is_open(1))
|
||||
{
|
||||
LEX_MASTER_INFO *lex_mi = &thd->lex.mi;
|
||||
ha_rows event_count, limit_start, limit_end;
|
||||
@ -1110,7 +1108,7 @@ int show_binlog_info(THD* thd)
|
||||
String* packet = &thd->packet;
|
||||
packet->length(0);
|
||||
|
||||
if (mysql_bin_log.is_open())
|
||||
if (mysql_bin_log.is_open(1))
|
||||
{
|
||||
LOG_INFO li;
|
||||
mysql_bin_log.get_current_log(&li);
|
||||
@ -1128,7 +1126,7 @@ int show_binlog_info(THD* thd)
|
||||
|
||||
|
||||
/*
|
||||
Send a lost of all binary logs to client
|
||||
Send a list of all binary logs to client
|
||||
|
||||
SYNOPSIS
|
||||
show_binlogs()
|
||||
@ -1148,7 +1146,7 @@ int show_binlogs(THD* thd)
|
||||
String *packet = &thd->packet;
|
||||
uint length;
|
||||
|
||||
if (!mysql_bin_log.is_open())
|
||||
if (!mysql_bin_log.is_open(1))
|
||||
{
|
||||
//TODO: Replace with ER() error message
|
||||
send_error(net, 0, "You are not using binary logging");
|
||||
|
@ -235,7 +235,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
|
||||
if (!dont_log_query)
|
||||
{
|
||||
mysql_update_log.write(thd, thd->query,thd->query_length);
|
||||
if (mysql_bin_log.is_open())
|
||||
if (mysql_bin_log.is_open(1))
|
||||
{
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length,
|
||||
tmp_table_deleted && !some_tables_deleted);
|
||||
@ -766,7 +766,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
|
||||
{
|
||||
// Must be written before unlock
|
||||
mysql_update_log.write(thd,thd->query, thd->query_length);
|
||||
if (mysql_bin_log.is_open())
|
||||
if (mysql_bin_log.is_open(1))
|
||||
{
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length,
|
||||
test(create_info->options &
|
||||
@ -1548,7 +1548,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||
if (!error)
|
||||
{
|
||||
mysql_update_log.write(thd, thd->query, thd->query_length);
|
||||
if (mysql_bin_log.is_open())
|
||||
if (mysql_bin_log.is_open(1))
|
||||
{
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
|
||||
mysql_bin_log.write(&qinfo);
|
||||
@ -1918,7 +1918,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||
goto err;
|
||||
}
|
||||
mysql_update_log.write(thd, thd->query,thd->query_length);
|
||||
if (mysql_bin_log.is_open())
|
||||
if (mysql_bin_log.is_open(1))
|
||||
{
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
|
||||
mysql_bin_log.write(&qinfo);
|
||||
@ -2050,7 +2050,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||
}
|
||||
thd->proc_info="end";
|
||||
mysql_update_log.write(thd, thd->query,thd->query_length);
|
||||
if (mysql_bin_log.is_open())
|
||||
if (mysql_bin_log.is_open(1))
|
||||
{
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
|
||||
mysql_bin_log.write(&qinfo);
|
||||
|
@ -317,7 +317,7 @@ int mysql_update(THD *thd,
|
||||
if (updated && (error <= 0 || !transactional_table))
|
||||
{
|
||||
mysql_update_log.write(thd,thd->query,thd->query_length);
|
||||
if (mysql_bin_log.is_open())
|
||||
if (mysql_bin_log.is_open(1))
|
||||
{
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length,
|
||||
log_delayed);
|
||||
@ -933,7 +933,7 @@ bool multi_update::send_eof()
|
||||
if (updated && (local_error <= 0 || !trans_safe))
|
||||
{
|
||||
mysql_update_log.write(thd,thd->query,thd->query_length);
|
||||
if (mysql_bin_log.is_open())
|
||||
if (mysql_bin_log.is_open(1))
|
||||
{
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length,
|
||||
log_delayed);
|
||||
|
Reference in New Issue
Block a user