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

Supporting Deletes in FASTER #114

Merged
merged 3 commits into from
Mar 21, 2019
Merged

Supporting Deletes in FASTER #114

merged 3 commits into from
Mar 21, 2019

Conversation

badrishc
Copy link
Collaborator

We are adding native support for the record Delete operation in FASTER:

  • If the record is in the mutable region, it will be marked with the tombstone bit in header, and value will be overwritten with default.
  • If the record is in memory and is pointed to directly by the hash index, we elide the record from the hash chain using a CAS on the index entry to the previous record. The elided record is marked with both a tombstone and an invalid bit in this case.
  • If the record is in read-only or earlier region, we will add a new tombstone record to the end of the hash chain to identify the deleted record.

Note that from the perspective of recovery and CPR, deletes behave similarly to Upserts.

This checkin will replace the prior experimental method of DeleteFromMemory.

@badrishc badrishc requested a review from gunaprsd March 20, 2019 17:51
@badrishc badrishc added enhancement New feature or request work in progress Work in progress labels Mar 20, 2019
@badrishc
Copy link
Collaborator Author

This will be a breaking change, because the user callback functions will need an extra method to be implemented. This is called when the delete is completed, in the rare case when a delete operation goes pending (this can happen during a CPR checkpoint).

        public void DeleteCompletionCallback(ref Key key, Context ctx) { }

@gunaprsd
Copy link
Contributor

Also, reads must make sure they are not reading a tombstone record. The liveness of a record needs to be checked everywhere.

@badrishc
Copy link
Collaborator Author

Correct, reads have already been updated accordingly to return NOTFOUND.

For log scans, right now I am returning deleted records as well. This is a debatable matter for resolution:

  • We could treat tombstoned records as invisible to the scan (similar to Invalid records)
  • We could expand the GetNext API to have a boolean IsTombstone out parameter so that the scanner will know they are scanning a deleted record.

… An Upsert/RMW after a delete will create a new record at the tail. We never unset Tombstone bit - necessary for correctness.
@badrishc badrishc merged commit d494f4f into logcompaction Mar 21, 2019
@badrishc badrishc deleted the tombstone-deletes branch March 26, 2019 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request work in progress Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants