FoundationDB

[Java] API to get only the keys?


(gaurav) #1

Hi, is there an API (specifically in Java bindings), that can return only the keys for a given range? I do not care for values in a specific scenario, and the size of values will run into TBs.


(Ryan Worl) #2

This is something I too went looking for at one point and found to not exist. My remedy was to write two keys: one with the real data, and one as a pointer with the size of the value at the other end of the pointer.

The size may not be relevant for your use case, but I was using it to balance data volume among processing threads. I would read the pointer keys in one thread, then match the sizes up evenly with the available threads, then pass the ranges on to process in parallel.


(gaurav) #3

Yes, I do follow that approach.

However, in this case, I want to read those keys that have the real data as the value. The use-case is writing some validation tools, that can check that there are no orphan data rows (due to my application layer bugs). And I do not want to fetch the entire data value bytes, only to discard it immediately.