Hi everyone,

I've been playing around recently at home with mysql databases on my smb
share.
In my tests I only used select-statements on Windows 10 using the C# ADO.NET
wrapper with the latest nuget package.

I've opened the database and selected a few records on my workstation,
subsequent select's were very fast.
Then on antoher workstation I did the same.
After moving back to my workstation I found that the same statement was
much slower.

My investigation showed that the first client is granted an smb-oplock and
the client caches the whole database locally.
That's why subsequent select's are super fast.
When another client select's data, the smb server sends an oplock break
request to the first client, and it removes the cached db to load it again
over the network.

I was interested why smb breaks the oplock and found that every time I
execute my command:
SQLiteDataReader reader = command.ExecuteReader(); // C# code
wireshark shows me 3 lock requests/responses to/from smb:

1. exclusive lock, fail immediately
2. shared lock, fail immediately
3. unlock

I wonder if SQLite needs an exclusive lock (which obviously is an exclusive
lock in smb language, maybe not in ntfs/fat language) for select's on the
database, or if the translation of file-locks is broken within windows' smb
protocol implementation.
Interesting fact:
I only see those lock requests when a second user is connected to the db
(another smb detail I guess).

It's not that there's any problem here, I just want to understand what's
going on, as I've been assuming that a read only file access will not break
an smb oplock.
Maybe anyone can clarify it or is also interested in this topic.


Best Regards,
Wolfgang
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to