Commit 590f0a46 authored by Kirill Smelkov's avatar Kirill Smelkov

X neo/py uses n(replica) as n(real-replica) - 1

parent ca0c734d
...@@ -621,7 +621,7 @@ func TestMasterStorage(t *testing.T) { ...@@ -621,7 +621,7 @@ func TestMasterStorage(t *testing.T) {
NodeType: proto.MASTER, NodeType: proto.MASTER,
MyUUID: proto.UUID(proto.MASTER, 1), MyUUID: proto.UUID(proto.MASTER, 1),
NumPartitions: 1, NumPartitions: 1,
NumReplicas: 1, NumReplicas: 0,
YourUUID: proto.UUID(proto.STORAGE, 1), YourUUID: proto.UUID(proto.STORAGE, 1),
})) }))
...@@ -735,7 +735,7 @@ func TestMasterStorage(t *testing.T) { ...@@ -735,7 +735,7 @@ func TestMasterStorage(t *testing.T) {
NodeType: proto.MASTER, NodeType: proto.MASTER,
MyUUID: proto.UUID(proto.MASTER, 1), MyUUID: proto.UUID(proto.MASTER, 1),
NumPartitions: 1, NumPartitions: 1,
NumReplicas: 1, NumReplicas: 0,
YourUUID: proto.UUID(proto.CLIENT, 1), YourUUID: proto.UUID(proto.CLIENT, 1),
})) }))
...@@ -819,7 +819,7 @@ func TestMasterStorage(t *testing.T) { ...@@ -819,7 +819,7 @@ func TestMasterStorage(t *testing.T) {
NodeType: proto.STORAGE, NodeType: proto.STORAGE,
MyUUID: proto.UUID(proto.STORAGE, 1), MyUUID: proto.UUID(proto.STORAGE, 1),
NumPartitions: 1, NumPartitions: 1,
NumReplicas: 1, NumReplicas: 0,
YourUUID: proto.UUID(proto.CLIENT, 1), YourUUID: proto.UUID(proto.CLIENT, 1),
})) }))
......
...@@ -1082,7 +1082,7 @@ func (m *Master) identify(ctx context.Context, n nodeCome) (node *Node, resp pro ...@@ -1082,7 +1082,7 @@ func (m *Master) identify(ctx context.Context, n nodeCome) (node *Node, resp pro
NodeType: proto.MASTER, NodeType: proto.MASTER,
MyUUID: m.node.MyInfo.UUID, MyUUID: m.node.MyInfo.UUID,
NumPartitions: 1, // FIXME hardcoded NumPartitions: 1, // FIXME hardcoded
NumReplicas: 1, // FIXME hardcoded NumReplicas: 0, // FIXME hardcoded (neo/py meaning for n(replica) is `n(real-replica) - 1`)
YourUUID: uuid, YourUUID: uuid,
} }
......
...@@ -346,7 +346,8 @@ func (p *Node) dial(ctx context.Context) (_ *neonet.NodeLink, err error) { ...@@ -346,7 +346,8 @@ func (p *Node) dial(ctx context.Context) (_ *neonet.NodeLink, err error) {
case accept.YourUUID != app.MyInfo.UUID: case accept.YourUUID != app.MyInfo.UUID:
err = fmt.Errorf("connected, but peer gives us uuid %v (our is %v)", accept.YourUUID, app.MyInfo.UUID) err = fmt.Errorf("connected, but peer gives us uuid %v (our is %v)", accept.YourUUID, app.MyInfo.UUID)
case !(accept.NumPartitions == 1 && accept.NumReplicas == 1): // XXX NumReplicas: neo/py meaning for n(replica) = `n(real-replica) - 1`
case !(accept.NumPartitions == 1 && accept.NumReplicas == 0):
err = fmt.Errorf("connected but TODO peer works with !1x1 partition table.") err = fmt.Errorf("connected but TODO peer works with !1x1 partition table.")
} }
......
...@@ -202,7 +202,8 @@ func (stor *Storage) talkMaster1(ctx context.Context) (err error) { ...@@ -202,7 +202,8 @@ func (stor *Storage) talkMaster1(ctx context.Context) (err error) {
// XXX add master UUID -> nodeTab ? or master will notify us with it himself ? // XXX add master UUID -> nodeTab ? or master will notify us with it himself ?
if !(accept.NumPartitions == 1 && accept.NumReplicas == 1) { // NumReplicas: neo/py meaning for n(replica) = `n(real-replica) - 1`
if !(accept.NumPartitions == 1 && accept.NumReplicas == 0) {
return fmt.Errorf("TODO for 1-storage POC: Npt: %v Nreplica: %v", accept.NumPartitions, accept.NumReplicas) return fmt.Errorf("TODO for 1-storage POC: Npt: %v Nreplica: %v", accept.NumPartitions, accept.NumReplicas)
} }
...@@ -411,7 +412,7 @@ func (stor *Storage) identify(idReq *proto.RequestIdentification) (proto.Msg, bo ...@@ -411,7 +412,7 @@ func (stor *Storage) identify(idReq *proto.RequestIdentification) (proto.Msg, bo
NodeType: stor.node.MyInfo.Type, NodeType: stor.node.MyInfo.Type,
MyUUID: stor.node.MyInfo.UUID, // XXX lock wrt update MyUUID: stor.node.MyInfo.UUID, // XXX lock wrt update
NumPartitions: 1, // XXX NumPartitions: 1, // XXX
NumReplicas: 1, // XXX NumReplicas: 0, // XXX
YourUUID: idReq.UUID, YourUUID: idReq.UUID,
}, true }, true
} }
......
...@@ -463,7 +463,7 @@ func openURL(ctx context.Context, u *url.URL) (_ storage.Backend, err error) { ...@@ -463,7 +463,7 @@ func openURL(ctx context.Context, u *url.URL) (_ storage.Backend, err error) {
checkConfig("version", schemaVersion) checkConfig("version", schemaVersion)
checkConfig("nid", int(proto.UUID(proto.STORAGE, 1))) checkConfig("nid", int(proto.UUID(proto.STORAGE, 1)))
checkConfig("partitions", 1) checkConfig("partitions", 1)
checkConfig("replicas", 1) checkConfig("replicas", 0) // XXX neo/py uses nreplicas as 1 + n(replica)
err = errv.Err() err = errv.Err()
if err != nil { if err != nil {
......
...@@ -266,8 +266,10 @@ neopy_log() { ...@@ -266,8 +266,10 @@ neopy_log() {
# M{py,go} ... - spawn master # M{py,go} ... - spawn master
Mpy() { Mpy() {
# --autostart=1 # --autostart=1
# XXX neo/py meaning for --replicas is `n(real-replica) - 1`
exec -a Mpy \ exec -a Mpy \
neomaster --cluster=$neocluster --bind=$Mbind --masters=$Mbind -r 1 -p 1 `neopy_log Mpy` "$@" & neomaster --cluster=$neocluster --bind=$Mbind --masters=$Mbind \
--replicas 0 --partitions 1 `neopy_log Mpy` "$@" &
} }
Mgo() { Mgo() {
......
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