Skip to content

Commit 5df95b3

Browse files
nitaicaroNitai Caro
andauthored
Refactor syncWithPrimary and replicaTryPartialResynchronization (#1476)
In continuation to #945 **syncWithPrimary:** - Refactored all error handling to function `syncWithPrimaryHandleError` - Refactored repl_state state machine from if-else format to switch-case format - Besides changing the repl_state, all state machine logic moved to helper functions **replicaTryPartialResynchronization:** This function was performing two different jobs based on the value of the read_reply argument - - read_reply == 0: Sends the PSYNC command to the primary server. - read_reply == 1: Reads and processes the reply to the PSYNC command. This change simplifies the logic by clearly separating the writing and reading stages of the PSYNC process. Signed-off-by: Nitai Caro <caronita@amazon.com> Co-authored-by: Nitai Caro <caronita@amazon.com>
1 parent 30e9109 commit 5df95b3

File tree

1 file changed

+396
-335
lines changed

1 file changed

+396
-335
lines changed

0 commit comments

Comments
 (0)