Skip to content

Commit 6bcc7d5

Browse files
authored
Merge pull request #479 from codecrafters-io/andy/clarify-ack
Clarify the `WAIT` command and acknowledgment
2 parents b245149 + 0f7bb9c commit 6bcc7d5

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

stage_descriptions/replication-16-my8.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ In this stage, you’ll implement support for the `WAIT` command on the master.
22

33
### The `WAIT` command
44

5-
The `WAIT` command is used to check how many replicas have acknowledged a write command. This allows a client to measure the durability of a write command before considering it successful.
5+
The `WAIT` command is used to check how many replicas have acknowledged all previous write commands. This allows a client to measure the durability of a write command before considering it successful.
66

7-
The command format is:
7+
The command format is:
88

99
```bash
1010
WAIT <numreplicas> <timeout>
1111
```
1212

1313
Here's what each argument means:
1414

15-
- `<numreplicas>`: The minimum number of replicas that must acknowledge the write command.
15+
- `<numreplicas>`: The minimum number of replicas that must acknowledge all previous write commands.
1616
- `<timeout>`: The maximum time (in milliseconds) the client is willing to wait.
1717

1818
For example:

stage_descriptions/replication-18-na2.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ In this stage, you’ll extend your `WAIT` implementation to handle the case whe
33
### `WAIT` with propagated commands
44

55
In previous stages, we handled the cases where:
6+
67
- No replicas were connected, and the master could safely return `0`.
78
- Replicas were connected, but hadn't received any write commands.
89

@@ -12,10 +13,10 @@ To do this, the master must send `REPLCONF GETACK *` to replicas if there are pe
1213

1314
The `WAIT` command should complete when either:
1415

15-
- The required number of replicas has acknowledged the last write command, or
16+
- The required number of replicas has acknowledged all previous write commands, or
1617
- The timeout expires.
1718

18-
Either way, the master should return the number of replicas that acknowledged the command as a [RESP integer](https://redis.io/docs/latest/develop/reference/protocol-spec/#integers).
19+
Either way, the master should return the number of replicas that acknowledged all previous write commands as a [RESP integer](https://redis.io/docs/latest/develop/reference/protocol-spec/#integers).
1920

2021
### Tests
2122

0 commit comments

Comments
 (0)