Bug #13141 myisamchk does not honour the --tmpdir directive
Submitted: 13 Sep 2005 14:55 Modified: 25 Sep 2005 9:30
Reporter: Raj Thukral Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.0.18, 4.0.28, myisamchk v 2.6 OS:FreeBSD (freebsd 4.10)
Assigned to: Ingo Strüwing CPU Architecture:Any

[13 Sep 2005 14:55] Raj Thukral
Description:
myisamchk does not seem to honour the tmpdir directive in any way, instead creating the .TMD file in the same directory as the table being repaired.

tried -t=, --tmpdir=, -O tmpdir=, setting the env TMPDIR variable, setting tmpdir in the my.cnf.

How to repeat:
just run myisamchk with a --tmpdir= directive and check where the .TMD file gets created.
[14 Sep 2005 12:52] Valeriy Kravchuk
Verified with 4.1.15-BK and bin/myisamchk  Ver 2.7 for redhat-linux-gnu at i686 on Linux. So, it should be the same behaviour in 4.0.x...

Performed the following steps:

1. Created a relatively large table in the test database (500000 records)
2. Stopped the server and executed:

[openxs@Fedora 4.1]$ pwd; bin/myisamchk -o --tmpdir=/tmp var/test/*.MYI
...

3. While it was performing recovering for a large table (using -o option, otherwise myisamchk works too fast):
...
- recovering (with keycache) MyISAM-table 'var/test/test_table2.MYI'
Data records: 500000
74000

in the other window I've got:

[openxs@Fedora openxs]$ pwd; ls dbs/4.1/var/test
/home/openxs
addresses.frm            ImageFile.frm  T1.MYI           test_table2.MYD
b.frm                    ImageFile.MYD  T2.frm           test_table2.MYI
b.MYD                    ImageFile.MYI  T2.MYD           test_table2.TMD
b.MYI                    t1.frm         T2.MYI           test_table.frm
customers2addresses.frm  T1.frm         T3.frm           test_table.MYD
distmtimes.frm           t1.MYD         T3.MYD           test_table.MYI
distmtimes.MYD           T1.MYD         T3.MYI
distmtimes.MYI           t1.MYI         test_table2.frm

Note the .TMD file! It is not in /tmp, it is in dbs/4.1/var/test directory, as well as table itself. 

After myisamchk finished .TMD file disappeared.

So, it really looks like this option is ignored.
[25 Sep 2005 9:30] Sergei Golubchik
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Additional info:

This is not a bug. TMD file is a repaired table file that is later renamed to MYD.
As a file cannot be renamed over filesystem boundaries, TMD file is always created where original MYD file is. All really *temporary* files - that are used as a temporary storage only (note that TMD is not a temporary storage, it's destination file) - are created in the tmpdir.