Problem with atomic replace when user does not own file
- Dominant language
- C++
- Stars
- 16.7k
- Forks
- 1.6k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 126
Description
The atomicReplace function chowns the new file to match the ownership of the old file. This can fail when the file is owned by a different user than the FDB user, even if the FDB user has permissions to write both files.
For example, the FDB process is running as `user1`, which is a member of `group1`. And that the cluster file is owned by `user2:group1`. The cluster file is in `/var/fdb/fdb.cluster`, with the permissions `rw-rw-r--`, and `/var/fdb` has permissions `rwxrwxr--`. The process will successfully write to a temp file in `/var/fdb`, and the temp file will have the owner `user1:group1`. The process will then chown the temp file to `user2:group1`, which will fail.
We've run into this in a couple of different scenarios on Kubernetes, when changing volume permissions or running different containers in a pod with different users. I think we should find a way to make the atomic replace work in this scenario.
I believe this behavior was introduced in #1316, to address #1211.
Contributor guide
Assessment
This issue has not been assessed yet.