teamtnt / laravel-scout-tntsearch-driver

Driver for Laravel Scout search package based on https://github.com/teamtnt/tntsearch
MIT License
1.1k stars 144 forks source link

SQLSTATE[HY000]: General error: 5 database is locked #151

Closed MadMikeyB closed 5 years ago

MadMikeyB commented 6 years ago

Hi there,

I'm getting the database being locked every day or so. I'm running quite a high traffic site with multiple indeces and they're seemingly auto-locking which is breaking functionality every day..

Any fix to this?

nticaric commented 6 years ago

Do you use multiple queue workers?

MadMikeyB commented 6 years ago

Nope, just the one.

MadMikeyB commented 6 years ago

@nticaric happy to share error logs with you - this happens constantly now.

MadMikeyB commented 6 years ago

@nticaric I really want to use and like your package, unfortunately the constant database locking is preventing me. Do you have time to assist, or is this package incapable of managing large datasets (6M+ rows) and persistent access?

thoresuenert commented 6 years ago

Share your logs and your configuration please. Take into account that this could be an SQLite problem.

MadMikeyB commented 6 years ago

You're correct in that it's probably an SQLite issue. Are there any ways to move the index files into a separate MySQL database table?

Yes SQLite can support multiple users at once. It does however lock the whole database when writing, so if you have lots of concurrent writes it is not the database you want (usually the time the database is locked is a few milliseconds - so for most uses this does not matter).

Alternately, with multiple writes per second happening concurrently, it feels like this could also be solved by queueing the indexing operations rather than having them performed instantly, does this package support that?

juehai commented 5 years ago

@MadMikeyB please have a look this https://github.com/teamtnt/tntsearch#examples

I think you may give a try about changing the /config/scout.php config file, and passing the MySQL config to TNTSearch.

thoresuenert commented 5 years ago

@MadMikeyB https://github.com/teamtnt/laravel-scout-tntsearch-driver/issues/61#issuecomment-401409268

MadMikeyB commented 5 years ago

Thanks everyone, I did solve this issue by enabling the Scout Queue in my .env file. Dumb moment from me for sure!

SCOUT_QUEUE=true
AdnanHussainTurki commented 4 years ago

SCOUT_QUEUE=true

Will make all MakeSearchable Jobs, you search results will be inaccurate unless you have queue worker running.