Commit 0d75e144 authored by Kirill Smelkov's avatar Kirill Smelkov

go/neo/proto: Sync with NEO/py on changes to make the number of replicas modifiable at runtime

This corresponds to NEO/py commit ef5fc508 (Make the number of replicas
modifiable when the cluster is running).

One important change in the protocol is that Client no longer queries
Master for partition table - instead M pushed partTab to C right after
identification (after pushing nodeTab).

See also: https://neo.nexedi.com/P-NEO-Protocol.Specification.2019?portal_skin=CI_slideshow#/9/5
parent 98869a9b
...@@ -342,7 +342,6 @@ type CellInfo struct { ...@@ -342,7 +342,6 @@ type CellInfo struct {
//neo:proto typeonly //neo:proto typeonly
type RowInfo struct { type RowInfo struct {
Offset uint32 // PNumber XXX -> Pid
CellList []CellInfo CellList []CellInfo
} }
...@@ -378,8 +377,6 @@ type RequestIdentification struct { ...@@ -378,8 +377,6 @@ type RequestIdentification struct {
type AcceptIdentification struct { type AcceptIdentification struct {
NodeType NodeType // XXX name NodeType NodeType // XXX name
MyUUID NodeUUID MyUUID NodeUUID
NumPartitions uint32 // PNumber
NumReplicas uint32 // PNumber
YourUUID NodeUUID YourUUID NodeUUID
} }
...@@ -453,22 +450,23 @@ type AnswerLastIDs struct { ...@@ -453,22 +450,23 @@ type AnswerLastIDs struct {
} }
// Ask storage node the remaining data needed by master to recover. // Ask storage node the remaining data needed by master to recover.
// This is also how the clients get the full partition table on connection.
// //
//neo:nodes M -> S; C -> M //neo:nodes M -> S
type AskPartitionTable struct { type AskPartitionTable struct {
} }
type AnswerPartitionTable struct { type AnswerPartitionTable struct {
PTid PTid
NumReplicas uint32 // PNumber
RowList []RowInfo RowList []RowInfo
} }
// Send the full partition table to admin/storage nodes on connection. // Send the full partition table to admin/client/storage nodes on connection.
// //
//neo:nodes M -> A, S //neo:nodes M -> A, C, S
type SendPartitionTable struct { type SendPartitionTable struct {
PTid PTid
NumReplicas uint32 // PNumber
RowList []RowInfo RowList []RowInfo
} }
...@@ -477,6 +475,7 @@ type SendPartitionTable struct { ...@@ -477,6 +475,7 @@ type SendPartitionTable struct {
//neo:nodes M -> * //neo:nodes M -> *
type NotifyPartitionChanges struct { type NotifyPartitionChanges struct {
PTid PTid
NumReplicas uint32 // PNumber
CellList []struct { CellList []struct {
Offset uint32 // PNumber XXX -> Pid Offset uint32 // PNumber XXX -> Pid
CellInfo CellInfo CellInfo CellInfo
...@@ -846,6 +845,13 @@ type TweakPartitionTable struct { ...@@ -846,6 +845,13 @@ type TweakPartitionTable struct {
// answer = Error // answer = Error
} }
// Set the number of replicas.
//
//neo:nodes ctl -> A -> M
type SetNumReplicas struct {
NumReplicas uint32 // PNumber
}
// Set the cluster state. // Set the cluster state.
// //
//neo:nodes ctl -> A -> M //neo:nodes ctl -> A -> M
......
...@@ -190,18 +190,20 @@ func TestMsgMarshal(t *testing.T) { ...@@ -190,18 +190,20 @@ func TestMsgMarshal(t *testing.T) {
// PTid, [] (of [] of {UUID, CellState}) // PTid, [] (of [] of {UUID, CellState})
{&AnswerPartitionTable{ {&AnswerPartitionTable{
PTid: 0x0102030405060708, PTid: 0x0102030405060708,
NumReplicas: 34,
RowList: []RowInfo{ RowList: []RowInfo{
{1, []CellInfo{{11, UP_TO_DATE}, {17, OUT_OF_DATE}}}, {[]CellInfo{{11, UP_TO_DATE}, {17, OUT_OF_DATE}}},
{2, []CellInfo{{11, FEEDING}}}, {[]CellInfo{{11, FEEDING}}},
{7, []CellInfo{{11, CORRUPTED}, {15, DISCARDED}, {23, UP_TO_DATE}}}, {[]CellInfo{{11, CORRUPTED}, {15, DISCARDED}, {23, UP_TO_DATE}}},
}, },
}, },
hex("0102030405060708") + hex("0102030405060708") +
hex("00000022") +
hex("00000003") + hex("00000003") +
hex("00000001000000020000000b010000001100") + hex("000000020000000b010000001100") +
hex("00000002000000010000000b02") + hex("000000010000000b02") +
hex("00000007000000030000000b030000000f040000001701"), hex("000000030000000b030000000f040000001701"),
}, },
// map[Oid]struct {Tid,Tid,bool} // map[Oid]struct {Tid,Tid,bool}
......
This diff is collapsed.
...@@ -42,31 +42,32 @@ var pyMsgRegistry = map[uint16]string{ ...@@ -42,31 +42,32 @@ var pyMsgRegistry = map[uint16]string{
38: "SetNodeState", 38: "SetNodeState",
39: "AddPendingNodes", 39: "AddPendingNodes",
40: "TweakPartitionTable", 40: "TweakPartitionTable",
41: "SetClusterState", 41: "SetNumReplicas",
42: "Repair", 42: "SetClusterState",
43: "RepairOne", 43: "Repair",
44: "NotifyClusterState", 44: "RepairOne",
45: "AskClusterState", 45: "NotifyClusterState",
46: "ObjectUndoSerial", 46: "AskClusterState",
47: "AskTIDsFrom", 47: "ObjectUndoSerial",
48: "Pack", 48: "AskTIDsFrom",
49: "CheckReplicas", 49: "Pack",
50: "CheckPartition", 50: "CheckReplicas",
51: "CheckTIDRange", 51: "CheckPartition",
52: "CheckSerialRange", 52: "CheckTIDRange",
53: "PartitionCorrupted", 53: "CheckSerialRange",
54: "NotifyReady", 54: "PartitionCorrupted",
55: "LastTransaction", 55: "NotifyReady",
56: "CheckCurrentSerial", 56: "LastTransaction",
57: "NotifyTransactionFinished", 57: "CheckCurrentSerial",
58: "Replicate", 58: "NotifyTransactionFinished",
59: "ReplicationDone", 59: "Replicate",
60: "FetchTransactions", 60: "ReplicationDone",
61: "FetchObjects", 61: "FetchTransactions",
62: "AddTransaction", 62: "FetchObjects",
63: "AddObject", 63: "AddTransaction",
64: "Truncate", 64: "AddObject",
65: "FlushLog", 65: "Truncate",
66: "FlushLog",
32768: "Error", 32768: "Error",
32769: "AcceptIdentification", 32769: "AcceptIdentification",
32770: "Pong", 32770: "Pong",
...@@ -92,14 +93,14 @@ var pyMsgRegistry = map[uint16]string{ ...@@ -92,14 +93,14 @@ var pyMsgRegistry = map[uint16]string{
32803: "AnswerObjectHistory", 32803: "AnswerObjectHistory",
32804: "AnswerPartitionList", 32804: "AnswerPartitionList",
32805: "AnswerNodeList", 32805: "AnswerNodeList",
32813: "AnswerClusterState", 32814: "AnswerClusterState",
32814: "AnswerObjectUndoSerial", 32815: "AnswerObjectUndoSerial",
32815: "AnswerTIDsFrom", 32816: "AnswerTIDsFrom",
32816: "AnswerPack", 32817: "AnswerPack",
32819: "AnswerCheckTIDRange", 32820: "AnswerCheckTIDRange",
32820: "AnswerCheckSerialRange", 32821: "AnswerCheckSerialRange",
32823: "AnswerLastTransaction", 32824: "AnswerLastTransaction",
32824: "AnswerCheckCurrentSerial", 32825: "AnswerCheckCurrentSerial",
32828: "AnswerFetchTransactions", 32829: "AnswerFetchTransactions",
32829: "AnswerFetchObjects", 32830: "AnswerFetchObjects",
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment