-
Notifications
You must be signed in to change notification settings - Fork 964
Check rocksdb closed before operating #4243
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
Conversation
8c6e5ff to
f362987
Compare
dlg99
left a comment
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.
LGTM
|
@AnonHxy The javadoc of org.rocksdb.RocksDB#close says: Would it make sense to also take this into account by adding |
|
|
||
| @Override | ||
| public void put(byte[] key, byte[] value) throws IOException { | ||
| readLock.lock(); |
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.
Acquiring the read lock for each put/get operation might be quite expensive, since the lock has to maintain the state of threads and the order they try to acquire the lock.
We could use a different approach, like a reference counter on the entire object. When everyone is done using it, then rocksdb is really closed
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.
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.
There's an alternative PR #4581 which simply handles close and count
…t() (possibly triggered by Prometheus) after RocksDB has been closed(apache#4243)
…t() (possibly triggered by Prometheus) after RocksDB has been closed(apache#4243)
…t after rocksdb has been closed (#4581) * Fix the coredump that occurs when calling KeyValueStorageRocksDB.count() (possibly triggered by Prometheus) after RocksDB has been closed(#4243) * fix race when count op in process and db gets closed. --------- Co-authored-by: zhaizhibo <[email protected]>
…t after rocksdb has been closed (#4581) * Fix the coredump that occurs when calling KeyValueStorageRocksDB.count() (possibly triggered by Prometheus) after RocksDB has been closed(#4243) * fix race when count op in process and db gets closed. --------- Co-authored-by: zhaizhibo <[email protected]> (cherry picked from commit 2831ed3)
…t after rocksdb has been closed (#4581) * Fix the coredump that occurs when calling KeyValueStorageRocksDB.count() (possibly triggered by Prometheus) after RocksDB has been closed(#4243) * fix race when count op in process and db gets closed. --------- Co-authored-by: zhaizhibo <[email protected]> (cherry picked from commit 2831ed3)
…t after rocksdb has been closed (#4581) * Fix the coredump that occurs when calling KeyValueStorageRocksDB.count() (possibly triggered by Prometheus) after RocksDB has been closed(#4243) * fix race when count op in process and db gets closed. --------- Co-authored-by: zhaizhibo <[email protected]> (cherry picked from commit 2831ed3)
…t after rocksdb has been closed (apache#4581) * Fix the coredump that occurs when calling KeyValueStorageRocksDB.count() (possibly triggered by Prometheus) after RocksDB has been closed(apache#4243) * fix race when count op in process and db gets closed. --------- Co-authored-by: zhaizhibo <[email protected]> (cherry picked from commit 2831ed3) (cherry picked from commit 9d067f4)
…t after rocksdb has been closed (apache#4581) * Fix the coredump that occurs when calling KeyValueStorageRocksDB.count() (possibly triggered by Prometheus) after RocksDB has been closed(apache#4243) * fix race when count op in process and db gets closed. --------- Co-authored-by: zhaizhibo <[email protected]> (cherry picked from commit 2831ed3) (cherry picked from commit 9d067f4)
Descriptions of the changes in this PR:
Motivation
Fix #4238
From the issue above we can see that the core dump could happen when operate Rocksdb after it has been closed. So we should check if closed before operating rocksdb.
Changes
Checking if closed before operation RocksDB.