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 {
//neo:proto typeonly
type RowInfo struct {
Offset uint32 // PNumber XXX -> Pid
CellList []CellInfo
}
......@@ -378,8 +377,6 @@ type RequestIdentification struct {
type AcceptIdentification struct {
NodeType NodeType // XXX name
MyUUID NodeUUID
NumPartitions uint32 // PNumber
NumReplicas uint32 // PNumber
YourUUID NodeUUID
}
......@@ -453,23 +450,24 @@ type AnswerLastIDs struct {
}
// 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 AnswerPartitionTable struct {
PTid
RowList []RowInfo
NumReplicas uint32 // PNumber
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 {
PTid
RowList []RowInfo
NumReplicas uint32 // PNumber
RowList []RowInfo
}
// Notify about changes in the partition table.
......@@ -477,7 +475,8 @@ type SendPartitionTable struct {
//neo:nodes M -> *
type NotifyPartitionChanges struct {
PTid
CellList []struct {
NumReplicas uint32 // PNumber
CellList []struct {
Offset uint32 // PNumber XXX -> Pid
CellInfo CellInfo
}
......@@ -846,6 +845,13 @@ type TweakPartitionTable struct {
// answer = Error
}
// Set the number of replicas.
//
//neo:nodes ctl -> A -> M
type SetNumReplicas struct {
NumReplicas uint32 // PNumber
}
// Set the cluster state.
//
//neo:nodes ctl -> A -> M
......
......@@ -189,19 +189,21 @@ func TestMsgMarshal(t *testing.T) {
// PTid, [] (of [] of {UUID, CellState})
{&AnswerPartitionTable{
PTid: 0x0102030405060708,
PTid: 0x0102030405060708,
NumReplicas: 34,
RowList: []RowInfo{
{1, []CellInfo{{11, UP_TO_DATE}, {17, OUT_OF_DATE}}},
{2, []CellInfo{{11, FEEDING}}},
{7, []CellInfo{{11, CORRUPTED}, {15, DISCARDED}, {23, UP_TO_DATE}}},
{[]CellInfo{{11, UP_TO_DATE}, {17, OUT_OF_DATE}}},
{[]CellInfo{{11, FEEDING}}},
{[]CellInfo{{11, CORRUPTED}, {15, DISCARDED}, {23, UP_TO_DATE}}},
},
},
hex("0102030405060708") +
hex("00000022") +
hex("00000003") +
hex("00000001000000020000000b010000001100") +
hex("00000002000000010000000b02") +
hex("00000007000000030000000b030000000f040000001701"),
hex("000000020000000b010000001100") +
hex("000000010000000b02") +
hex("000000030000000b030000000f040000001701"),
},
// map[Oid]struct {Tid,Tid,bool}
......
This diff is collapsed.
......@@ -42,31 +42,32 @@ var pyMsgRegistry = map[uint16]string{
38: "SetNodeState",
39: "AddPendingNodes",
40: "TweakPartitionTable",
41: "SetClusterState",
42: "Repair",
43: "RepairOne",
44: "NotifyClusterState",
45: "AskClusterState",
46: "ObjectUndoSerial",
47: "AskTIDsFrom",
48: "Pack",
49: "CheckReplicas",
50: "CheckPartition",
51: "CheckTIDRange",
52: "CheckSerialRange",
53: "PartitionCorrupted",
54: "NotifyReady",
55: "LastTransaction",
56: "CheckCurrentSerial",
57: "NotifyTransactionFinished",
58: "Replicate",
59: "ReplicationDone",
60: "FetchTransactions",
61: "FetchObjects",
62: "AddTransaction",
63: "AddObject",
64: "Truncate",
65: "FlushLog",
41: "SetNumReplicas",
42: "SetClusterState",
43: "Repair",
44: "RepairOne",
45: "NotifyClusterState",
46: "AskClusterState",
47: "ObjectUndoSerial",
48: "AskTIDsFrom",
49: "Pack",
50: "CheckReplicas",
51: "CheckPartition",
52: "CheckTIDRange",
53: "CheckSerialRange",
54: "PartitionCorrupted",
55: "NotifyReady",
56: "LastTransaction",
57: "CheckCurrentSerial",
58: "NotifyTransactionFinished",
59: "Replicate",
60: "ReplicationDone",
61: "FetchTransactions",
62: "FetchObjects",
63: "AddTransaction",
64: "AddObject",
65: "Truncate",
66: "FlushLog",
32768: "Error",
32769: "AcceptIdentification",
32770: "Pong",
......@@ -92,14 +93,14 @@ var pyMsgRegistry = map[uint16]string{
32803: "AnswerObjectHistory",
32804: "AnswerPartitionList",
32805: "AnswerNodeList",
32813: "AnswerClusterState",
32814: "AnswerObjectUndoSerial",
32815: "AnswerTIDsFrom",
32816: "AnswerPack",
32819: "AnswerCheckTIDRange",
32820: "AnswerCheckSerialRange",
32823: "AnswerLastTransaction",
32824: "AnswerCheckCurrentSerial",
32828: "AnswerFetchTransactions",
32829: "AnswerFetchObjects",
32814: "AnswerClusterState",
32815: "AnswerObjectUndoSerial",
32816: "AnswerTIDsFrom",
32817: "AnswerPack",
32820: "AnswerCheckTIDRange",
32821: "AnswerCheckSerialRange",
32824: "AnswerLastTransaction",
32825: "AnswerCheckCurrentSerial",
32829: "AnswerFetchTransactions",
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