I am using RocksDB and i love the performance of it. I am using it in my high requests/second server for the GET operation.
The problem is that i need to update my RocksDB from time to time.
So, i have Process_A that keeps rocksdb opened and keeps on performing get operations on it.
Now, i want Process_B to run in a crontab every X amount of time (let’s say 30 minutes) that will come and add a couple of entries in the RocksDB.
The problem is that the file is in use, and i get the LOCK error, naturally.
I am running this on debian buster.
What puzzles me though, is that it kind of works randomly.
Did anybody try this scenario? Or maybe knows a better way of doing this?
The other way would be to stop Process_A, perform the updates with Process_B, then restart Process_A, but this would cause me to lose requests…
Thank you.
2
Answers
For whoever meets this scenario, just found out. It's totally possible, you just have to open the RocksDB from Process_A with readonly mode.
Not sure what's the method for the native rocksdb library, i'm using RocsDB-Sharp for C# and it has a method called RocksDB.OpenReadonly() (instead of just Open()).
Next, i'll test if the changes actually applies when i insert data while opened in the other process, or if i have to close the DB from Process_A and reopen it each time i insert something.
I'll keep you posted.
You cannot open the same DB with 2 processes, if both have write permission.
If you have one process for write, another one for read, the data will not be synced until it’s flushed. For concurrently read/write, typically the user creates multiple threads in one process.