Hi all. RocksDB supports ordered iteration and ran...
# general
s
Hi all. RocksDB supports ordered iteration and range scans natively. Has the Venice team ever considered exposing range queries (fetch all keys within a
[lo, hi]
range) as a first-class read API on top of it? What we understand about why it's not there today: - Stores are hash-partitioned on the full key, so logically-adjacent keys scatter across partitions. There's no bounded home for a range, unlike point/batch-get. - Keys are opaque (Avro-serialized) bytes, and Avro's encoding isn't bytewise-order-preserving, so even a within-partition RocksDB iterator wouldn't map to a logical range. - A general unbounded scan would break the predictable-tail-latency / RCU quota model. Curious whether it's ever been discussed or prototyped, and if there's a design doc or RFC. If it was ruled out, I'd love to understand the main reasons. Thanks! cc @Felix GV @Zac Policzer @Koorous Vargha @Hubert Puszklewicz @Amre Shakim fyi
f
It's actually there already, but only on the Da Vinci Client.
👀 1
Across the network it’s not supported due to the concerns you cited. But these challenges are not unsurmountable… there has also been little demand inside LinkedIn so it was hard to get it prioritized. But if you build it they might not object 😅😂 (I don’t want to speak for them though 🤗 …).
f
Oh, is it in DVRT nowadays?
k
That's what I know of. Is it supported in regular DaVinci too?
f
It wasn’t this way previously, unless I’m getting confused
@Zac Policzer would know better… if he has not flushed the entirety of his past context to make room for Zibra 😂
😂 2
k
I don't see it on the interface. Maybe Zac knows
But in the time I've been here I haven't seen an ask to support this for remote queries, but I'm curious what's the use case for this?
I guess we don't want people to scan the entire table remotely, which would be a potential risk for supporting this.
s
But in the time I've been here I haven't seen an ask to support this for remote queries, but I'm curious what's the use case for this?
Venice naturally overlaps with DynamoDB use-cases, where it allows to provide a sortKey and query data based on a given range. We internally use it to query values for some keys based on datetime ranges.
👍 1
z
It's supported I think 'roughly' as part of the partial key lookup feature which is part of davinci. We were using it internally for the CDC at one point
🤝 1
k
The first CDC client or the DVRT one?
f
Yep, partial key lookup, exactly
z
The first CDC client or the DVRT one?
I.... seem to no longer remember 😨
😨 1
I remember it being important for making sense of the stream, but I can't remember why
k
Is the partial key thing related to read compute?
z
Yeah it's a read compute operation. It's kind of inspired by espresso's interface. In espresso keys are path based (member-id/mailboxid/messages) and you can list all messages under (member-id/*). So it's like prefix search.
👍 1
s
I see, so it looks like we can have, for example, composite key with (key, sortKey), and use
computeWithKeyPrefixFilter
. But I don't see range query support in particular - so if we want, for example, fetch keys within a certain (datetime1, datetime2) range, the daVinci client would only be able to fetch all the records for that particular key, and the further filtering would need to be done one the client side.
k
I believe so
f
Hmm… it supports passing predicates including greater than, lower than (I believe)
s
Even though those predicates exist,
AvroComputeRequestBuilderV4
explicitly says that only AND and EQUALS are allowed (link) 😞
🫠 1
f
Dang