From 6c722b09d7d7b2ea57e8d815bbe0ee62405a3301 Mon Sep 17 00:00:00 2001 From: Guy Korland Date: Mon, 24 Mar 2025 19:22:20 +0200 Subject: [PATCH 1/2] add docs for wait command --- commands/wait.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 commands/wait.md diff --git a/commands/wait.md b/commands/wait.md new file mode 100644 index 0000000..b3c4b95 --- /dev/null +++ b/commands/wait.md @@ -0,0 +1,45 @@ +--- +title: "WAIT" +nav_order: 101 +description: > + Blocks the current client until all previous write commands are successfully transferred and acknowledged by at least the specified number of replicas +parent: "Commands" +--- + +# WAIT + +The WAIT command in FalkorDB blocks the current client until all previous write commands are successfully transferred and acknowledged by at least the specified number of replicas. This command is useful for ensuring data durability across a FalkorDB deployment. + +Usage: `WAIT numreplicas timeout` + +## Arguments + +* `numreplicas`: The number of replicas that must acknowledge the write operations. +* `timeout`: Maximum time to wait for the required number of replicas to acknowledge, specified in milliseconds. + +## Return Value + +The command returns the number of replicas that have acknowledged the write operations so far. + +## Examples + +### Basic Usage + +``` +> GRAPH.QUERY mygraph "CREATE (:Person {name: 'Alice'})" +OK +> WAIT 1 10000 +(integer) 1 +``` + +In this example, the client waits for at least 1 replica to acknowledge the GRAPH.QUERY command effect, +with a timeout of 10 seconds (10000 milliseconds). + +## Notes + +* The WAIT command only applies to write commands issued by the current connection before the WAIT command. +* If the timeout is reached before the required number of replicas acknowledge, the command returns the number of replicas that acknowledged so far. +* A return value lower than the requested `numreplicas` indicates that the write operation may not be durable on all requested replicas. +* Setting `numreplicas` to 0 will cause the command to return immediately. +* The timeout value of 0 means to block indefinitely until the specified number of replicas acknowledge. +* In a non-replicated FalkorDB instance, the command will always return 0. \ No newline at end of file From 7eb0a36c626e0d27c99e7395392010a3526d0992 Mon Sep 17 00:00:00 2001 From: Guy Korland Date: Wed, 16 Apr 2025 08:51:44 +0300 Subject: [PATCH 2/2] Add syntax highlighting to code block in wait.md --- commands/wait.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/wait.md b/commands/wait.md index b3c4b95..b01635f 100644 --- a/commands/wait.md +++ b/commands/wait.md @@ -25,7 +25,7 @@ The command returns the number of replicas that have acknowledged the write oper ### Basic Usage -``` +```sh > GRAPH.QUERY mygraph "CREATE (:Person {name: 'Alice'})" OK > WAIT 1 10000