GetMappedRange is an experimental feature introduced in FDB 7.1. It is intended to improve the client throughput and reduce latency for a commonly used traffic pattern. An experiment with Record Layer shows that this optimization can get 4x client throughput on a certain workload.
Because this feature is under active development, there have been interests and questions from the community. To summarize everything I know about it, I wrote a document and published here. It describes what this feature is for, how to use it, and the known issues (or future work).
If you have any questions, please feel free to reply to this post. Itās the best way to reach out to me and future developers of this feature.
Having read the document, this feature should fit my use case quite well. I have a custom layer that does indexing and it looks like I can easily rewrite my getv-using-index function to make use of GetMappedRange and it should improve performance significantly. It is a very common usage pattern in my app.
No questions, posting this just so that it doesnāt seem like nobody cares. We do
I think Iāve run into a bug when using GetMappedRange and Tenants. I discovered the issue while adding 7.1 support for Tokio/Rust bindings.
Here is the example rust code. It is very similar to your Java and C++ tests.
I am using FDB version 7.1.3 and starting the cluster using configure new single memory tenant_mode=optional_experimental option.
This code works fine when there are no tenants in the cluster.
However, when I add a tenant using createtenant in the CLI, and then run the same code, it errors with FdbError { error_code: 2130 } (tenant_name_required).
When I remove the tenant using deletetenant in the CLI, the code works as expected.
Line 240 is where the error is occurring.
while let Some(x) = mapped_range_stream.next().await {
let (kv, mapped_range, mapped_kvs) = x?.into_parts();
// ...
}
From a C API perspective, I think the error is occurring when FdbFutureMappedKeyValueArray returned by fdb_transaction_get_mapped_range tries to resolve for the first time.
Please let me know if you are able to replicate this in Java/C++.
The tenant_name_required error is thrown when reading a mapped range in the following circumstances:
The tenant mode is required and you are running a raw access transaction (you set the raw access option or one of the system keys options).
The tenant mode is optional and you try to read a range that includes a tenantās key range with a raw access transaction (any transaction like above or one that doesnāt declare a tenant).
In other words, you canāt use mapped ranges with tenants if you are using raw transactions.
Itās certainly possible this is failing in some other circumstance, and if so thatās probably a bug.
In this case, AFAICT the tenant mode is optional and I donāt think I am reading tenant key range. The key range that is read begins with ("prefix", ...).
Got it, thanks for the report. Looking at the logic for this tenant name required check, it seems I didnāt quite complete it. As far as I know weāre not currently evaluating any use-cases that rely on both features, so I guess this slipped under the radar.
Let me try to add a test to reproduce it and then Iāll fix up the check.
I was wondering if there are any plans to land this fix in 7.1.x releases?
I currently have a test that fails because of this bug.
As I was updating my CI to 7.1.12 I checked to see if this fix has landed in the latest 7.1.x release. That does not seem to be the case, hence the question!
Thanks for creating this feature, my use case would also benefit from GetMappedRange. Are there any plans to support GetMappedRange in the Go bindings , since currently I donāt think that itās supported.
Hi @jonas, thanks for your interest. Iām not aware of any plan to support it in the Go binding. Iām no long working on FoundationDB for quite a while, so I donāt have knowledge about latest status.
I think Hao Fu is charging GetMappedRange feature now. I cannot tag him because I donāt know his account in the forum, but you can find him at hfu94 (Hao Fu) Ā· GitHub.
Maybe your question will get more publicity (and hopeful someone has the answer) if you ask it as a new post in the forum.