juicedata / juicefs

JuiceFS is a distributed POSIX file system built on top of Redis and S3.
https://juicefs.com
Apache License 2.0
10.66k stars 930 forks source link

mysql : InnoDB: Unable to lock ./ibdata1 error: 11 #1587

Closed Nick-0314 closed 2 years ago

Nick-0314 commented 2 years ago

What happened:

Mysql:

I forced the operating system to restart (after power restart) mysql startup error InnoDB: Unable to lock ./ibdata1 error: 11 The 2022-03-16 T02:10:29. 964608 z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. It'll take about three minutes to recover on its own

Some people say it is caused by NFS lock. How to solve it under JuicEFS

What you expected to happen:

Mysql can start normally

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?

Environment:

SandyXSD commented 2 years ago

Do you put data files of MySQL in JuiceFS? Is there any other client running MySQL with the same data files?

Nick-0314 commented 2 years ago

Yes, I put the mysql data files into JuicEFS, only this mysql client, mysql reported an error and started about three minutes later (it should have locked the files successfully), but three minutes is too long for our failover, and there is no guarantee that three minutes can be started properly every time

SandyXSD commented 2 years ago

It's probably caused by the crash of JuiceFS process (since you force restarted the host), which leaves some files locked by the previous session. The new session is unable to lock them until the old one is cleaned up (about ~5 mins later). You can check this log message to confirm. BTW if the old session is closed gracefully (say, by umount), the locks will be released immediately.

davies commented 2 years ago

@mytting We change to default session timeout from 5 minutes to 1 minutes by #1591 , so it will be OK when the stale session cleaned.