Closed arriqaaq closed 1 month ago
One way to solve this is to modify the set function on snapshot
/// Set a key-value pair into the snapshot.
pub fn set(&mut self, key: &VariableSizeKey, value: Bytes) {
// TODO: need to fix this to avoid cloning the key
// This happens because the VariableSizeKey transfrom from
// a &[u8] does not terminate the key with a null byte.
let key = &key.terminate();
self.snap.insert(key, value, self.snap.version());
}
to use save points as timestamp during insert than self.snap.version, and then add method on vart (remove_at_ts or something similar) which will not delete the entire key/node from the tree but just the latest value
There could be a potential issue here when the same key is overwritten. Let's say we have
Because we are deleting the entire key from the snapshot (which does not track the savepoint number), this value is deleted, and could become an issue. The same would apply for scans too because scans also read from the snapshot