Bug #41776 type_date.test may fail if run around midnight.
Submitted: 29 Dec 2008 3:45 Modified: 4 Aug 2009 23:30
Reporter: Sergey Petrunya Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Tests Severity:S3 (Non-critical)
Version:5.0, 5.1, 6.0 bzr OS:Any
Assigned to: Matthias Leich CPU Architecture:Any

[29 Dec 2008 3:45] Sergey Petrunya
Description:
anet.mysql.com/secure/pushbuild/getlog.pl?dir=bzr_mysql-6.0-bka-preview&entry=Sergey_Petrunia__sergefp-20081227193100-1&name=test_ps_row&plat=sles10-ia64-a-1
main.type_date                 [ fail ]

--- /data0/pushbuild/pb1-1/pb/bzr_mysql-6.0-bka-preview/51/mysql-6.0.10-alpha-pb51/mysql-test/r/type_date.result	2008-12-27 23:38:46.000000000 +0300
+++ /data0/pushbuild/pb1-1/pb/bzr_mysql-6.0-bka-preview/51/mysql-6.0.10-alpha-pb51/mysql-test/r/type_date.reject	2008-12-28 00:00:00.000000000 +0300
@@ -159,27 +159,27 @@
 INSERT INTO t1 VALUES (DATE(NOW()), 1);
 SELECT COUNT(*) FROM t1 WHERE a = NOW();
 COUNT(*)
-0
+1
 EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW();
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+1	SIMPLE	t1	system	PRIMARY	NULL	NULL	NULL	1	
 INSERT INTO t1 VALUES (DATE(NOW()), 2);
 SELECT COUNT(*) FROM t1 WHERE a = NOW();
 COUNT(*)
-0
+2
 EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW();
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+1	SIMPLE	t1	ref	PRIMARY	PRIMARY	3	const	1	Using index
 SELECT COUNT(*) FROM t1 WHERE a = NOW() AND b = 1;
 COUNT(*)
-0
+1
 EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW() AND b = 1;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+1	SIMPLE	t1	const	PRIMARY	PRIMARY	7	const,const	1	Using index
 ALTER TABLE t1 DROP PRIMARY KEY;
 SELECT COUNT(*) FROM t1 WHERE a = NOW();
 COUNT(*)
-0
+2
 EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW();
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	2	Using where

mysqltest: Result content mismatch

Stopping All Servers
Restoring snapshot of databases
Resuming Tests

Apparently the test doesn't account for the possibility of midnight
occurring in the middle of the test.

How to repeat:
run type_date.test around midnight or just look at the above diff and see what's the problem

Suggested fix:
Develop a routine which will determine if it is several minutes before the midnight. If it is, either
1. Skip the test
2. Wait until midnight is over before running the test.
[29 Dec 2008 6:14] Sveta Smirnova
Thank you for the report.

Verified as described.
[9 Jan 2009 20:48] 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/62897

2731 Matthias Leich	2009-01-09
      Fix for Bug#41776 type_date.test may fail if run around midnight
      + minor improvements
[13 Jan 2009 16:27] Matthias Leich
Pushed to
6.0-bugteam
5.1-bugteam
[4 Aug 2009 23:30] Paul DuBois
Test case changes. No changelog entry needed.