Bug #47902 partition_recover_myisam fails with --ps-protocol
Submitted: 7 Oct 2009 20:12 Modified: 29 Jan 2011 23:06
Reporter: Sergey Petrunya Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1-bzr, current OS:Linux (Ubuntu 9.04 x86)
Assigned to: Mattias Jonsson CPU Architecture:Any

[7 Oct 2009 20:12] Sergey Petrunya
Description:
If I run 

./mysql-test-run --suite=parts --ps-protocol partition_recover_myisam

it will fail as follows:

parts.partition_recover_myisam           [ fail ]
        Test ended at 2009-10-08 00:06:03

CURRENT_TEST: parts.partition_recover_myisam
--- /home/psergey/dev/mysql-5.1/mysql-test/suite/parts/r/partition_recover_myisam.result	2009-09-03 23:31:46.000000000 +0300
+++ /home/psergey/dev/mysql-5.1/mysql-test/suite/parts/r/partition_recover_myisam.reject	2009-10-07 23:06:03.000000000 +0300
@@ -18,13 +18,6 @@
 9
 10
 11
-Warnings:
-Error	145	Table './test/t1_will_crash' is marked as crashed and should be repaired
-Error	1194	Table 't1_will_crash' is marked as crashed and should be repaired
-Error	1034	1 client is using or hasn't closed the table properly
-Error	1034	Size of indexfile is: 1024        Should be: 2048
-Error	1034	Size of datafile is: 77       Should be: 7
-Error	1034	Number of rows changed from 1 to 11
 DROP TABLE t1_will_crash;
 CREATE TABLE t1_will_crash (a INT, KEY (a))
 ENGINE=MyISAM
@@ -48,11 +41,4 @@
 9
 10
 11
-Warnings:
-Error	145	Table './test/t1_will_crash#P#p1' is marked as crashed and should be repaired
-Error	1194	Table 't1_will_crash' is marked as crashed and should be repaired
-Error	1034	1 client is using or hasn't closed the table properly
-Error	1034	Size of indexfile is: 1024        Should be: 2048
-Error	1034	Size of datafile is: 28       Should be: 7
-Error	1034	Number of rows changed from 1 to 4
 DROP TABLE t1_will_crash;

mysqltest: Result content mismatch

 - saving '/home/psergey/dev/mysql-5.1/mysql-test/var/log/parts.partition_recover_myisam/' to '/home/psergey/dev/mysql-5.1/mysql-test/var/log/parts.partition_recover_myisam/'
------------------------------------------------------------
The servers were restarted 0 times
Spent 0.000 of 2 seconds executing testcases

Without --ps-protocol, the test passes.
With --ps-protocol, it fails in multiple configurations and scenarios, see e.g.
http://askmonty.org/buildbot/builders/jaunty-amd64-rel/builds/199
http://askmonty.org/buildbot/builders/gentoo-x86-dbg/builds/168

How to repeat:
Get current 5.1 tree (the bug seems to have been there for quite some time, as we have it in current mariadb which is based on 5.1.38+)

Compile with ./BUILD/compile-pentium-debug-max, run the test as specified above.
[7 Oct 2009 20:43] MySQL Verification Team
On Windows:

vardir: c:/build/mysql-5.1/mysql-test/var
Checking leftover processes...
 - found old pid 4532 in 'mysqld.1.pid', killing it...
   process did not exist!
Removing old var directory...
Creating var directory 'c:/build/mysql-5.1/mysql-test/var'...
Installing system database...
Using server port 51593

==============================================================================

TEST                                      RESULT   TIME (ms)
------------------------------------------------------------

worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 13000..13009
parts.partition_recover_myisam           [ fail ]
        Test ended at 2009-10-07 17:42:04

CURRENT_TEST: parts.partition_recover_myisam
--- c:/build/mysql-5.1/mysql-test/suite/parts/r/partition_recover_myisam.result Mon Sep 21 08:44:44 2009
+++ c:\build\mysql-5.1\mysql-test\suite\parts\r\partition_recover_myisam.reject Wed Oct 07 17:42:03 2009
@@ -18,13 +18,6 @@
 9
 10
 11
-Warnings:
-Error  145     Table './test/t1_will_crash' is marked as crashed and should be repaired
[7 Oct 2009 20:46] MySQL Verification Team
Thank you for the bug report.
[9 Oct 2009 0:36] Omer Barnir
triage: setting to SR51TEST - assuming the test is at fault but might be a server issue - not clear how the 'crashed table ' is crated
[10 Jan 2011 21:13] Mattias Jonsson
The diff is because that the warnings is created in the prepare phase before the execution, and if mysql_stmt_result_metadata(stmt) succeeded (!= NULL) those errors where cleared. This patch fixes that:
=== modified file 'client/mysqltest.cc'
--- client/mysqltest.cc	2010-12-19 17:07:28 +0000
+++ client/mysqltest.cc	2011-01-10 21:02:20 +0000
@@ -7241,8 +7241,10 @@
 
       mysql_free_result(res);     /* Free normal result set with meta data */
 
+#ifdef bug47902
       /* Clear prepare warnings */
       dynstr_set(&ds_prepare_warnings, NULL);
+#endif bug47902
     }
     else
     {
[10 Jan 2011 22:44] 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/128362

3539 Mattias Jonsson	2011-01-10
      Bug#47902: partition_recover_myisam fails with --ps-protocol
      
      The problem was that the warnings was never written out
      when running with --ps-protocol. This was because the
      warnings only appeared during the prepare phase, not
      the execute phase.
      
      Solved by not clearing the warnings from the prepare phase
      if there was no other warnings.
      
      If there are warnings from the execute phase, it is very
      likely to be the same as from the prepare phase. My tests
      show that if not clearing the warnings from the prepare
      phase when there are warnings from the execute phase, there
      will be duplicated warnings in the result.
     @ client/mysqltest.cc
        Only reset the prepare warnings if there are warnings from
        the execute phase. Otherwise these warnings will never be
        returned.
[11 Jan 2011 15:41] Bjørn Munch
This looks good, have also tested it.
[12 Jan 2011 12:06] Bjørn Munch
Bug #21089 closed as duplicate of this.
[26 Jan 2011 20:15] Bugs System
Pushed into mysql-trunk 5.6.2 (revid:mattias.jonsson@oracle.com-20110126201331-ab82uv7s5qmdufs5) (version source revid:mattias.jonsson@oracle.com-20110126201331-ab82uv7s5qmdufs5) (merge vers: 5.6.2) (pib:24)
[26 Jan 2011 20:16] Bugs System
Pushed into mysql-5.5 5.5.10 (revid:mattias.jonsson@oracle.com-20110126183353-8fngni1uuyybmz9u) (version source revid:mattias.jonsson@oracle.com-20110126183353-8fngni1uuyybmz9u) (merge vers: 5.5.10) (pib:24)
[26 Jan 2011 20:16] Bugs System
Pushed into mysql-5.1 5.1.56 (revid:mattias.jonsson@oracle.com-20110126155021-evjpfdciphnd50sy) (version source revid:mattias.jonsson@oracle.com-20110126153434-z7k5auijsepxhdss) (merge vers: 5.1.56) (pib:24)
[26 Jan 2011 23:45] Paul DuBois
Test suite change. No changelog entry needed.