HDDS-4488. Open RocksDB read only when loading containers at Datanode startup #1605
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
When a datanode is started, it must read some metadata from all the Containers. Part of that metadata is stored in RocksDB, so the startup process involves opening each rocksDB and closing it again.
Testing on a dense node, with 45 high performance spinning disks and 200K containers, I saw about 75ms on average to open each RockDB. Further testing demonstrated that if we open RockDB read only, the average open time is about 35ms.
At startup time, the DBs are only read, and never written, so opening read only is fine. HDDS-4427 already ensures these opened DBs are not cached.
This change adds an "openReadOnly" flag to RDBStore and the related classes to pass it down the stack, allowing the DB to be opened read only.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-4488
How was this patch tested?
Currently existing unit tests.