Bug #4375 Windows specific directories are copied during replication
Submitted: 2 Jul 2004 13:04 Modified: 31 Oct 2005 20:06
Reporter: David Newcomb (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:all OS:Microsoft Windows (Win2000 sp4)
Assigned to: Alexander Ivanov CPU Architecture:Any

[2 Jul 2004 13:04] David Newcomb
Description:
Set up: Part of the filesystem is partitioned and mounted under the c:\mysql\data directory. See uploaded (low res) pictures.

How to repeat:
C:\tmp\t>mysql -uroot -h10.165.176.184
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 34484 to server version: 4.0.16-nt-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show databases;
+---------------------------+
| Database                  |
+---------------------------+
| RECYCLER                  |
| System Volume Information |
| mysql                     |
| quantel                   |
+---------------------------+
4 rows in set (0.00 sec)
mysql> exit
Bye

C:\tmp\t>
C:\tmp\t>mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 4.1.3-beta-nt-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show databases;
+----------+
| Database |
+----------+
| mysql    |
+----------+
1 row in set (0.00 sec)

mysql> change master to master_host='10.165.176.184';
Query OK, 0 rows affected (0.06 sec)

mysql> load data from master;
Query OK, 0 rows affected, 1 warning (13.14 sec)

mysql> show databases;
+---------------------------+
| Database                  |
+---------------------------+
| RECYCLER                  |
| System Volume Information |
| mysql                     |
| quantel                   |
+---------------------------+
4 rows in set (0.00 sec)

mysql>

Suggested fix:
It should not try to replicate RECYCLER or "System Volume Information" as these are system hidden directories which are not available to even the local users of 10.165.176.184.
[2 Jul 2004 13:05] David Newcomb
How the mounted drive shows up

Attachment: drive.jpg (image/jpeg, text), 12.59 KiB.

[2 Jul 2004 13:06] David Newcomb
RECYCLER and "System Volume Information" are not visible

Attachment: hidden.jpg (image/jpeg, text), 18.62 KiB.

[2 Jul 2004 13:31] Guilhem Bichot
Hi!
please, what does
dir c:\mysql\data\RECYCLER
and
dir "c:\mysql\data\System Volume Information"
show (when run as the Windows user which the MySQL server is running as)?
[3 Jul 2004 2:18] David Newcomb
I'm at home now so don't have the spools here. But basically, when you "cd c:\mysql\date" and do "dir" then nothing shows. If you do a "dir /a:h" then R and SVI both show up. Everything inside R must be seen by using the "dir /a:h" method. [It just contains deleted files]. Amy attempt to enter the SVI folder resulted in "Access is denied". I tried this under the user that installed it and Adinistrator; the results were the same in both cases.
[4 Jul 2004 16:22] Guilhem Bichot
Hi David,
Well, I don't know what to do with this.
As you showed, the DOS "dir" command does not list hidden directories. It probably reads the list of all directories (opendir()+readdir()) and then throws away hidden ones.
For the MySQL server, the definition of a database is a subdirectory of "datadir", i.e. something which is returned by the (excerpt from the SHOW DATABASES code, which is what LOAD DATA FROM MASTER uses on master) opendir()+readdir() system function (which exist on Windows and Unix).
To not show hidden subdirectories would need that mysqld tests if the directory is hidden. But if this needs an additional disk read (to read the file's properties to see if it's hidden, I mean) this is not acceptable (it will cause a performance loss whereas the presence of hidden files is a rare case).
So I will ask our Windows specialists what they think about it, and will let you know.
Until then... I don't remember if it's possible on Windows to mount only a subdir of a remote disk, instead of the root directory of the remote disk. If yes, you could move your datadir to a subdir of the remote disk and then no more hidden files. If no...
[5 Jul 2004 19:10] Guilhem Bichot
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

Hi,
starting from MySQL 4.0.21 for Windows, SHOW DATABASES will not show any "hidden" or "system" directory. This will fix your problem with LOAD DATA FROM MASTER.
Thank you for your bug report.

ChangeSet@1.1896, 2004-07-05 19:07:26+02:00, guilhem@mysql.com
[29 Jul 2004 23:44] Miguel Solorzano
Re-opened due to issue explained in bug #4737.
[20 Oct 2005 10:26] Alexander Ivanov
ChangeSet
  1.2475 05/10/19 18:01:23 aivanov@mysql.com +1 -0
  Fix for BUG#4375: Windows specific directories are copied
   during replication.
   Modified my_dir(). Now this function skips hidden and system
   files which sometimes are created by Windows.
   NOTE. The fix is similar to the previuos one (05 July 2004)
   except for correct setting of the 'attrib' variable value
   (within the previous fix this variable was left uninitialized
   when my_dir() was called with My_flags & MY_WANT_STAT == 0).

  mysys/my_lib.c
    1.21 05/10/19 18:01:08 aivanov@mysql.com +13 -2
    Modified my_dir().
     Now this function skips hidden and system files
     which sometimes are created by Windows.

The fix will appear in 4.1.15 and 5.0.15
[20 Oct 2005 12:01] Alexander Ivanov
Corrected: The fix will appear in 4.1.16 and 5.0.16
[31 Oct 2005 20:06] Paul Dubois
Noted in 4.1.16, 5.0.16 changelogs.