Bug #37702 timestamp_func relies on sleep and is unstable in pushbuild
Submitted: 27 Jun 2008 20:52 Modified: 8 Dec 2008 13:07
Reporter: Konstantin Osipov (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Tests Severity:S7 (Test Cases)
Version:6.0 OS:Any
Assigned to: Horst Hunger CPU Architecture:Any
Tags: pushbuild test

[27 Jun 2008 20:52] Konstantin Osipov
Description:
main.timestamp_func            [ fail ]

--- /data0/pushbuild/pb/bzr_mysql-6.0-runtime/19/mysql-6.0.6-alpha-pb19/mysql-test/r/timestamp_func.result	2008-06-27 20:10:53.000000000 +0300
+++ /data0/pushbuild/pb/bzr_mysql-6.0-runtime/19/mysql-6.0.6-alpha-pb19/mysql-test/r/timestamp_func.reject	2008-06-27 21:13:25.000000000 +0300
@@ -9,7 +9,7 @@
 SET @ts_new = @@SESSION.timestamp;
 SELECT @ts_new - @ts_old >= 1 AS 'Timestamp Difference';
 Timestamp Difference
-1
+0
 1 means >=1 expected is true
 ** Connection con1 **
 SET @ts_old = @@SESSION.timestamp;

How to repeat:
Repeatable in pushbuild:
https://intranet.mysql.com/secure/pushbuild/getlog.pl?dir=bzr_mysql-6.0-runtime&entry=Kons...

Suggested fix:
The test relies on sleep() and @@session.timestamp to be accurate and comparable. 
In the server, sleep(1) may sleep 1 apple, while @@session.timestamp is increased by 2 oranges.

It's not clear what exactly is happening, except that sleep() is using pthread_cond_timedwait and timestamp gettimeofday(), but it's not worth the time to find out -- there has been no complains about timestamp, so we should simply change the test.
[27 Jun 2008 20:54] 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/48682

2664 Konstantin Osipov	2008-06-28
      Disable timestamp_func (Bug#37702).
[28 Aug 2008 17:15] 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/52867

2732 Horst Hunger	2008-08-28
      Fix for bug#37702: Reimplemented the test completely.
[21 Nov 2008 18:44] Matthias Leich
ok to push
[26 Nov 2008 8:33] 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/59873

2727 Horst Hunger	2008-11-26
      Fix for bug#37702: Inserted the review results into the patch.
[26 Nov 2008 9:12] 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/59883

2749 Horst Hunger	2008-11-26
      fix for bug#37702 version 6.0: timestamp merge is done and timestamp has to be enabled.
[8 Dec 2008 10:22] Bugs System
Pushed into 5.1.31  (revid:horst@mysql.com-20081126083341-x60ztis0mmai2e96) (version source revid:patrick.crews@sun.com-20081126180318-v685u61mpgoc176x) (pib:5)
[8 Dec 2008 11:33] Bugs System
Pushed into 6.0.9-alpha  (revid:horst@mysql.com-20081126091212-b7bjc2ornmpg53f5) (version source revid:horst@mysql.com-20081126091212-b7bjc2ornmpg53f5) (pib:5)
[8 Dec 2008 13:07] Paul DuBois
Test case changes. No changelog entry needed.
[19 Jan 2009 11:28] Bugs System
Pushed into 5.1.31-ndb-6.2.17 (revid:tomas.ulin@sun.com-20090119095303-uwwvxiibtr38djii) (version source revid:tomas.ulin@sun.com-20090108105244-8opp3i85jw0uj5ib) (merge vers: 5.1.31-ndb-6.2.17) (pib:6)
[19 Jan 2009 13:06] Bugs System
Pushed into 5.1.31-ndb-6.3.21 (revid:tomas.ulin@sun.com-20090119104956-guxz190n2kh31fxl) (version source revid:tomas.ulin@sun.com-20090119104956-guxz190n2kh31fxl) (merge vers: 5.1.31-ndb-6.3.21) (pib:6)
[19 Jan 2009 16:12] Bugs System
Pushed into 5.1.31-ndb-6.4.1 (revid:tomas.ulin@sun.com-20090119144033-4aylstx5czzz88i5) (version source revid:tomas.ulin@sun.com-20090119144033-4aylstx5czzz88i5) (merge vers: 5.1.31-ndb-6.4.1) (pib:6)