mirror of
https://github.com/MariaDB/server.git
synced 2025-01-26 00:34:18 +01:00
From MySQL:
Refactored some code to remove ifdef and removed dead code related to un-useable sync code.
This commit is contained in:
parent
b0bbf41d4c
commit
af88735171
1 changed files with 0 additions and 104 deletions
|
@ -1839,110 +1839,6 @@ innobase_commit_complete(
|
|||
return(0);
|
||||
}
|
||||
|
||||
#ifdef HAVE_REPLICATION
|
||||
/*********************************************************************
|
||||
In synchronous replication, reports to InnoDB up to which binlog position
|
||||
we have sent the binlog to the slave. Note that replication is synchronous
|
||||
for one slave only. For other slaves, we do nothing in this function. This
|
||||
function is used in a replication master. */
|
||||
|
||||
int
|
||||
innobase_repl_report_sent_binlog(
|
||||
/*=============================*/
|
||||
/* out: 0 */
|
||||
THD* thd, /* in: thread doing the binlog communication to
|
||||
the slave */
|
||||
char* log_file_name, /* in: binlog file name */
|
||||
my_off_t end_offset) /* in: the offset in the binlog file up to
|
||||
which we sent the contents to the slave */
|
||||
{
|
||||
int cmp;
|
||||
ibool can_release_threads = 0;
|
||||
|
||||
if (!innodb_inited) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* If synchronous replication is not switched on, or this thd is
|
||||
sending binlog to a slave where we do not need synchronous replication,
|
||||
then return immediately */
|
||||
|
||||
if (thd->server_id != thd->variables.sync_replication_slave_id) {
|
||||
|
||||
/* Do nothing */
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&innobase_repl_cond_mutex);
|
||||
|
||||
if (innobase_repl_state == 0) {
|
||||
|
||||
ut_print_timestamp(stderr);
|
||||
sql_print_warning("Switching MySQL synchronous replication on "
|
||||
"again at binlog file %s, position %lu",
|
||||
log_file_name, (ulong) end_offset);
|
||||
|
||||
innobase_repl_state = 1;
|
||||
}
|
||||
|
||||
/* The position should increase monotonically, since just one thread
|
||||
is sending the binlog to the slave for which we want synchronous
|
||||
replication. Let us check this, and print an error to the .err log
|
||||
if that is not the case. */
|
||||
|
||||
if (innobase_repl_file_name_inited) {
|
||||
cmp = strcmp(log_file_name, innobase_repl_file_name);
|
||||
|
||||
if (cmp < 0
|
||||
|| (cmp == 0 && end_offset < innobase_repl_pos)) {
|
||||
|
||||
ut_print_timestamp(stderr);
|
||||
sql_print_error("MySQL synchronous replication has "
|
||||
"sent binlog to the slave up to file "
|
||||
"%s, position %lu, but now MySQL "
|
||||
"reports that it sent the binlog only "
|
||||
"up to file %s, position %lu",
|
||||
innobase_repl_file_name,
|
||||
(ulong) innobase_repl_pos,
|
||||
log_file_name, (ulong) end_offset);
|
||||
}
|
||||
}
|
||||
|
||||
strcpy(innobase_repl_file_name, log_file_name);
|
||||
innobase_repl_pos = end_offset;
|
||||
innobase_repl_file_name_inited = 1;
|
||||
|
||||
if (innobase_repl_n_wait_threads > 0) {
|
||||
/* Let us check if some of the waiting threads doing a trx
|
||||
commit can now proceed */
|
||||
|
||||
cmp = strcmp(innobase_repl_file_name,
|
||||
innobase_repl_wait_file_name);
|
||||
if (cmp > 0
|
||||
|| (cmp == 0 && innobase_repl_pos
|
||||
>= innobase_repl_wait_pos)) {
|
||||
|
||||
/* Yes, at least one waiting thread can now proceed:
|
||||
let us release all waiting threads with a broadcast */
|
||||
|
||||
can_release_threads = 1;
|
||||
|
||||
innobase_repl_wait_file_name_inited = 0;
|
||||
}
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&innobase_repl_cond_mutex);
|
||||
|
||||
if (can_release_threads) {
|
||||
|
||||
pthread_cond_broadcast(&innobase_repl_cond);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
#endif /* HAVE_REPLICATION */
|
||||
|
||||
/*********************************************************************
|
||||
Rolls back a transaction or the latest SQL statement. */
|
||||
|
|
Loading…
Add table
Reference in a new issue