Bug #58600 main.not_embedded_server test does not cleanup properly
Submitted: 30 Nov 2010 17:20 Modified: 10 Jan 2011 15:35
Reporter: Nirbhay Choubey Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Tests Severity:S3 (Non-critical)
Version:mysql-5.5-bugteam OS:Any
Assigned to: Matthias Leich CPU Architecture:Any
Tags: mysql-5.5-bugteam, mysql-5.5-security, mysql-trunk-bugfixing

[30 Nov 2010 17:20] Nirbhay Choubey
Description:
main.not_embedded_server does not clean up its state properly
and hence other subsequent tests may get affected.

The above mentioned test leaves 'mytest' behind in 'test'
directory, so if a subsequent test tries to drop 'test'
database, it fails with the following error :

query 'DROP DATABASE test' failed: 1010: Error dropping database (can't rmdir './test/', errno: 17)

How to repeat:
cd mysql-test/

perl mtr not_embedded_server drop_test_db.test

Suggested fix:
At the end, the test should drop 'mytest' file create during :
SELECT MAX(key1) FROM t1 WHERE f() < 1 INTO OUTFILE 'mytest';
[30 Nov 2010 17:21] Nirbhay Choubey
Testcase for this bug.

Attachment: drop_test_db.test (application/octet-stream, text), 129 bytes.

[30 Nov 2010 21:58] Sveta Smirnova
Thank you for the report.

Verified as described. mysql-trunk is not affected.
[7 Dec 2010 16:35] 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/126243

3171 Matthias Leich	2010-12-07
      1. Fix for Bug#58600 main.not_embedded_server test does not cleanup properly
         - remove the superfluous file
         - add an preemptive removal of the outfile before the
           SELECT ... INTO OUTFILE ...
      2. Remove an already disabled subtest
         It's functionality is covered by tests in the suite funcs_1.
      3. Adjust the formatting within some sub testcase to the formatting used
         in all other sub testcases
[18 Dec 2010 12:25] John Embretsen
Matthias, I looked at the patch at http://lists.mysql.com/commits/126243 and it certainly looks sane to me. Tested that it fixes the problem, on OpenSolaris x64 and Mac OS X 10.6. OK to push.

It took a few seconds until I understood one comment, feel free to rephrase (or not):

+# At least today (2010-12-07) the previous failing statement creates the outfile.
+# This need not to be true for the future because the server might be improved.
+# ==> Do not worry about the existence of the outfile.

Alternative suggestion:
# Cleanup of the outfile is necessary, at least today (2010-12-07), because 
# the outfile is created even if the SELECT statement fails. 
# If the server is improved in the future this may not happen.
# ==> Do not fail if the outfile does not exist.

Another minor comment...
You have:
DROP TABLE IF EXISTS t1;
and:
DROP table t1;

On first sight it seems inconsistent to have lowercase "table" in "DROP table t1", but I may be missing something.

Anyway, patch works and looks fine, so feel free to leave as is.
[7 Jan 2011 12:02] 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/128158

3219 Matthias Leich	2011-01-07
      1. Fix for Bug#58600 main.not_embedded_server test does not cleanup properly
         - remove the superfluous file
         - add an preemptive removal of the outfile before the
           SELECT ... INTO OUTFILE ...
      2. Remove an already disabled subtest
         It's functionality is covered by tests in the suite funcs_1.
      3. Adjust the formatting within some sub testcase to the formatting used
         in all other sub testcases
[7 Jan 2011 16:40] Bugs System
Pushed into mysql-trunk 5.6.2 (revid:matthias.leich@oracle.com-20110107161048-6x3vunwcyt3jl4pe) (version source revid:matthias.leich@oracle.com-20110107125958-n9oif0ezbse5gf86) (merge vers: 5.6.2) (pib:24)
[7 Jan 2011 16:40] Bugs System
Pushed into mysql-5.5 5.5.9 (revid:matthias.leich@oracle.com-20110107133746-6j11qtmifhjq0mw2) (version source revid:matthias.leich@oracle.com-20110107120805-ui9t3rdn4mflksec) (merge vers: 5.5.9) (pib:24)
[10 Jan 2011 15:35] Paul DuBois
Changes to test suite. No changelog entry needed.