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
Performing a delete operation on an item in a db object that is already in the closed state should throw an exception. Currently this does not happen for the first occurrence of an attempted delete, since the Tombstone file has not yet been created.
A possible solution could be to always initialize a tombstone file whenever a new db file is created.
The text was updated successfully, but these errors were encountered:
@amannaly, I would like to take this issue to fix it. How should I proceed?
One simple way is to check for dbInternal.isClosing() inside the delete() in the HaloDB class and if it is closing we can just throw the appropriate exception. Or better yet, we can set an isClosing flag in HaloDB itself and use that to figure out if the db is already closed.
The other way could be what @siddharths suggested.
Also, similar to this issue, I've noticed that the get operation succeeds on a closed db object for a previously unknown key but fails for a key that was present in the db.
HaloDB db = // db initialized
db.put("hello".getBytes(), "world".getBytes())
db.close()
db.get("hello".getBytes()) // ---> Throws com.oath.halodb.HaloDBException: Lookup failed.
db.get("new_key".getBytes()) // ---> Succeeds and returns 'null'
@durgaswaroop Thank you for your interest in HaloDB.
@siddharths who found this issue is already working on a fix.
We should not allow the db state to be mutated once it has been closed. This issue now happens only when a new write file or tombstone file is created, which can happen under some special cases:
if we open the db and close it without doing any put or delete
if the write file had reached the max size and will be rolled over for the next write.
I think a simple solution is to check the isClosing flag while rolling over to a new file.
I don't think we need to make any changes for the get operation as it doesn't change the db state.
If you find any other issues please feel free to create an issue here. Contributions are welcome!
Performing a
delete
operation on an item in a db object that is already in theclosed
state should throw an exception. Currently this does not happen for the first occurrence of an attempted delete, since the Tombstone file has not yet been created.A possible solution could be to always initialize a tombstone file whenever a new db file is created.
The text was updated successfully, but these errors were encountered: