我的系统出了一个大问题。不知怎么的,整个sqlite系统被锁定了。我说的不是单个数据库,我说的是系统中的每个数据库。
ladb08@newcastle:~$ touch new.sqlite3
ladb08@newcastle:~$ sqlite3 new.sqlite3
SQLite version 3.7.3
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .tables
Error: database is locked
sqlite>
就连firefox也因为同样的问题无法正常打开。我不知道为什么会这样。这个服务器是一个debian服务器,它被我的团队用来开发一些站点与rails。我们将这些东西集中在一个外部的git仓库中,这样每个人都可以使用自己的用户和自己的东西副本。
另一个测试:
ladb08@newcastle:~/agendador/db$ lsof test.sqlite3
ladb08@newcastle:~/agendador/db$ fuser test.sqlite3
ladb08@newcastle:~/agendador/db$ strace -e fcntl sqlite3 test.sqlite3 .tables
fcntl(3, F_GETFD) = 0
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
fcntl(4, F_GETFD) = 0x1 (flags FD_CLOEXEC)
fcntl(3, F_SETLK, {type=F_RDLCK, whence=SEEK_SET, start=1073741824, len=1}) = -1 ENOLCK (No locks available)
Error: database is locked
没有人在使用数据库。空的新字符也是如此。
===========================================================================
更多信息:
root@newcastle:~# cd /home/ladb08/agendador/db/
root@newcastle:/home/ladb08/agendador/db# sqlite3 test.sqlite3
SQLite version 3.7.3
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .tables
Error: database is locked
sqlite> .exit
问题,一如既往。
root@newcastle:~# cd /root
root@newcastle:~# cp /home/ladb08/agendador/db/test.sqlite3 ./
root@newcastle:~# sqlite3 test.sqlite3
SQLite version 3.7.3
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .tables
agendamentos prefeituras tipo_atendimentos
bloqueios profissionais tipo_situacoes
cidadaos schema_migrations tmibges
escalas tcbos tufibges
orgaos tconselhos
orgaos_tipo_atendimentos tipo_acoes
在nfs分区外,同一个文件没有问题。
root@newcastle:~# mount
(...)
rootfs on / type rootfs (rw)
urquell.home2:/home2/home-newcastle on /home type nfs (rw,v3,addr=10.17.116.3)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
当内核的锁内存不足时(在您的情况下不太可能),或者在远程文件系统(如NFS)上执行锁操作失败时,返回错误代码ENOLCK
。
显然,你的文件服务器被配置为不支持文件锁定。
(这是否是个好主意还有待商榷)