-
Notifications
You must be signed in to change notification settings - Fork 569
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[c++] Resize Value allocation during RmwCopy
#136
Comments
FASTER supports variable length values. Can you take a look at the below and see if it meets your requirements? https://github.com/Microsoft/FASTER/wiki/Variable-length-values#in-c |
Yep, but if the size of the new value is dependent upon the size of the old value then it's not possible to know the new size at the point which FASTER allocates space for the new record (i.e. from calling So this would probably suggest the use-case I've outlined here isn't possible, right? |
For reference, this is the issue on our side faster-rs/faster-rs#24 |
This is fixable. I think we could have a variant of inline uint32_t value_size() that takes the existing record as argument, and the RMW op uses that when doing a copy on write. Thoughts? |
I really like this idea and I've put together a PR (#145) with an implementation along those lines. Let me know what you think. |
Motivation
We would like to be able to store variable length values in FASTER and use RMW to make them (potentially) bigger. As a motivating example we would like to store a String and then use RMW to modify the String based on the previous value .
Background
We have a set up for supporting variable length values similar to that used in these tests:
Our
RmwContext
will call a function (defined elsewhere) with the old String to get the new String.Problem
This way of trying to use RMW to modify a String does not work because insufficient space is allocated for the new record. https://github.com/microsoft/FASTER/blob/master/cc/src/core/faster.h#L1076 shows that the new record will be given
RmwContext::value_size()
bytes for the new Value. In the case of a Value like in this example, we would need to know the size ofnew_string
in order to know how much space to reserve for the new Value.My Question
Is there a way in which we can resize a Value's allocation on the
HybridLog
during an RMW operation? With this we could extend the buffer of the new record to fitnew_string
. To be clear, I'm asking about resizing a record as it is being first written to, not a record already fully-created.We could of course do a Read request then construct the new String and do an Upsert (given we now would know the required size to allocate) but this would be missing out on the ability to do an RMW in one operation. I guess it would still be possible to take advantage of in-place update during the Upsert?
The text was updated successfully, but these errors were encountered: