From ff84920a3a3a65ac05677a17f762d1162e92b100 Mon Sep 17 00:00:00 2001 From: bsbds <69835502+bsbds@users.noreply.github.com> Date: Fri, 1 Mar 2024 21:15:29 +0800 Subject: [PATCH 1/8] refactor: add new request/response type Signed-off-by: bsbds <69835502+bsbds@users.noreply.github.com> --- src/curp-command.proto | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/curp-command.proto b/src/curp-command.proto index 09e479f..5de5a8b 100644 --- a/src/curp-command.proto +++ b/src/curp-command.proto @@ -112,8 +112,34 @@ message ProposeRequest { message ProposeResponse { CmdResult result = 1; + bool conflict = 2; } +message SyncedResponse { + // The serialized command after sync result + // The original type is Result + CmdResult after_sync_result = 1; +} + +message OpResponse { + oneof op { + ProposeResponse propose = 1; + SyncedResponse synced = 2; + } +} + +message RecordRequest { + ProposeId propose_id = 1; + // The serialized command + // The original type is `Command` + bytes command = 2; +} + +message RecordResponse { + bool conflict = 1; +} + + message WaitSyncedRequest { ProposeId propose_id = 1; uint64 cluster_version = 2; @@ -207,6 +233,8 @@ message LeaseKeepAliveMsg { service Protocol { // Unary + rpc ProposeStream(ProposeRequest) returns (stream OpResponse); + rpc Record(RecordRequest) returns (RecordResponse); rpc Propose(ProposeRequest) returns (ProposeResponse); rpc WaitSynced(WaitSyncedRequest) returns (WaitSyncedResponse); rpc ProposeConfChange(ProposeConfChangeRequest) From 1d1fd5723e1b0a23317a3a6ea6e48da955dacbf2 Mon Sep 17 00:00:00 2001 From: bsbds <69835502+bsbds@users.noreply.github.com> Date: Mon, 4 Mar 2024 16:52:33 +0800 Subject: [PATCH 2/8] refactor: add term to ProposeRequest Signed-off-by: bsbds <69835502+bsbds@users.noreply.github.com> --- src/curp-command.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/src/curp-command.proto b/src/curp-command.proto index 5de5a8b..e6f147f 100644 --- a/src/curp-command.proto +++ b/src/curp-command.proto @@ -108,6 +108,7 @@ message ProposeRequest { // The original type is `Command` bytes command = 2; uint64 cluster_version = 3; + uint64 term = 4; } message ProposeResponse { From 6fd9847f26d395dc1c9001bf44d3dfe23c2a9d72 Mon Sep 17 00:00:00 2001 From: bsbds <69835502+bsbds@users.noreply.github.com> Date: Mon, 4 Mar 2024 19:07:43 +0800 Subject: [PATCH 3/8] refactor: remove propose and wait_synced Signed-off-by: bsbds <69835502+bsbds@users.noreply.github.com> --- src/curp-command.proto | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/curp-command.proto b/src/curp-command.proto index e6f147f..845434e 100644 --- a/src/curp-command.proto +++ b/src/curp-command.proto @@ -236,8 +236,6 @@ service Protocol { // Unary rpc ProposeStream(ProposeRequest) returns (stream OpResponse); rpc Record(RecordRequest) returns (RecordResponse); - rpc Propose(ProposeRequest) returns (ProposeResponse); - rpc WaitSynced(WaitSyncedRequest) returns (WaitSyncedResponse); rpc ProposeConfChange(ProposeConfChangeRequest) returns (ProposeConfChangeResponse); rpc Publish(PublishRequest) returns (PublishResponse); From a71f3a68ba6032e0d9ef596480522e99cbba970f Mon Sep 17 00:00:00 2001 From: bsbds <69835502+bsbds@users.noreply.github.com> Date: Tue, 5 Mar 2024 10:14:28 +0800 Subject: [PATCH 4/8] refactor: add Zombie to CurpError Signed-off-by: bsbds <69835502+bsbds@users.noreply.github.com> --- src/curp-command.proto | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/curp-command.proto b/src/curp-command.proto index 845434e..adf6860 100644 --- a/src/curp-command.proto +++ b/src/curp-command.proto @@ -99,6 +99,8 @@ message CurpError { string Internal = 12; // When the leader is transferring or an error occurred in the transfer string LeaderTransfer = 13; + // When the leader is a zombie + google.protobuf.Empty Zombie = 14; } } From 6fd20919b4e1e2c4b4d0c5613be249a8c3fb7857 Mon Sep 17 00:00:00 2001 From: bsbds <69835502+bsbds@users.noreply.github.com> Date: Tue, 2 Apr 2024 18:43:53 +0800 Subject: [PATCH 5/8] refactor: add flag to choose whether to use slow path in ProposeRequest Signed-off-by: bsbds <69835502+bsbds@users.noreply.github.com> --- src/curp-command.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/src/curp-command.proto b/src/curp-command.proto index adf6860..b228a97 100644 --- a/src/curp-command.proto +++ b/src/curp-command.proto @@ -111,6 +111,7 @@ message ProposeRequest { bytes command = 2; uint64 cluster_version = 3; uint64 term = 4; + bool slow_path = 5; } message ProposeResponse { From fc3911ae014f1813b8bb80e778eb5b90c007636c Mon Sep 17 00:00:00 2001 From: iGxnon Date: Wed, 13 Mar 2024 01:23:46 +0800 Subject: [PATCH 6/8] chore: add first_incomplete in ProposeRequest Signed-off-by: iGxnon Signed-off-by: bsbds <69835502+bsbds@users.noreply.github.com> --- src/curp-command.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/src/curp-command.proto b/src/curp-command.proto index b228a97..413a1ee 100644 --- a/src/curp-command.proto +++ b/src/curp-command.proto @@ -112,6 +112,7 @@ message ProposeRequest { uint64 cluster_version = 3; uint64 term = 4; bool slow_path = 5; + uint64 first_incomplete = 6; } message ProposeResponse { From 04cf5c10b5834f5b40ea15fbd7b839c4c1e3aa80 Mon Sep 17 00:00:00 2001 From: bsbds <69835502+bsbds@users.noreply.github.com> Date: Tue, 2 Jul 2024 19:43:59 +0800 Subject: [PATCH 7/8] chore: add read index Signed-off-by: bsbds <69835502+bsbds@users.noreply.github.com> --- src/curp-command.proto | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/curp-command.proto b/src/curp-command.proto index 413a1ee..923db00 100644 --- a/src/curp-command.proto +++ b/src/curp-command.proto @@ -236,10 +236,17 @@ message LeaseKeepAliveMsg { uint64 client_id = 1; } +message ReadIndexRequest {} + +message ReadIndexResponse { + uint64 term = 1; +} + service Protocol { // Unary rpc ProposeStream(ProposeRequest) returns (stream OpResponse); rpc Record(RecordRequest) returns (RecordResponse); + rpc ReadIndex(ReadIndexRequest) returns (ReadIndexResponse); rpc ProposeConfChange(ProposeConfChangeRequest) returns (ProposeConfChangeResponse); rpc Publish(PublishRequest) returns (PublishResponse); From 69618dad342da815876cad2ad962964ba79dd942 Mon Sep 17 00:00:00 2001 From: bsbds <69835502+bsbds@users.noreply.github.com> Date: Wed, 25 Sep 2024 08:25:33 +0800 Subject: [PATCH 8/8] chore: format proto files Signed-off-by: bsbds <69835502+bsbds@users.noreply.github.com> --- src/curp-command.proto | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/curp-command.proto b/src/curp-command.proto index 923db00..9bf64a1 100644 --- a/src/curp-command.proto +++ b/src/curp-command.proto @@ -108,16 +108,16 @@ message ProposeRequest { ProposeId propose_id = 1; // The serialized command // The original type is `Command` - bytes command = 2; - uint64 cluster_version = 3; - uint64 term = 4; - bool slow_path = 5; + bytes command = 2; + uint64 cluster_version = 3; + uint64 term = 4; + bool slow_path = 5; uint64 first_incomplete = 6; } message ProposeResponse { CmdResult result = 1; - bool conflict = 2; + bool conflict = 2; } message SyncedResponse { @@ -129,7 +129,7 @@ message SyncedResponse { message OpResponse { oneof op { ProposeResponse propose = 1; - SyncedResponse synced = 2; + SyncedResponse synced = 2; } } @@ -144,7 +144,6 @@ message RecordResponse { bool conflict = 1; } - message WaitSyncedRequest { ProposeId propose_id = 1; uint64 cluster_version = 2;