New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add filesystem locking on jetstream fileStore instances. #4407
base: dev
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 #NNN
maindev