Bug #51648 DBUG_SYNC_POINT is not defined on all platforms and mtr can't pre-check that
Submitted: 2 Mar 2010 16:47 Modified: 18 Jun 2010 1:10
Reporter: Andrei Elkin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1+ OS:Any
Assigned to: Andrei Elkin CPU Architecture:Any
Tags: synchronization

[2 Mar 2010 16:47] Andrei Elkin
Description:
DBUG_SYNC_POINT has at least one strong limitation that it's not defined
on all platforms. It's declaration depends on EXTRA_DEBUG which makes 
the macro expanded to noop on Solaris builts in particular.
A worse fact is that tests can not verify if a platform has the macro
built in.
That affects execution of tests exploiting the feature such as rpl_show_slave_running and may do that to rpl_get_master_version_and_clock.

rpl.rpl_show_slave_running 'row'         [ fail ]
        Test ended at 2010-03-02 16:31:36
@@ -20,7 +20,7 @@
 SHOW STATUS LIKE 'Slave_running';
 Variable_name  Value
 Slave_running  OFF
-Slave_IO_Running= No
+Slave_IO_Running= Yes

The source of non-determinism of the test is undetectable by mtr null-expansion of DBUG_SYNC_POINT().

How to repeat:
to execute ./mtr rpl_show_slave_running on Solaris or to look at PB2 for rpl_show_slave_running failures.

Suggested fix:
Refine lines of the server code and referred tests to replace
DBUG_SYNC_POINT logics with combination of DBUG_EXECUTE_IF and DBUG_SYNC.
[3 Mar 2010 16:51] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/102224

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
[17 Mar 2010 13:53] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/103600

3400 Andrei Elkin	2010-03-17
      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 also 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 required changes as well.
      
      The patch can be served as a template of setting sync-points in slave threads
      where the standard DEBUG_SYNC does not suffice to read goals.
     @ mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test
        rewriting the test from GET_LOCK()-based to DEBUG_SYNC-based.
     @ 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;
        limitting the test to run only with MIXED binlog-format as the test last
        some 10 secs sentitively 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 couterpart in tests existing.
[18 Mar 2010 16:31] Ingo Strüwing
Approved with small comments. Please see email.
[18 Mar 2010 18:28] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/103734

3400 Andrei Elkin	2010-03-18
      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 also 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 required changes as well.
      
      The patch provides a template of 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.
     @ 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.
[19 Mar 2010 9:07] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/103779

3400 Andrei Elkin	2010-03-19
      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.
[22 Mar 2010 5:50] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/103922

3413 Andrei Elkin	2010-03-22
      bug#51648
      comments to rpl_show_slave_running test are added to ease merging
[22 Mar 2010 5:59] Andrei Elkin
Pushed to 5.1-bt, pe trees.
[26 Mar 2010 8:24] Bugs System
Pushed into 5.5.4-m3 (revid:alik@sun.com-20100326080914-2pz8ns984e0spu03) (version source revid:alexey.kopytov@sun.com-20100322132851-8j3m42x4ldi1kca5) (merge vers: 5.5.3-m2) (pib:16)
[26 Mar 2010 8:27] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100326081116-m3v4l34yhr43mtsv) (version source revid:alik@sun.com-20100325072612-4sds00ix8ajo1e84) (pib:16)
[26 Mar 2010 8:31] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100326081944-qja07qklw1p2w7jb) (version source revid:alik@sun.com-20100325073410-4t4i9gu2u1pge7xb) (merge vers: 6.0.14-alpha) (pib:16)
[6 Apr 2010 7:59] Bugs System
Pushed into 5.1.46 (revid:sergey.glukhov@sun.com-20100405111026-7kz1p8qlzglqgfmu) (version source revid:john.embretsen@sun.com-20100322090656-w4ixy7p67fb3vr29) (merge vers: 5.1.46) (pib:16)
[13 Apr 2010 19:55] Paul DuBois
Test suite-related changes. No changelog entry needed.
[17 Jun 2010 12:19] Bugs System
Pushed into 5.1.47-ndb-7.0.16 (revid:martin.skold@mysql.com-20100617114014-bva0dy24yyd67697) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[17 Jun 2010 13:07] Bugs System
Pushed into 5.1.47-ndb-6.2.19 (revid:martin.skold@mysql.com-20100617115448-idrbic6gbki37h1c) (version source revid:martin.skold@mysql.com-20100609211156-tsac5qhw951miwtt) (merge vers: 5.1.46-ndb-6.2.19) (pib:16)
[17 Jun 2010 13:47] Bugs System
Pushed into 5.1.47-ndb-6.3.35 (revid:martin.skold@mysql.com-20100617114611-61aqbb52j752y116) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)