Hi Andrei,
the idea is good. At the moment it may be the best way to accomplish
synchronization with system threads.
However, in the long run it might not be the best to combine two
otherwise completely independent facilities: DBUG and DEBUG_SYNC.
DEBUG_SYNC has the downside that it cannot synchronize non-connection
threads directly. The actions are stored in THD memory. To have
efficient sync points, no locking of access to the actions is done.
Hence, another thread cannot modify/set a thread's actions.
To overcome this limitation, you set an action directly in the code and
execute it. This is controlled by the DBUG facility. It has the
advantage that one can set a global variable, which will be copied to
the thread's local storage at thread start time.
Long term, an equivalent operation could be done by allowing to set
DEBUG_SYNC globally. This would maintain a global set of actions, which
would be copied to THD at thread start. Proper cleanup of the global
action set must be obeyed to avoid inheritance by other starting
threads. (This applies to the global DEBUG variable too, btw.)
The proposed patch looks good. Just the optimization to use the pseudo
sync point "NOW" as discussed on IRC would be nice.
Another change would be nice too: If the eliminated DEBUG_SYNC_POINTs
are the last one, a complete wipe out of the facility seems desirable.
Another option could be to improve DEBUG_SYNC_POINT by making it
dependent on DBUG_OFF, not EXTRA_DEBUG. Though user level locks have
their problems for synchronization, as described in
http://forge.mysql.com/wiki/MySQL_Internals_Test_Synchronization#Debug_Sync_Point
they might still have merit. But if the last few existing uses of the
facility are wiped out now, it might be better to get rid of it altogether.
Regards
Ingo
Andrei Elkin, 03.03.2010 17:51:
...
> 3369 Andrei Elkin 2010-03-03
> Bug #51648 DBUG_SYNC_POINT is not defined on all platforms and mtr cant
> pre-check that
>
> a prototype of fixes
>
> modified:
> mysql-test/suite/rpl/r/rpl_show_slave_running.result
> mysql-test/suite/rpl/t/rpl_show_slave_running.test
> sql/debug_sync.cc
> sql/debug_sync.h
> sql/slave.cc
...
--
Ingo Strüwing, Database Group
Sun Microsystems GmbH, Sonnenallee 1, D-85551 Kirchheim-Heimstetten
Geschäftsführer: Thomas Schröder, Wolfgang Engels
Vorsitzender des Aufsichtsrates: Martin Häring HRB München 161028