Commit 99332399 authored by Michael Widenius's avatar Michael Widenius

MDEV-10804 main.stat_tables_par fails sporadically in buildbot

This was because of two issues:
- thr_multi_lock_after_thr_lock needed to be hit 3 times before go2 could
  be signaled, because 2 of these happened before statistics_update_start
  was reached.
- The original code didn't take into accunt that thr_locks can be executed in
  any random order, which caused sporadic failures when waiting for 1 lock
  of 3, as if the locks where in different order, there would be a dead-lock.
  Fixed by introducing thr_multi_lock_before_thr_lock which is deterministic.
- Some of the test failures where not noticed as the DEBUG_SYNC timeout
  would cause the test to pass (after 300 seconds).
parent 1fbf1c6d
...@@ -235,7 +235,7 @@ connect con1, localhost, root,,; ...@@ -235,7 +235,7 @@ connect con1, localhost, root,,;
connect con2, localhost, root,,; connect con2, localhost, root,,;
connection con1; connection con1;
set debug_sync='statistics_update_start SIGNAL parker WAIT_FOR go1 EXECUTE 1'; set debug_sync='statistics_update_start SIGNAL parker WAIT_FOR go1 EXECUTE 1';
set debug_sync='thr_multi_lock_after_thr_lock SIGNAL go2 EXECUTE 2'; set debug_sync='thr_multi_lock_before_thr_lock SIGNAL go2 EXECUTE 3';
use dbt3_s001; use dbt3_s001;
analyze table lineitem persistent for all; analyze table lineitem persistent for all;
connection con2; connection con2;
......
...@@ -266,7 +266,7 @@ connect con1, localhost, root,,; ...@@ -266,7 +266,7 @@ connect con1, localhost, root,,;
connect con2, localhost, root,,; connect con2, localhost, root,,;
connection con1; connection con1;
set debug_sync='statistics_update_start SIGNAL parker WAIT_FOR go1 EXECUTE 1'; set debug_sync='statistics_update_start SIGNAL parker WAIT_FOR go1 EXECUTE 1';
set debug_sync='thr_multi_lock_after_thr_lock SIGNAL go2 EXECUTE 2'; set debug_sync='thr_multi_lock_before_thr_lock SIGNAL go2 EXECUTE 3';
use dbt3_s001; use dbt3_s001;
analyze table lineitem persistent for all; analyze table lineitem persistent for all;
connection con2; connection con2;
......
...@@ -209,7 +209,7 @@ connect (con2, localhost, root,,); ...@@ -209,7 +209,7 @@ connect (con2, localhost, root,,);
connection con1; connection con1;
set debug_sync='statistics_update_start SIGNAL parker WAIT_FOR go1 EXECUTE 1'; set debug_sync='statistics_update_start SIGNAL parker WAIT_FOR go1 EXECUTE 1';
set debug_sync='thr_multi_lock_after_thr_lock SIGNAL go2 EXECUTE 2'; set debug_sync='thr_multi_lock_before_thr_lock SIGNAL go2 EXECUTE 3';
use dbt3_s001; use dbt3_s001;
--send analyze table lineitem persistent for all --send analyze table lineitem persistent for all
......
...@@ -1288,6 +1288,7 @@ thr_multi_lock(THR_LOCK_DATA **data, uint count, THR_LOCK_INFO *owner, ...@@ -1288,6 +1288,7 @@ thr_multi_lock(THR_LOCK_DATA **data, uint count, THR_LOCK_INFO *owner,
DBUG_RETURN(THR_LOCK_SUCCESS); DBUG_RETURN(THR_LOCK_SUCCESS);
/* lock everything */ /* lock everything */
DEBUG_SYNC_C("thr_multi_lock_before_thr_lock");
for (pos=data,end=data+count; pos < end ; pos++) for (pos=data,end=data+count; pos < end ; pos++)
{ {
enum enum_thr_lock_result result= thr_lock(*pos, owner, lock_wait_timeout); enum enum_thr_lock_result result= thr_lock(*pos, owner, lock_wait_timeout);
...@@ -1299,12 +1300,12 @@ thr_multi_lock(THR_LOCK_DATA **data, uint count, THR_LOCK_INFO *owner, ...@@ -1299,12 +1300,12 @@ thr_multi_lock(THR_LOCK_DATA **data, uint count, THR_LOCK_INFO *owner,
(*pos)->type= TL_UNLOCK; (*pos)->type= TL_UNLOCK;
DBUG_RETURN(result); DBUG_RETURN(result);
} }
DEBUG_SYNC_C("thr_multi_lock_after_thr_lock");
#ifdef MAIN #ifdef MAIN
printf("Thread: %s Got lock: 0x%lx type: %d\n",my_thread_name(), printf("Thread: %s Got lock: 0x%lx type: %d\n",my_thread_name(),
(long) pos[0]->lock, pos[0]->type); fflush(stdout); (long) pos[0]->lock, pos[0]->type); fflush(stdout);
#endif #endif
} }
DEBUG_SYNC_C("thr_multi_lock_after_thr_lock");
/* /*
Call start_trans for all locks. Call start_trans for all locks.
......
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