Commit b0bbf41d authored by osku's avatar osku

From MySQL:

After merge fixes.
parent 1542ec0a
...@@ -1768,25 +1768,6 @@ innobase_report_binlog_offset_and_commit( ...@@ -1768,25 +1768,6 @@ innobase_report_binlog_offset_and_commit(
trx->mysql_log_file_name = log_file_name; trx->mysql_log_file_name = log_file_name;
trx->mysql_log_offset = (ib_longlong)end_offset; trx->mysql_log_offset = (ib_longlong)end_offset;
#ifdef HAVE_REPLICATION
if (thd->variables.sync_replication) {
/* Let us store the binlog file name and the position, so that
we know how long to wait for the binlog to the replicated to
the slave in synchronous replication. */
if (trx->repl_wait_binlog_name == NULL) {
trx->repl_wait_binlog_name =
(char*)mem_alloc_noninline(FN_REFLEN + 100);
}
ut_a(strlen(log_file_name) < FN_REFLEN + 100);
strcpy(trx->repl_wait_binlog_name, log_file_name);
trx->repl_wait_binlog_pos = (ib_longlong)end_offset;
}
#endif /* HAVE_REPLICATION */
trx->flush_log_later = TRUE; trx->flush_log_later = TRUE;
innobase_commit(thd, TRUE); innobase_commit(thd, TRUE);
...@@ -1855,117 +1836,6 @@ innobase_commit_complete( ...@@ -1855,117 +1836,6 @@ innobase_commit_complete(
trx_commit_complete_for_mysql(trx); trx_commit_complete_for_mysql(trx);
} }
#ifdef HAVE_REPLICATION
if (thd->variables.sync_replication
&& trx->repl_wait_binlog_name
&& innobase_repl_state != 0) {
struct timespec abstime;
int cmp;
int ret;
/* In synchronous replication, let us wait until the MySQL
replication has sent the relevant binlog segment to the
replication slave. */
pthread_mutex_lock(&innobase_repl_cond_mutex);
try_again:
if (innobase_repl_state == 0) {
pthread_mutex_unlock(&innobase_repl_cond_mutex);
return(0);
}
cmp = strcmp(innobase_repl_file_name,
trx->repl_wait_binlog_name);
if (cmp > 0
|| (cmp == 0 && innobase_repl_pos
>= (my_off_t)trx->repl_wait_binlog_pos)) {
/* We have already sent the relevant binlog to the
slave: no need to wait here */
pthread_mutex_unlock(&innobase_repl_cond_mutex);
/* printf("Binlog now sent\n"); */
return(0);
}
/* Let us update the info about the minimum binlog position
of waiting threads in the innobase_repl_... variables */
if (innobase_repl_wait_file_name_inited != 0) {
cmp = strcmp(trx->repl_wait_binlog_name,
innobase_repl_wait_file_name);
if (cmp < 0
|| (cmp == 0
&& (my_off_t)trx->repl_wait_binlog_pos
<= innobase_repl_wait_pos)) {
/* This thd has an even lower position, let
us update the minimum info */
strcpy(innobase_repl_wait_file_name,
trx->repl_wait_binlog_name);
innobase_repl_wait_pos =
trx->repl_wait_binlog_pos;
}
} else {
strcpy(innobase_repl_wait_file_name,
trx->repl_wait_binlog_name);
innobase_repl_wait_pos = trx->repl_wait_binlog_pos;
innobase_repl_wait_file_name_inited = 1;
}
set_timespec(abstime, thd->variables.sync_replication_timeout);
/* Let us suspend this thread to wait on the condition;
when replication has progressed far enough, we will release
these waiting threads. The following call
pthread_cond_timedwait also atomically unlocks
innobase_repl_cond_mutex. */
innobase_repl_n_wait_threads++;
/* printf("Waiting for binlog to be sent\n"); */
ret = pthread_cond_timedwait(&innobase_repl_cond,
&innobase_repl_cond_mutex, &abstime);
innobase_repl_n_wait_threads--;
if (ret != 0) {
ut_print_timestamp(stderr);
sql_print_error("MySQL synchronous replication was "
"not able to send the binlog to the "
"slave within the timeout %lu. We "
"assume that the slave has become "
"inaccessible, and switch off "
"synchronous replication until the "
"communication to the slave works "
"again. MySQL synchronous replication "
"has sent binlog to the slave up to "
"file %s, position %lu. This "
"transaction needs it to be sent up "
"to file %s, position %lu.",
thd->variables.sync_replication_timeout,
innobase_repl_file_name,
(ulong) innobase_repl_pos,
trx->repl_wait_binlog_name,
(ulong) trx->repl_wait_binlog_pos);
innobase_repl_state = 0;
pthread_mutex_unlock(&innobase_repl_cond_mutex);
return(0);
}
goto try_again;
}
#endif // HAVE_REPLICATION
return(0); return(0);
} }
......
...@@ -316,9 +316,6 @@ int innobase_rollback_by_xid( ...@@ -316,9 +316,6 @@ int innobase_rollback_by_xid(
XID *xid); /* in : X/Open XA Transaction Identification */ XID *xid); /* in : X/Open XA Transaction Identification */
int innobase_repl_report_sent_binlog(THD *thd, char *log_file_name,
my_off_t end_offset);
/*********************************************************************** /***********************************************************************
Create a consistent view for a cursor based on current transaction Create a consistent view for a cursor based on current transaction
which is created if the corresponding MySQL thread still lacks one. which is created if the corresponding MySQL thread still lacks one.
......
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