summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
authorAndrei Elkin <aelkin@mysql.com>2010-03-19 11:06:40 +0200
committerAndrei Elkin <aelkin@mysql.com>2010-03-19 11:06:40 +0200
commitc3cd608aef94f8b8507997faac9e81eebc32a2d6 (patch)
treec257cbcf2d3f4379d5a037b6ed0c67206ac0be43 /sql/item_func.cc
parentc7fad393fd73cc941190fde1b56a2f9e68e9d132 (diff)
downloadmariadb-git-c3cd608aef94f8b8507997faac9e81eebc32a2d6.tar.gz
Bug #51648 DBUG_SYNC_POINT is not defined on all platforms and mtr cant pre-check that
DBUG_SYNC_POINT has at least one strong limitation that it's not defined on all platforms. It has issues cooperating with @@debug. All in all its functionality is superseded by DEBUG_SYNC facility and there is no reason to maintain the old less flexible one. Fixed with adding debug_sync_set_action() function as a facility to set up a sync-action in the server sources code and re-writing existing simulations (found 3) to use it. Couple of tests have been reworked as well. The patch offers a pattern for setting sync-points in replication threads where the standard DEBUG_SYNC does not suffice to reach goals. mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test: rewriting the test from GET_LOCK()-based to DEBUG_SYNC-based; a pattern of usage DEBUG_SYNC for replication testing is provided. mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result: results are changed. mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test: rewriting the test from GET_LOCK()-based to DEBUG_SYNC-based; limiting the test to run only with MIXED binlog-format as the test last some 10 secs sensitively contributing to the total of tests run. mysql-test/suite/rpl/t/rpl_show_slave_running.test: rewriting the test from GET_LOCK()-based to DEBUG_SYNC-based. sql/debug_sync.cc: adding debug_sync_set_action() function as a facility to set up a sync-action in the server sources code. sql/debug_sync.h: externalizing debug_sync_set_action(). sql/item_func.cc: purging sources from DBUG_SYNC_POINT. sql/mysql_priv.h: purging sources from DBUG_SYNC_POINT. sql/slave.cc: rewriting failure simulations to base on DEBUG_SYNC rather than GET_LOCK()-based DBUG_SYNC_POINT. sql/sql_repl.cc: removing an orphan failure simulation line because no counterpart in tests existing.
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r--sql/item_func.cc74
1 files changed, 0 insertions, 74 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 845654c1881..1e31755179b 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -3362,80 +3362,6 @@ longlong Item_master_pos_wait::val_int()
return event_count;
}
-#ifdef EXTRA_DEBUG
-void debug_sync_point(const char* lock_name, uint lock_timeout)
-{
- THD* thd=current_thd;
- User_level_lock* ull;
- struct timespec abstime;
- size_t lock_name_len;
- lock_name_len= strlen(lock_name);
- pthread_mutex_lock(&LOCK_user_locks);
-
- if (thd->ull)
- {
- item_user_lock_release(thd->ull);
- thd->ull=0;
- }
-
- /*
- If the lock has not been aquired by some client, we do not want to
- create an entry for it, since we immediately release the lock. In
- this case, we will not be waiting, but rather, just waste CPU and
- memory on the whole deal
- */
- if (!(ull= ((User_level_lock*) hash_search(&hash_user_locks,
- (uchar*) lock_name,
- lock_name_len))))
- {
- pthread_mutex_unlock(&LOCK_user_locks);
- return;
- }
- ull->count++;
-
- /*
- Structure is now initialized. Try to get the lock.
- Set up control struct to allow others to abort locks
- */
- thd_proc_info(thd, "User lock");
- thd->mysys_var->current_mutex= &LOCK_user_locks;
- thd->mysys_var->current_cond= &ull->cond;
-
- set_timespec(abstime,lock_timeout);
- while (ull->locked && !thd->killed)
- {
- int error= pthread_cond_timedwait(&ull->cond, &LOCK_user_locks, &abstime);
- if (error == ETIMEDOUT || error == ETIME)
- break;
- }
-
- if (ull->locked)
- {
- if (!--ull->count)
- delete ull; // Should never happen
- }
- else
- {
- ull->locked=1;
- ull->set_thread(thd);
- thd->ull=ull;
- }
- pthread_mutex_unlock(&LOCK_user_locks);
- pthread_mutex_lock(&thd->mysys_var->mutex);
- thd_proc_info(thd, 0);
- thd->mysys_var->current_mutex= 0;
- thd->mysys_var->current_cond= 0;
- pthread_mutex_unlock(&thd->mysys_var->mutex);
- pthread_mutex_lock(&LOCK_user_locks);
- if (thd->ull)
- {
- item_user_lock_release(thd->ull);
- thd->ull=0;
- }
- pthread_mutex_unlock(&LOCK_user_locks);
-}
-
-#endif
/**
Get a user level lock. If the thread has an old lock this is first released.