You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a collection is created, the collection is entered with its name in the hash table vocbase->_collectionsByName.
When a collection is dropped, the collection is first removed from the hash table, and then its parameter file (parameter.json) is updated with the new collection status (i.e. "deleted"). This happens in vocbase.c:TRI_DropCollectionVocBase.
The problem is that the collection is removed from the hash and the parameter file is changed at some point after that. Before the parameter file can be changed, a write-lock on the collection must be acquired. If the server must wait for the write-lock because of concurrent read operations, a concurrent thread can create a collection with the same name.
Deletion from the hash and changing the parameter file are not atomic and be interrupted by other actions.
If a concurrent thread manages to create a collection with the same name in between, this will lead to ambiguities, and if the server is stopped before the parameter file is written to disk (e.g. because it's still waiting for the write lock), the database directory will contain two collections with identical values in the "name" attributes in the parameter files, and both with the "deleted" attribute being false. The server will then fail on startup with error message "duplicate entry for name..." in vocbase.c:AddCollection.
The text was updated successfully, but these errors were encountered:
When a collection is created, the collection is entered with its name in the hash table vocbase->_collectionsByName.
When a collection is dropped, the collection is first removed from the hash table, and then its parameter file (parameter.json) is updated with the new collection status (i.e. "deleted"). This happens in vocbase.c:TRI_DropCollectionVocBase.
The problem is that the collection is removed from the hash and the parameter file is changed at some point after that. Before the parameter file can be changed, a write-lock on the collection must be acquired. If the server must wait for the write-lock because of concurrent read operations, a concurrent thread can create a collection with the same name.
Deletion from the hash and changing the parameter file are not atomic and be interrupted by other actions.
If a concurrent thread manages to create a collection with the same name in between, this will lead to ambiguities, and if the server is stopped before the parameter file is written to disk (e.g. because it's still waiting for the write lock), the database directory will contain two collections with identical values in the "name" attributes in the parameter files, and both with the "deleted" attribute being false. The server will then fail on startup with error message "duplicate entry for name..." in vocbase.c:AddCollection.
The text was updated successfully, but these errors were encountered: