Skip to content
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

Support for deleting keys #20

Open
judepereira opened this issue Jul 26, 2020 · 10 comments
Open

Support for deleting keys #20

judepereira opened this issue Jul 26, 2020 · 10 comments

Comments

@judepereira
Copy link
Member

No description provided.

@AkshayS96
Copy link
Contributor

@judepereira
We can implement deletion using 2 steps:

  1. remove the key from indexMap
  2. add that key to an arraylist or write it to a file (for fault tolerance)
  3. skip this key while compaction will be performed.

@judepereira
Copy link
Member Author

What about during iteration? Will we have to check the indexMap at all times? Iteration performance might suffer.

@AkshayS96
Copy link
Contributor

AkshayS96 commented Sep 15, 2020

I think we can check whether a key is present in index map or not at the time of iteration itself here

final Consumer<ByteBuffer> entryConsumer = entry -> {

@judepereira
Copy link
Member Author

The index map isn't checked. Only the bitset is checked.

@judepereira
Copy link
Member Author

One good way to avoid checking the index map would be to "fake" reading them. by setting the keys directly to read in the keysRead bitset:

final BitSet keysRead = new BitSet(index.size());

@AkshayS96
Copy link
Contributor

yeah, we can do this. first, iterate through the deleted keys array list and set them to this bitset.

@judepereira
Copy link
Member Author

Sounds like a plan :)

@judepereira
Copy link
Member Author

What do you think is the best method for persistence of the deleted keys?

@AkshayS96
Copy link
Contributor

I was thinking of keeping both the in-memory data structure (Map or ArrayList) and a file(in case of sudden shutdown for persistence);

@judepereira
Copy link
Member Author

Sounds good :)

AkshayS96 pushed a commit that referenced this issue Sep 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants