-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Add FUNCTION DUMP and RESTORE. #9938
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
Conversation
Added 2 new FUNCTION sub-commands: 1. FUNCTION DUMP - dump a binary blob representation of all the functions. 2. FUNCTION RESTORE - give the binary blob extracted using FUNCTION DUMP, restore all the functions on the given blob. Drop existing functions if exists. Modify `redis-cli --cluster add-node` to use FUNCTION DUMP to get existing functions from one of the nodes in the cluster, and FUNCTION RESTORE to load the same set of functions to the new node. redis-cli will execute this step before sending the `CLUSTER MEET` command to the new node. If FUNCTION DUMP returns an error, assume the current Redis version do not support functions and skip FUNCTION RESTORE. If FUNCTION RESTORE fails, abort and do not send the `CLUSTER MEET` command.
* Added restore policy argument to FUNCTION RESTORE commands (either FLUSH, APPEND or REPLACE). * Small consmetic and bug fixes.
* Do not count on 'err' out parameter. * Change 'err' out parameter on 'rdbFunctionLoad' to be optional. * Replace line comment on redis-cli.
Changed restore policy to be the last argument on 'FUNCTION RESTORE'.
* Change default restore policy to APPEND. * Added restore policy argument to function-restore.json * documentation fixes.
|
@redis/core-team please approve |
Co-authored-by: sundb <sundbcn@gmail.com>
itamarhaber
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API is ok imo
* Changed FUNCTION RESTORE to be WRITE command instead of MAY_REPLICATE * Added command description to FUNCTION DUMP and RESTORE on command json * Added documentation to describe FUNCTION DUMP serialization format * Changed RESTORE_POLICY_* to enum * Change blob terminology to payload
* Added test to verify 'redis-cli --cluster add-node' uploads existing functions to the new node.
oranagra
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM..
@madolson PTAL
Co-authored-by: Oran Agra <oran@redislabs.com>
madolson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new cluster test LGTM, also approving the two new API designs. Left some other minor comments.
1. redis-cli will verify there is no functions on the new node before adding it to the cluster (on redis-cli --cluster add-node) 2. Drop unneeded variables on the new test 3. Use redis_client instead of redis_deferring_client (on new test) 4. Better naming new test
soloestoy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FUNCTION RESTORE [FLUSH|APPEND|REPLACE]
APPEND: appends the restored functions to the existing functions. On collision, abort.
just one question, does it satisfy atomicity? the abort means rollback or just abort?
if any conflicts are detected, the operation is aborted without any modification to the server. |
Follow the conclusions here: #9899
This PR handles point 1,2 on the action items list: #9899 (comment)
Added 2 new FUNCTION sub-commands:
FUNCTION DUMP- dump a binary payload representation of all the functions.FUNCTION RESTORE <PAYLOAD> [FLUSH|APPEND|REPLACE]- give the binary payload extracted usingFUNCTION DUMP, restore all the functions on the given payload. Restore policy can be given to control how to handle existing functions (default is APPEND):Modify
redis-cli --cluster add-nodeto useFUNCTION DUMPto get existing functions from one of the nodes in the cluster, andFUNCTION RESTOREto load the same set of functions to the new node.redis-cliwill execute this step before sending theCLUSTER MEETcommand to the new node. IfFUNCTION DUMPreturns an error, assume the current Redis version do not support functions and skipFUNCTION RESTORE. IfFUNCTION RESTOREfails, abort and do not send theCLUSTER MEETcommand. If the new node already contains functions (before theFUNCTION RESTOREis sent), abort and do not add the node to the cluster. Test was added to verifyredis-cli --cluster add-nodeworks as expected.todo: