Add filesystem locking on jetstream fileStore instances.#4407
Add filesystem locking on jetstream fileStore instances.#4407jevolk wants to merge 1 commit intonats-io:devfrom
Conversation
derekcollison
left a comment
There was a problem hiding this comment.
Possible to get a test written that shows correct behavior?
Also where to we clear the lock on successful shutdown of the filestore?
c3a4492 to
34c7624
Compare
|
Thanks for taking the time to review this.
The lock is cleared when the file descriptor at
POSIX record locks used here are "process-associated" which means testing within the same process or thread group will likely be insufficient. The Let me know your thoughts, thanks. |
|
Also, the CI appears limited to Linux only; I have not verified if the windows overload is effective. |
|
If you added the close to Stop() you can do a Stop() and make sure you can recreate the filestore with the same storedir.. |
Running two instances of the server which share the same directory (e.g. default configuration `/tmp/nats/jetstream') will corrupt each other. We mitigate by creating an empty file called LOCK in the directory and then acquire a flock(2) on it. Signed-off-by: Jason Volk <jason@zemos.net>
|
By switching to It appears that Volumes have been written about how UNIX filesystem locking is a notorious shitshow, so please bear with me here. |
Resolves #NNNmaindev