| 1756 | */ |
| 1757 | |
| 1758 | static void debug_sync(THD *thd, const char *sync_point_name, size_t name_len) |
| 1759 | { |
| 1760 | if (!thd) |
| 1761 | { |
| 1762 | if (!(thd= current_thd)) |
| 1763 | return; |
| 1764 | } |
| 1765 | |
| 1766 | st_debug_sync_control *ds_control= thd->debug_sync_control; |
| 1767 | st_debug_sync_action *action; |
| 1768 | DBUG_ENTER("debug_sync"); |
| 1769 | DBUG_PRINT("debug_sync_point", ("hit: '%s'", sync_point_name)); |
| 1770 | DBUG_ASSERT(sync_point_name); |
| 1771 | DBUG_ASSERT(name_len); |
| 1772 | DBUG_ASSERT(ds_control); |
| 1773 | |
| 1774 | /* Statistics. */ |
| 1775 | ds_control->dsp_hits++; |
| 1776 | |
| 1777 | if (ds_control->ds_active && |
| 1778 | (action= debug_sync_find(ds_control->ds_action, ds_control->ds_active, |
| 1779 | sync_point_name, name_len)) && |
| 1780 | action->activation_count) |
| 1781 | { |
| 1782 | /* Sync point is active (action exists). */ |
| 1783 | debug_sync_execute(thd, action); |
| 1784 | |
| 1785 | /* Statistics. */ |
| 1786 | ds_control->dsp_executed++; |
| 1787 | |
| 1788 | /* If action became inactive, remove it to shrink the search array. */ |
| 1789 | if (!action->activation_count) |
| 1790 | debug_sync_remove_action(ds_control, action); |
| 1791 | } |
| 1792 | |
| 1793 | DBUG_VOID_RETURN; |
| 1794 | } |
| 1795 | |
| 1796 | /** |
| 1797 | Define debug sync action. |
no test coverage detected