[MDEV-24189] Rename Table twice raise error "Tablespace is missing for a table" Created: 2020-11-11 Updated: 2024-01-29 Resolved: 2022-07-25 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Affects Version/s: | 10.5.7 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Daniel Black | Assignee: | Daniel Black |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows docker container only. Not Linux, not windows native |
||
| Attachments: |
|
||||||||||||
| Issue Links: |
|
||||||||||||
| Description |
|
From: https://github.com/docker-library/mariadb/issues/331 Run docker-compose up -d CREATE TABLE NewTable ( Run a RENAME table statement like this: Then, run again, another RENAME the statement: The error I'm getting is: Notes: So I think that there's some problem with windows + mariadb:latest image |
| Comments |
| Comment by Vladislav Vaintroub [ 2020-11-11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I do not have a slightest idea where this may ever come from, nor I'm familiar with docker that much. I guess it might be Innodb on Linux not handling case-insensitivity as expected on a slightly weird platform. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Rafael Ambrosio [ 2020-11-11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Everyone, Thank you @Daniel Black for replicate the opened issue I've posted on github. I appreciate your effort. Tested on enable the case-sensitivity on persist mapped folder on my windows using this: https://www.windowscentral.com/how-enable-ntfs-treat-folders-case-sensitive-windows-10 and I was pretty confident that this workaround would really work. But it did not work Setting
to force all keep on lower case. But with no positive results. I opened side by side (mariadb and mysql) persist volume and figured out that even both containers is using InnoDB engines, the MySQL not create .frm files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2020-11-11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
For what it is worth, there is CIOPFS (Case-Insensitive-On-Purpose-File-System) that allows case-sensitive Linux file systems to emulate case-insensitive ones. I have used it maybe 5 years ago to troubleshoot similar issues. The lower_case_table_names is a crude hack. If I remember correctly, on Windows, InnoDB is ignoring that parameters and always treating it as if it were 1. The InnoDB data structures are case-sensitive (there is a strcmp() like comparison in a hash table of table names), and we try to emulate case-insensitive table names by converting them to lower case. And to begin with, storage engines see table names in the filename-safe encoding, which uses 1, 3, or 5 ASCII characters per character. The 1-byte and 3-byte encodings are supposed to be compatible with the lower-case mapping. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Rafael Ambrosio [ 2020-11-11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The strange thing is: If you have a windows s.o. please try to reproduce, it's so easy: Install docker desktop and create an empty folder and a docker-compose.yml file with this:
open cmd or another terminal (I'm using gitbash) on the same directory of docker-compose.yml
connect to database, via terminal or via some db client (I'm using DBeaver)
then:
That's why I opened the issue https://github.com/docker-library/mariadb/issues/331 The @Daniel Black, autor of this issue, copied the github issue and posted here, trying to help us. I kindly ask to read the github thread/responses. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Vladislav Vaintroub [ 2020-11-11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ambrosiora, I think from practical poin of view, if you're running MariaDB on production, on Linux or not, it perhaps makes more sense to have MariaDB on Windows natively locally, rather than MySQL on Linux on docker on Windows. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Rafael Ambrosio [ 2020-11-12 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Yes @Vladislav Vaintroub you're right on this point of view and on production I run MariaDB on AWS RDS, wich is way more consistent. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2020-11-12 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
wlad, I think that you are best equipped to diagnose this. I tried to test with ciopfs on top of /dev/shm as well as on ext4, but the bootstrap failed as follows:
So, it looks like ciopfs has fallen victim to some bit-rot, because this definitely worked a few years ago. I patched out, but then the test passed:
The test that I used was as follows:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Vladislav Vaintroub [ 2020-11-12 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
On WSL1, on NTFS partition there are no problems with the test. Server correctly determines lower_case
$ dir var/mysqld.1/data/mytestdb/ I had to remove the "ignore world-writable my.cnf" bits from my_default.c to make this work, and also instruct server to put afunix socket to "/home" filesystem. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Vladislav Vaintroub [ 2020-11-12 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I can reproduce on WSL2 though | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Vladislav Vaintroub [ 2020-11-12 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I reproduced on WSL2. As per Innodb, I am not sure why Innodb is doing the stat(),at all, if the only thing it needs to to is a rename() ambrosiora, this error does not happen if you use innodb-file-per-table=0, in case this offers any consolation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Vladislav Vaintroub [ 2020-11-12 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
So, upon even further examination, I can see the issue in both WSL1, and WSL2, and also I captured some data from the procmon ProcessMonitorLogfile.CSV By taking a closer look, there is something in procmon that corresponds to the failing stat(). from strace.out
on Windows side, in procmon, the old name is used
So, there is a mismatch, Linux stats() a new name w ./mytestdb/newtablea.ibd , Windows wants to open old name of that file C:\work\data\mytestdb\newtable.ibd, and bad things happen. I'm not sure what more we could do here. danblack, if you're into filing external bugs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2020-11-12 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Caught me out on not having a Windows environment available and the WSL issue tracker being strict on inputs. ambrosiora do you want to compile the rename.c here (`gcc -o rename rename.c; strace -o rename.strace -f ./rename`) and see if like the above the strace shows stat returning ENOENT and the ProcessMonitor log showing the incorrect file access? If it follows that pattern can you write an WSL issue? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Rafael Ambrosio [ 2020-11-13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Sure I can try | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Rafael Ambrosio [ 2020-11-13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hey danblack, I did it. strace is not returnig ENOENT, but it seems that is there an exception. Added a files.PNG just to show that test1 is there, and added the rename.strace | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Rafael Ambrosio [ 2020-11-13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hey, recently installed the Docker Desktop and a message was displayed saying: "Docker is using WSL now, blah blah blah.. enable it, etc..." Now, I just read >>here<< if I go to
and set wslEngineEnabled to false, I guess that Docker will run in a full VM mode, just like before WSL. So, I was wondering... If I temporarily disable the WSL and recreate the test case, just to see if the problem shows up | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Rafael Ambrosio [ 2020-11-13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hey guys, I don't know if this is good or bad news, but disabling WSL and coming back to Docker Containers Running with Hyper-V, the error don't came up. I guess WSL is way more superior, how can we deal with it danblack and wlad? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2020-11-13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The steps I quotes where for a WSL Debian or Ubuntu terminal. I think you managed a windows compile, not sure what strace you used but it wasn't the linux one. Can you try again. When you do the WSL bug report point directly at Vlad's "I reproduced on WSL2." comment. Yes, you have a work around for Docker. My attempt at WSL Linux install stopped on encrypted or space disk error. Reporting bugs to the right location is the only way they get fixed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Rafael Ambrosio [ 2020-11-13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hey danblack, you're right, I did it on windows, now I did a setup on windows like this: https://www.youtube.com/watch?v=epZOKY83t8g here the results: rename-wsl.strace Tell me if I did it right this time | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2020-11-16 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ambrosiora did it right, however something I did in the test case minimisation to rename.c dropped whatever caused the bug. If you could follow the WSL bug report to the letter, include your original problem, and point at Vlad's traces is hopefully sufficient for them to fix it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2020-11-17 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
wlad, it seems to me that the questionable stat() call is in the function dict_table_rename_in_cache(), invoked via the following:
I cannot entirely confirm this, because the message in strace.out
Which message was actually written to the error log? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Vladislav Vaintroub [ 2020-11-17 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
2020-11-17 19:43:35 8 [ERROR] InnoDB: Cannot rename './mytestdb/newtablea.ibd' to './mytestdb/newtableb.ibd' because the source file does not exist | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2022-07-25 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ambrosiora sorry for taking so long. I retested on Windows 10 - 19044.1826 and was unable to reproduce this. I also tested on Windows 11 22000.795 and couldn't reproduce it there either. Can you please retest if your Windows updates resolve this. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2022-07-25 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Closing as not a bug, but really not our bug. If if this is an lets continue the discussion in MDEV-27580 I prepared a work around for 10.3 in that is available as quay.io/mariadb-foundation/mariadb-devel:10.3-mdev-29015-avoid-wsl8443. If the Windows update resolves this I'd rather leave the older code alone. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Rafael Ambrosio [ 2022-07-25 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi! Unfortunatelly, I don't have the environment anymore, neither the laptop. Since I started to have slowing down problems to work with docker on WSL, I decided to migrate to a real Linux environment. Sorry, but thanks for all the effort! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Andreas Tschersich [ 2022-12-12 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The error is back with Windows 10 19044.2311. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Vladislav Vaintroub [ 2022-12-12 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
if so, maybe danblack can reopen https://github.com/microsoft/WSL/issues/8443 . it still remains a "not MariaDB bug" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Seiler [ 2024-01-27 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
We had a user reproduce this issue on Win10 Pro 22H2, Docker Desktop + WSL2, MariaDB 1:11.2.2+maria~ubu2204, that is a migration failed with
with a MariaDB log of
I'm commenting about it because the user reported that the reproducer in https://github.com/microsoft/WSL/issues/8443#issuecomment-1836812926 did not print any sort of "error on fstat errno 2", so while I think this it's still possible that MariaDB triggers some weird behaviour in 9P on Windows 10, it may be too quick to dismiss it as WSL#8443 and "not a MariaDB bug". | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2024-01-29 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Xiphoseer, Sorry to here we've still got a new form of this. To validate the system calls used:
|