Details
Description
I have a test with two threads that are opening & creating the same database file at the same time (with separate connections). One of the intermittent errors I'm seeing is a race condition where one of the connections fails to open a kv store — fdb_kvs_open logs "Failed to create KV Store" and returns FDB_RESULT_INVALID_KV_INSTANCE_NAME. This seems to happen because it first sees that the store doesn't exist, then goes to create it, but by the time it tries to create it the store has already been created by the other connection. Here's the relevant part of the backtrace:
frame #4: 0x0000000100131cce libCBForest-Interop.dylib`::fdb_log(log_callback=0x0000000100504810, status=FDB_RESULT_INVALID_KV_INSTANCE_NAME, format="Failed to create KV Store '%s' as it already exists.") + 478 at filemgr.cc:168
|
* frame #5: 0x0000000100192d3f libCBForest-Interop.dylib`_fdb_kvs_create(root_handle=0x00000001005046e0, kvs_name="myview", kvs_config=0x0000700000208eb0) + 671 at kv_instance.cc:1350
|
frame #6: 0x0000000100192945 libCBForest-Interop.dylib`::_fdb_kvs_open(root_handle=0x00000001005046e0, config=0x0000700000208f00, kvs_config=0x0000700000208eb0, file=0x00000001023014c0, filename="/tmp/forest_temp.view.index", kvs_name="myview", handle=0x0000000100503810) + 325 at kv_instance.cc:1574
|
frame #7: 0x00000001001939ef libCBForest-Interop.dylib`::fdb_kvs_open(fhandle=0x00000001005043f0, ptr_handle=0x0000700000209068, kvs_name="myview", kvs_config=0x0000000000000000) + 1967 at kv_instance.cc:1754
|
frame #8: 0x000000010009e2bd libCBForest-Interop.dylib`cbforest::Database::getKeyStore(this=0x00000001005044d8, name="myview") const + 1645 at Database.cc:154
|
I'm using the current latest stable commit, d16733d92.
Attachments
For Gerrit Dashboard: MB-20074 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
65544,2 | MB-20074 Tolerate KVS creation racing | stable | forestdb | Status: MERGED | +2 | +1 |
65547,2 | MB-20074 Tolerate KVS creation racing | master | forestdb | Status: MERGED | +2 | +1 |