mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Merge fix.
This commit is contained in:
257
mysys/thr_lock.c
257
mysys/thr_lock.c
@ -664,6 +664,108 @@ wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data,
|
||||
DBUG_RETURN(result);
|
||||
}
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
/*
|
||||
* If brute force applier would need to wait for a thr lock,
|
||||
* it needs to make sure that it will get the lock without (too much)
|
||||
* delay.
|
||||
* We identify here the owners of blocking locks and ask them to
|
||||
* abort. We then put our lock request in the first place in the
|
||||
* wait queue. When lock holders abort (one by one) the lock release
|
||||
* algorithm should grant the lock to us. We rely on this and proceed
|
||||
* to wait_for_locks().
|
||||
* wsrep_break_locks() should be called in all the cases, where lock
|
||||
* wait would happen.
|
||||
*
|
||||
* TODO: current implementation might not cover all possible lock wait
|
||||
* situations. This needs an review still.
|
||||
* TODO: lock release, might favor some other lock (instead our bf).
|
||||
* This needs an condition to check for bf locks first.
|
||||
* TODO: we still have a debug fprintf, this should be removed
|
||||
*/
|
||||
static inline my_bool
|
||||
wsrep_break_lock(
|
||||
THR_LOCK_DATA *data, struct st_lock_list *lock_queue1,
|
||||
struct st_lock_list *lock_queue2, struct st_lock_list *wait_queue)
|
||||
{
|
||||
if (wsrep_on(data->owner->mysql_thd) &&
|
||||
wsrep_thd_is_brute_force &&
|
||||
wsrep_thd_is_brute_force(data->owner->mysql_thd))
|
||||
{
|
||||
THR_LOCK_DATA *holder;
|
||||
|
||||
/* if locking session conversion to transaction has been enabled,
|
||||
we know that this conflicting lock must be read lock and furthermore,
|
||||
lock holder is read-only. It is safe to wait for him.
|
||||
*/
|
||||
#ifdef TODO
|
||||
if (wsrep_convert_LOCK_to_trx &&
|
||||
(THD*)(data->owner->mysql_thd)->in_lock_tables)
|
||||
{
|
||||
if (wsrep_debug)
|
||||
fprintf(stderr,"WSREP wsrep_break_lock read lock untouched\n");
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
if (wsrep_debug)
|
||||
fprintf(stderr,"WSREP wsrep_break_lock aborting locks\n");
|
||||
|
||||
/* aborting lock holder(s) here */
|
||||
for (holder=(lock_queue1) ? lock_queue1->data : NULL;
|
||||
holder;
|
||||
holder=holder->next)
|
||||
{
|
||||
if (!wsrep_thd_is_brute_force(holder->owner->mysql_thd))
|
||||
{
|
||||
wsrep_abort_thd(data->owner->mysql_thd,
|
||||
holder->owner->mysql_thd, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wsrep_debug)
|
||||
fprintf(stderr,"WSREP wsrep_break_lock skipping BF lock conflict\n");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
for (holder=(lock_queue2) ? lock_queue2->data : NULL;
|
||||
holder;
|
||||
holder=holder->next)
|
||||
{
|
||||
if (!wsrep_thd_is_brute_force(holder->owner->mysql_thd))
|
||||
{
|
||||
wsrep_abort_thd(data->owner->mysql_thd,
|
||||
holder->owner->mysql_thd, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wsrep_debug)
|
||||
fprintf(stderr,"WSREP wsrep_break_lock skipping BF lock conflict\n");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Add our lock to the head of the wait queue */
|
||||
if (*(wait_queue->last)==wait_queue->data)
|
||||
{
|
||||
wait_queue->last=&data->next;
|
||||
assert(wait_queue->data==0);
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(wait_queue->data!=0);
|
||||
wait_queue->data->prev=&data->next;
|
||||
}
|
||||
data->next=wait_queue->data;
|
||||
data->prev=&wait_queue->data;
|
||||
wait_queue->data=data;
|
||||
data->cond=get_cond();
|
||||
|
||||
statistic_increment(locks_immediate,&THR_LOCK_lock);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
static enum enum_thr_lock_result
|
||||
thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, ulong lock_wait_timeout)
|
||||
@ -672,6 +774,9 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, ulong lock_wait_timeout)
|
||||
enum enum_thr_lock_result result= THR_LOCK_SUCCESS;
|
||||
struct st_lock_list *wait_queue;
|
||||
enum thr_lock_type lock_type= data->type;
|
||||
#ifdef WITH_WSREP
|
||||
my_bool wsrep_lock_inserted= FALSE;
|
||||
#endif
|
||||
MYSQL_TABLE_WAIT_VARIABLES(locker, state) /* no ';' */
|
||||
DBUG_ENTER("thr_lock");
|
||||
|
||||
@ -741,6 +846,14 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, ulong lock_wait_timeout)
|
||||
}
|
||||
if (lock->write.data->type == TL_WRITE_ONLY)
|
||||
{
|
||||
#ifdef WITH_WSREP
|
||||
if (wsrep_break_lock(data, &lock->write, NULL, &lock->read_wait))
|
||||
{
|
||||
wsrep_lock_inserted= TRUE;
|
||||
goto wsrep_read_wait;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* We are not allowed to get a READ lock in this case */
|
||||
data->type=TL_UNLOCK;
|
||||
result= THR_LOCK_ABORTED; /* Can't wait for this one */
|
||||
@ -768,6 +881,14 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, ulong lock_wait_timeout)
|
||||
lock but a high priority write waiting in the write_wait queue.
|
||||
In the latter case we should yield the lock to the writer.
|
||||
*/
|
||||
#ifdef WITH_WSREP
|
||||
if (wsrep_break_lock(data, &lock->write, NULL, &lock->read_wait))
|
||||
{
|
||||
wsrep_lock_inserted= TRUE;
|
||||
}
|
||||
wsrep_read_wait:
|
||||
#endif
|
||||
|
||||
wait_queue= &lock->read_wait;
|
||||
}
|
||||
else /* Request for WRITE lock */
|
||||
@ -776,12 +897,25 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, ulong lock_wait_timeout)
|
||||
{
|
||||
if (lock->write.data && lock->write.data->type == TL_WRITE_ONLY)
|
||||
{
|
||||
#ifdef WITH_WSREP
|
||||
if (wsrep_break_lock(data, &lock->write, NULL, &lock->write_wait))
|
||||
{
|
||||
wsrep_lock_inserted=TRUE;
|
||||
goto wsrep_write_wait;
|
||||
}
|
||||
#endif
|
||||
data->type=TL_UNLOCK;
|
||||
result= THR_LOCK_ABORTED; /* Can't wait for this one */
|
||||
goto end;
|
||||
}
|
||||
if (lock->write.data || lock->read.data)
|
||||
{
|
||||
#ifdef WITH_WSREP
|
||||
if (wsrep_break_lock(data, &lock->write, NULL, &lock->write_wait))
|
||||
{
|
||||
goto end;
|
||||
}
|
||||
#endif
|
||||
/* Add delayed write lock to write_wait queue, and return at once */
|
||||
(*lock->write_wait.last)=data;
|
||||
data->prev=lock->write_wait.last;
|
||||
@ -806,6 +940,13 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, ulong lock_wait_timeout)
|
||||
/* Allow lock owner to bypass TL_WRITE_ONLY. */
|
||||
if (!thr_lock_owner_equal(data->owner, lock->write.data->owner))
|
||||
{
|
||||
#ifdef WITH_WSREP
|
||||
if (wsrep_break_lock(data, &lock->write, NULL, &lock->write_wait))
|
||||
{
|
||||
wsrep_lock_inserted=TRUE;
|
||||
goto wsrep_write_wait;
|
||||
}
|
||||
#endif
|
||||
/* We are not allowed to get a lock in this case */
|
||||
data->type=TL_UNLOCK;
|
||||
result= THR_LOCK_ABORTED; /* Can't wait for this one */
|
||||
@ -909,9 +1050,22 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, ulong lock_wait_timeout)
|
||||
DBUG_PRINT("lock",("write locked 3 by thread: 0x%lx type: %d",
|
||||
lock->read.data->owner->thread_id, data->type));
|
||||
}
|
||||
#ifdef WITH_WSREP
|
||||
if (wsrep_break_lock(data, &lock->write, NULL, &lock->write_wait))
|
||||
{
|
||||
wsrep_lock_inserted= TRUE;
|
||||
}
|
||||
wsrep_write_wait:
|
||||
|
||||
#endif
|
||||
|
||||
wait_queue= &lock->write_wait;
|
||||
}
|
||||
/* Can't get lock yet; Wait for it */
|
||||
#ifdef WITH_WSREP
|
||||
if (wsrep_on(data->owner->mysql_thd) && wsrep_lock_inserted)
|
||||
DBUG_RETURN(wait_for_lock(wait_queue, data, 1, lock_wait_timeout));
|
||||
#endif
|
||||
result= wait_for_lock(wait_queue, data, 0, lock_wait_timeout);
|
||||
MYSQL_END_TABLE_LOCK_WAIT(locker);
|
||||
DBUG_RETURN(result);
|
||||
@ -1174,109 +1328,6 @@ static void sort_locks(THR_LOCK_DATA **data,uint count)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
/*
|
||||
* If brute force applier would need to wait for a thr lock,
|
||||
* it needs to make sure that it will get the lock without (too much)
|
||||
* delay.
|
||||
* We identify here the owners of blocking locks and ask them to
|
||||
* abort. We then put our lock request in the first place in the
|
||||
* wait queue. When lock holders abort (one by one) the lock release
|
||||
* algorithm should grant the lock to us. We rely on this and proceed
|
||||
* to wait_for_locks().
|
||||
* wsrep_break_locks() should be called in all the cases, where lock
|
||||
* wait would happen.
|
||||
*
|
||||
* TODO: current implementation might not cover all possible lock wait
|
||||
* situations. This needs an review still.
|
||||
* TODO: lock release, might favor some other lock (instead our bf).
|
||||
* This needs an condition to check for bf locks first.
|
||||
* TODO: we still have a debug fprintf, this should be removed
|
||||
*/
|
||||
static inline my_bool
|
||||
wsrep_break_lock(
|
||||
THR_LOCK_DATA *data, struct st_lock_list *lock_queue1,
|
||||
struct st_lock_list *lock_queue2, struct st_lock_list *wait_queue)
|
||||
{
|
||||
if (wsrep_on(data->owner->mysql_thd) &&
|
||||
wsrep_thd_is_brute_force &&
|
||||
wsrep_thd_is_brute_force(data->owner->mysql_thd))
|
||||
{
|
||||
THR_LOCK_DATA *holder;
|
||||
|
||||
/* if locking session conversion to transaction has been enabled,
|
||||
we know that this conflicting lock must be read lock and furthermore,
|
||||
lock holder is read-only. It is safe to wait for him.
|
||||
*/
|
||||
#ifdef TODO
|
||||
if (wsrep_convert_LOCK_to_trx &&
|
||||
(THD*)(data->owner->mysql_thd)->in_lock_tables)
|
||||
{
|
||||
if (wsrep_debug)
|
||||
fprintf(stderr,"WSREP wsrep_break_lock read lock untouched\n");
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
if (wsrep_debug)
|
||||
fprintf(stderr,"WSREP wsrep_break_lock aborting locks\n");
|
||||
|
||||
/* aborting lock holder(s) here */
|
||||
for (holder=(lock_queue1) ? lock_queue1->data : NULL;
|
||||
holder;
|
||||
holder=holder->next)
|
||||
{
|
||||
if (!wsrep_thd_is_brute_force(holder->owner->mysql_thd))
|
||||
{
|
||||
wsrep_abort_thd(data->owner->mysql_thd,
|
||||
holder->owner->mysql_thd, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wsrep_debug)
|
||||
fprintf(stderr,"WSREP wsrep_break_lock skipping BF lock conflict\n");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
for (holder=(lock_queue2) ? lock_queue2->data : NULL;
|
||||
holder;
|
||||
holder=holder->next)
|
||||
{
|
||||
if (!wsrep_thd_is_brute_force(holder->owner->mysql_thd))
|
||||
{
|
||||
wsrep_abort_thd(data->owner->mysql_thd,
|
||||
holder->owner->mysql_thd, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wsrep_debug)
|
||||
fprintf(stderr,"WSREP wsrep_break_lock skipping BF lock conflict\n");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Add our lock to the head of the wait queue */
|
||||
if (*(wait_queue->last)==wait_queue->data)
|
||||
{
|
||||
wait_queue->last=&data->next;
|
||||
assert(wait_queue->data==0);
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(wait_queue->data!=0);
|
||||
wait_queue->data->prev=&data->next;
|
||||
}
|
||||
data->next=wait_queue->data;
|
||||
data->prev=&wait_queue->data;
|
||||
wait_queue->data=data;
|
||||
data->cond=get_cond();
|
||||
|
||||
statistic_increment(locks_immediate,&THR_LOCK_lock);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
enum enum_thr_lock_result
|
||||
thr_multi_lock(THR_LOCK_DATA **data, uint count, THR_LOCK_INFO *owner,
|
||||
ulong lock_wait_timeout)
|
||||
|
@ -18,6 +18,8 @@ niceness=0
|
||||
nowatch=0
|
||||
mysqld_ld_preload=
|
||||
mysqld_ld_library_path=
|
||||
flush_caches=0
|
||||
numa_interleave=0
|
||||
|
||||
# Initial logging status: error log is not open, and not using syslog
|
||||
logging=init
|
||||
@ -85,6 +87,10 @@ Usage: $0 [OPTIONS]
|
||||
--syslog Log messages to syslog with 'logger'
|
||||
--skip-syslog Log messages to error log (default)
|
||||
--syslog-tag=TAG Pass -t "mysqld-TAG" to 'logger'
|
||||
--flush-caches Flush and purge buffers/caches before
|
||||
starting the server
|
||||
--numa-interleave Run mysqld with its memory interleaved
|
||||
on all NUMA nodes
|
||||
|
||||
All other options are passed to the mysqld program.
|
||||
|
||||
@ -312,6 +318,8 @@ parse_arguments() {
|
||||
--syslog-tag=*) syslog_tag="$val" ;;
|
||||
--timezone=*) TZ="$val"; export TZ; ;;
|
||||
--wsrep[-_]urls=*) wsrep_urls="$val"; ;;
|
||||
--flush-caches) flush_caches=1 ;;
|
||||
--numa-interleave) numa_interleave=1 ;;
|
||||
--wsrep[-_]provider=*)
|
||||
if test -n "$val" && test "$val" != "none"
|
||||
then
|
||||
@ -834,6 +842,40 @@ mysqld daemon not started"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Flush and purge buffers/caches.
|
||||
#
|
||||
|
||||
if @TARGET_LINUX@ && test $flush_caches -eq 1
|
||||
then
|
||||
# Locate sync, ensure it exists.
|
||||
if ! my_which sync > /dev/null 2>&1
|
||||
then
|
||||
log_error "sync command not found, required for --flush-caches"
|
||||
exit 1
|
||||
# Flush file system buffers.
|
||||
elif ! sync
|
||||
then
|
||||
# Huh, the sync() function is always successful...
|
||||
log_error "sync failed, check if sync is properly installed"
|
||||
fi
|
||||
|
||||
# Locate sysctl, ensure it exists.
|
||||
if ! my_which sysctl > /dev/null 2>&1
|
||||
then
|
||||
log_error "sysctl command not found, required for --flush-caches"
|
||||
exit 1
|
||||
# Purge page cache, dentries and inodes.
|
||||
elif ! sysctl -q -w vm.drop_caches=3
|
||||
then
|
||||
log_error "sysctl failed, check the error message for details"
|
||||
exit 1
|
||||
fi
|
||||
elif test $flush_caches -eq 1
|
||||
then
|
||||
log_error "--flush-caches is not supported on this platform"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# Uncomment the following lines if you want all tables to be automatically
|
||||
# checked and repaired during startup. You should add sensible key_buffer
|
||||
@ -854,6 +896,32 @@ fi
|
||||
|
||||
cmd="`mysqld_ld_preload_text`$NOHUP_NICENESS"
|
||||
|
||||
#
|
||||
# Set mysqld's memory interleave policy.
|
||||
#
|
||||
|
||||
if @TARGET_LINUX@ && test $numa_interleave -eq 1
|
||||
then
|
||||
# Locate numactl, ensure it exists.
|
||||
if ! my_which numactl > /dev/null 2>&1
|
||||
then
|
||||
log_error "numactl command not found, required for --numa-interleave"
|
||||
exit 1
|
||||
# Attempt to run a command, ensure it works.
|
||||
elif ! numactl --interleave=all true
|
||||
then
|
||||
log_error "numactl failed, check if numactl is properly installed"
|
||||
fi
|
||||
|
||||
# Launch mysqld with numactl.
|
||||
cmd="$cmd numactl --interleave=all"
|
||||
elif test $numa_interleave -eq 1
|
||||
then
|
||||
log_error "--numa-interleave is not supported on this platform"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
for i in "$ledir/$MYSQLD" "$defaults" "--basedir=$MY_BASEDIR_VERSION" \
|
||||
"--datadir=$DATADIR" "--plugin-dir=$plugin_dir" "$USER_OPTION"
|
||||
do
|
||||
|
@ -1167,6 +1167,7 @@ end:
|
||||
close_mysql_tables(thd);
|
||||
DBUG_RETURN(ret);
|
||||
}
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
int wsrep_create_event_query(THD *thd, uchar** buf, uint* buf_len)
|
||||
{
|
||||
|
@ -1387,7 +1387,6 @@ int ha_commit_trans(THD *thd, bool all)
|
||||
err= ht->prepare(ht, thd, all);
|
||||
status_var_increment(thd->status_var.ha_prepare_count);
|
||||
if (err)
|
||||
{
|
||||
#ifdef WITH_WSREP
|
||||
if (WSREP(thd) && ht->db_type== DB_TYPE_WSREP)
|
||||
{
|
||||
@ -1402,7 +1401,6 @@ int ha_commit_trans(THD *thd, bool all)
|
||||
/* not wsrep hton, bail to native mysql behavior */
|
||||
#endif
|
||||
my_error(ER_ERROR_DURING_COMMIT, MYF(0), err);
|
||||
}
|
||||
|
||||
if (err)
|
||||
goto err;
|
||||
|
@ -320,7 +320,8 @@ bool mysql_lock_tables(THD *thd, MYSQL_LOCK *sql_lock, uint flags)
|
||||
sql_lock->lock_count * sizeof(*sql_lock->locks));
|
||||
#ifdef WITH_WSREP
|
||||
thd->lock_info.in_lock_tables= thd->in_lock_tables;
|
||||
#endif /* Lock on the copied half of the lock data array. */
|
||||
#endif
|
||||
|
||||
/* Lock on the copied half of the lock data array. */
|
||||
rc= thr_lock_errno_to_mysql[(int) thr_multi_lock(sql_lock->locks +
|
||||
sql_lock->lock_count,
|
||||
@ -330,6 +331,12 @@ bool mysql_lock_tables(THD *thd, MYSQL_LOCK *sql_lock, uint flags)
|
||||
(void) unlock_external(thd, sql_lock->table, sql_lock->table_count);
|
||||
|
||||
end:
|
||||
#ifdef WITH_WSREP
|
||||
thd_proc_info(thd, "mysql_lock_tables(): unlocking tables II");
|
||||
#else /* WITH_WSREP */
|
||||
thd_proc_info(thd, 0);
|
||||
#endif /* WITH_WSREP */
|
||||
|
||||
if (thd->killed)
|
||||
{
|
||||
thd->send_kill_message();
|
||||
|
@ -4340,6 +4340,21 @@ Query_log_event::do_shall_skip(Relay_log_info *rli)
|
||||
DBUG_RETURN(Log_event::EVENT_SKIP_COUNT);
|
||||
}
|
||||
}
|
||||
#ifdef WITH_WSREP
|
||||
else if (wsrep_mysql_replication_bundle && WSREP_ON && thd->wsrep_mysql_replicated > 0 &&
|
||||
(!strncasecmp(query , "BEGIN", 5) || !strncasecmp(query , "COMMIT", 6)))
|
||||
{
|
||||
if (++thd->wsrep_mysql_replicated < (int)wsrep_mysql_replication_bundle)
|
||||
{
|
||||
WSREP_DEBUG("skipping wsrep commit %d", thd->wsrep_mysql_replicated);
|
||||
DBUG_RETURN(Log_event::EVENT_SKIP_IGNORE);
|
||||
}
|
||||
else
|
||||
{
|
||||
thd->wsrep_mysql_replicated = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
DBUG_RETURN(Log_event::do_shall_skip(rli));
|
||||
}
|
||||
|
||||
@ -7014,6 +7029,20 @@ Xid_log_event::do_shall_skip(Relay_log_info *rli)
|
||||
thd->variables.option_bits&= ~OPTION_BEGIN;
|
||||
DBUG_RETURN(Log_event::EVENT_SKIP_COUNT);
|
||||
}
|
||||
#ifdef WITH_WSREP
|
||||
else if (wsrep_mysql_replication_bundle && WSREP_ON)
|
||||
{
|
||||
if (++thd->wsrep_mysql_replicated < (int)wsrep_mysql_replication_bundle)
|
||||
{
|
||||
WSREP_DEBUG("skipping wsrep commit %d", thd->wsrep_mysql_replicated);
|
||||
DBUG_RETURN(Log_event::EVENT_SKIP_IGNORE);
|
||||
}
|
||||
else
|
||||
{
|
||||
thd->wsrep_mysql_replicated = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
DBUG_RETURN(Log_event::do_shall_skip(rli));
|
||||
}
|
||||
#endif /* !MYSQL_CLIENT */
|
||||
@ -8038,6 +8067,14 @@ err:
|
||||
end_io_cache(&file);
|
||||
if (fd >= 0)
|
||||
mysql_file_close(fd, MYF(0));
|
||||
#ifdef WITH_WSREP
|
||||
if (WSREP(thd))
|
||||
thd_proc_info(thd, "exit Create_file_log_event::do_apply_event()");
|
||||
else
|
||||
thd_proc_info(thd, 0);
|
||||
#else /* WITH_WSREP */
|
||||
thd_proc_info(thd, 0);
|
||||
#endif /* WITH_WSREP */
|
||||
return error != 0;
|
||||
}
|
||||
#endif /* defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) */
|
||||
@ -8208,6 +8245,14 @@ int Append_block_log_event::do_apply_event(Relay_log_info const *rli)
|
||||
err:
|
||||
if (fd >= 0)
|
||||
mysql_file_close(fd, MYF(0));
|
||||
#ifdef WITH_WSREP
|
||||
if (WSREP(thd))
|
||||
thd_proc_info(thd, "exit Append_block_log_event::do_apply_event()");
|
||||
else
|
||||
thd_proc_info(thd, 0);
|
||||
#else /* WITH_WSREP */
|
||||
thd_proc_info(thd, 0);
|
||||
#endif /* WITH_WSREP */
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
#endif
|
||||
|
1027
sql/mysqld.cc
1027
sql/mysqld.cc
File diff suppressed because it is too large
Load Diff
17
sql/slave.cc
17
sql/slave.cc
@ -3118,23 +3118,6 @@ int apply_event_and_update_pos(Log_event* ev, THD* thd, Relay_log_info* rli)
|
||||
ev->thd = thd; // because up to this point, ev->thd == 0
|
||||
|
||||
int reason= ev->shall_skip(rli);
|
||||
#ifdef WITH_WSREP
|
||||
if (WSREP_ON && (ev->get_type_code() == XID_EVENT ||
|
||||
(ev->get_type_code() == QUERY_EVENT && thd->wsrep_mysql_replicated > 0 &&
|
||||
(!strncasecmp(((Query_log_event*)ev)->query , "BEGIN", 5) ||
|
||||
!strncasecmp(((Query_log_event*)ev)->query , "COMMIT", 6) ))))
|
||||
{
|
||||
if (++thd->wsrep_mysql_replicated < (int)wsrep_mysql_replication_bundle)
|
||||
{
|
||||
WSREP_DEBUG("skipping wsrep commit %d", thd->wsrep_mysql_replicated);
|
||||
reason = Log_event::EVENT_SKIP_IGNORE;
|
||||
}
|
||||
else
|
||||
{
|
||||
thd->wsrep_mysql_replicated = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (reason == Log_event::EVENT_SKIP_COUNT)
|
||||
{
|
||||
DBUG_ASSERT(rli->slave_skip_counter > 0);
|
||||
|
@ -4429,6 +4429,15 @@ restart:
|
||||
#endif
|
||||
|
||||
err:
|
||||
#ifdef WITH_WSREP
|
||||
if (WSREP(thd))
|
||||
thd_proc_info(thd, "exit open_tables()");
|
||||
else
|
||||
thd_proc_info(thd, 0);
|
||||
#else /* WITH_WSREP */
|
||||
thd_proc_info(thd, 0);
|
||||
#endif /* WITH_WSREP */
|
||||
|
||||
free_root(&new_frm_mem, MYF(0)); // Free pre-alloced block
|
||||
|
||||
if (error && *table_to_open)
|
||||
@ -4881,6 +4890,16 @@ end:
|
||||
trans_rollback_stmt(thd);
|
||||
close_thread_tables(thd);
|
||||
}
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
if (WSREP(thd))
|
||||
thd_proc_info(thd, "End opening table");
|
||||
else
|
||||
thd_proc_info(thd, 0);
|
||||
#else /* WITH_WSREP */
|
||||
thd_proc_info(thd, 0);
|
||||
#endif /* WITH_WSREP */
|
||||
|
||||
DBUG_RETURN(table);
|
||||
}
|
||||
|
||||
|
@ -3187,6 +3187,12 @@ bool Delayed_insert::handle_inserts(void)
|
||||
mysql_cond_broadcast(&cond_client); // If waiting clients
|
||||
}
|
||||
}
|
||||
#ifdef WITH_WSREP
|
||||
if (WSREP((&thd)))
|
||||
thd_proc_info(&thd, "insert done");
|
||||
else
|
||||
#endif /* WITH_WSREP */
|
||||
thd_proc_info(&thd, 0);
|
||||
mysql_mutex_unlock(&mutex);
|
||||
|
||||
/*
|
||||
|
@ -970,9 +970,12 @@ bool do_command(THD *thd)
|
||||
thd->wsrep_query_state= QUERY_EXEC;
|
||||
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
|
||||
}
|
||||
#endif /* WITH_WSREP */
|
||||
|
||||
if ((WSREP(thd) && packet_length == packet_error) ||
|
||||
(!WSREP(thd) && (packet_length= my_net_read(net)) == packet_error))
|
||||
#else
|
||||
if (packet_length == packet_error)
|
||||
#endif /* WITH_WSREP */
|
||||
{
|
||||
DBUG_PRINT("info",("Got error %d reading command from socket %s",
|
||||
net->error,
|
||||
@ -2708,9 +2711,6 @@ mysql_execute_command(THD *thd)
|
||||
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "embedded server");
|
||||
break;
|
||||
#endif
|
||||
#ifdef WITH_WSREP
|
||||
if (WSREP_CLIENT(thd) && wsrep_causal_wait(thd)) goto error;
|
||||
#endif /* WITH_WSREP */
|
||||
case SQLCOM_SHOW_STATUS:
|
||||
{
|
||||
execute_show_status(thd, all_tables);
|
||||
@ -2745,6 +2745,10 @@ mysql_execute_command(THD *thd)
|
||||
}
|
||||
case SQLCOM_SHOW_STATUS_PROC:
|
||||
case SQLCOM_SHOW_STATUS_FUNC:
|
||||
#ifdef WITH_WSREP
|
||||
if (WSREP_CLIENT(thd) && wsrep_causal_wait(thd)) goto error;
|
||||
#endif /* WITH_WSREP */
|
||||
|
||||
case SQLCOM_SHOW_DATABASES:
|
||||
case SQLCOM_SHOW_TABLES:
|
||||
case SQLCOM_SHOW_TRIGGERS:
|
||||
@ -3237,12 +3241,6 @@ case SQLCOM_PREPARE:
|
||||
if (create_info.tmp_table())
|
||||
thd->variables.option_bits|= OPTION_KEEP_LOG;
|
||||
/* regular create */
|
||||
#ifdef WITH_WSREP
|
||||
if (!thd->is_current_stmt_binlog_format_row() ||
|
||||
!(create_info.options & HA_LEX_CREATE_TMP_TABLE))
|
||||
WSREP_TO_ISOLATION_BEGIN(create_table->db, create_table->table_name,
|
||||
NULL)
|
||||
#endif /* WITH_WSREP */
|
||||
if (create_info.options & HA_LEX_CREATE_TABLE_LIKE)
|
||||
{
|
||||
/* CREATE TABLE ... LIKE ... */
|
||||
@ -3251,6 +3249,13 @@ case SQLCOM_PREPARE:
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef WITH_WSREP
|
||||
if (!thd->is_current_stmt_binlog_format_row() ||
|
||||
!(create_info.options & HA_LEX_CREATE_TMP_TABLE))
|
||||
WSREP_TO_ISOLATION_BEGIN(create_table->db, create_table->table_name,
|
||||
NULL)
|
||||
#endif /* WITH_WSREP */
|
||||
|
||||
/* Regular CREATE TABLE */
|
||||
res= mysql_create_table(thd, create_table,
|
||||
&create_info, &alter_info);
|
||||
|
@ -2815,6 +2815,15 @@ int start_slave(THD* thd , Master_info* mi, bool net_report)
|
||||
err:
|
||||
unlock_slave_threads(mi);
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
if (WSREP(thd))
|
||||
thd_proc_info(thd, "exit stop_slave()");
|
||||
else
|
||||
thd_proc_info(thd, 0);
|
||||
#else /* WITH_WSREP */
|
||||
thd_proc_info(thd, 0);
|
||||
#endif /* WITH_WSREP */
|
||||
|
||||
if (slave_errno)
|
||||
{
|
||||
if (net_report)
|
||||
|
@ -59,6 +59,10 @@
|
||||
#include "debug_sync.h"
|
||||
#include "keycaches.h"
|
||||
|
||||
#if !defined(MYSQL_MAX_VARIABLE_VALUE_LEN)
|
||||
#define MYSQL_MAX_VARIABLE_VALUE_LEN 1024
|
||||
#endif // !defined(MYSQL_MAX_VARIABLE_VALUE_LEN)
|
||||
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
#include "ha_partition.h"
|
||||
#endif
|
||||
@ -8660,7 +8664,7 @@ ST_FIELD_INFO variables_fields_info[]=
|
||||
{
|
||||
{"VARIABLE_NAME", 64, MYSQL_TYPE_STRING, 0, 0, "Variable_name",
|
||||
SKIP_OPEN_TABLE},
|
||||
{"VARIABLE_VALUE", 1024, MYSQL_TYPE_STRING, 0, 1,
|
||||
{"VARIABLE_VALUE", MYSQL_MAX_VARIABLE_VALUE_LEN, MYSQL_TYPE_STRING, 0, 1,
|
||||
"Value", SKIP_OPEN_TABLE},
|
||||
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
|
||||
};
|
||||
|
Reference in New Issue
Block a user