https://slatedb.io logo
https://github.com/cockroachdb/pebble/blob/master/...
# general
a
https://github.com/cockroachdb/pebble/blob/master/docs/rocksdb.md#range-deletions I personally think Pebble's implementation is easier to understand and performs better.
d
Pebble still maintains a separate block with range_tombstones and only difference is on the read path right? Documents there don't seem to go too much into details I'm pretty comfortable with golang so I can also dig into the codebase
It feels like they take the same approach with separate metadata block 🤔
a
If I remember correctly, Pebble should also maintain separate blocks, and I think their implementation based on
mergeIter
is easier to maintain and understand.
d
yeah, that's also my understanding of what the difference is
r
DeleteRange in rocks is pretty complicated. For this use case (which we have too) I was thinking we could just do a combination of: 1. make the existing support for compaction filters into a public api, and support some way to filter at the sst level (e.g. filter given the key range in an sst) 2. support manual compactions so you can just force the filter to run That should be good enough since you don't actually care about the data being deleted semantically
> support some way to filter at the sst level this could also just be a one-time meta operation when initializing the clone that filtes out ssts when writing the first manifest
probably that plus filters is all you need, and you can skip the manual compaction. The bulk of the data will be removed when initializing the clone, and the rest can just be cleaned up as compaction chugs along.
c
I, too, would prefer to ignore range deletion for now. It seems like a lot of complexity for minimal gain. If we have compaction filtering, range scan, and transactions, I feel we can get pretty far. > this could also just be a one-time meta operation when initializing the clone that filters out ssts when writing the first manifest Were you thinking that this would use the same interface as the compaction filter?
d
As long as we can make it as lightweight as metadata operation, I'm all in. I want to go the least painful to get to PoC for Flink.
Read Filters + Compaction Filters should in general do the trick, but might be complex to do right. I'm wondering whether we should rather build in first class support for database partitioning (split + merge operations during clone for example)
c
What would first class support look like to you? Supplying ranges when calling clone?
d
yeah, something along those lines, the cloned manifest would need to contain valid ranges
Copy code
parent {
  path: ...
  valid_ranges [
    a-b,
    f-m
  ]
}
r
> Were you thinking that this would use the same interface as the compaction filter? I think it would need to be more specific than the compaction filter api since it should be able to filter based on the sorted-run metadata (e.g. the sst key ranges). What @dmvk suggested above seems reasonable
c
K.. this would need an RFC I think
f
i once went into an incident in production when our team used rocksdb's range deletion. if i remember correctly, our program triggered lots of range deletions, and it accumulated lots of range deletion markers (> 1million?), it exhausted ALL the CPU, as it requires to merge the range deletion markers for any read operation 😯...
we finally falled back to a vanilla delete within a for loop afterwards.
might off topic, i suppose deletion vector might also worth considering in the future, like: https://docs.google.com/document/d/1FtPI0TUzMrPAFfWX_CA9NL6m6O1uNSxlpDsR-7xpPL0/edit?tab=t.0#heading=h.f42to8zz3i0 it's pretty lightweight like a bloomfilter, and is widely adopted in iceberg, paimon with nice performance gain.
c
Dang this is neat!
This seems really reasonable… I think we can have a .deletions along side the .sst file and CAS it when we need to update… Doing a deletion across SSTs atomically will be the interesting part…
This doc doesn’t seem to discuss that…
f
iceberg is also an OCC model with immutable data files, when update rows in multiple data files, it might generate several new data files in a CoW manner, and build a new metadata file with all the data files referenced (also a CoW) and fire a CAS operation to switch the root of metadata file (with a Snapshot Isolation guarantee). (it resembles a lot with Append-Only Btree imo 😯 )
before all the write operations, it read the latest version in the current metadata file. and when it COMMIT with CAS, it compares the latest version with the version when it started the txn, if there's conflict, it aborts the txn (at some cases it can has an retry automatically, like we were appending data files, and the data are not conflict with existed data file, it can safely retry this commit).
c
Ah was hoping to avoid the manifest.. but yea that makes sense…
Sounds expensive to consult manifest on writes.
f
this style may generate lots of snapshot/manifest data on frequent updates, at some workload, the manifest data may even become larger than the data files 😂
c
🤔
Yea..
d
Having separate deletion files might be super useful for compactions, it might enable us to get rid of data in higher levels faster.
Anyway, I really want to avoid doing full DeleteRange support now (still want to do it down the road though). I'll try to draft a proposal for sharding primitives and we can continue discussion there 👍
v
I was thinking about this too, searched github issues and didn't find anything about this. Discord search led me to this. @dmvk mind opening a github issue with key insights from this thread? Several good ideas being discussed (deleted range in manifest, compaction filters, deletion vectors).
c
Ah, here it is!
f
it feels like tiered compaction + deletion vectors are a great fit for each other 🤯, iceberg takes this and people said it performs very well
a shortcoming of deletion vectoring is that it seems only able to accelerate the latest data on scan() and get(), reducing the cost of the merge iteration of the SSTs by filtering with a bitmap (deletion vector). however, for data with earlier versions, it still requires some merge iteration. 🤔