Commit 36a24373 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent b16b546c
......@@ -37,6 +37,10 @@ func ErrEncode(err error) *Error {
// XXX abusing message for xid
return &Error{Code: OID_NOT_FOUND, Message: err.Xid.String()}
case *zodb.ErrOidMissing:
// XXX abusing message for oid
return &Error{Code: OID_DOES_NOT_EXIST, Message: err.Oid.String()}
default:
return &Error{Code: NOT_READY /* XXX how to report 503? was BROKEN_NODE */, Message: err.Error()}
}
......@@ -52,6 +56,12 @@ func ErrDecode(e *Error) error {
if err == nil {
return &zodb.ErrXidMissing{xid}
}
case OID_DOES_NOT_EXIST:
oid, err := zodb.ParseOid(e.Message) // XXX abusing message for oid
if err == nil {
return &zodb.ErrOidMissing{oid}
}
}
return e
......
......@@ -30,6 +30,7 @@ package neo
import (
"context"
"fmt"
"math"
"net"
"sync"
......@@ -79,7 +80,7 @@ func NewNodeApp(net xnet.Networker, typ NodeType, clusterName, masterAddr, serve
}
app := &NodeApp{
MyInfo: NodeInfo{Type: typ, Addr: addr},
MyInfo: NodeInfo{Type: typ, Addr: addr, IdTimestamp: math.NaN()},
ClusterName: clusterName,
Net: net,
MasterAddr: masterAddr,
......@@ -335,6 +336,14 @@ func (app *NodeApp) UpdateNodeTab(ctx context.Context, msg *NotifyNodeInformatio
for _, nodeInfo := range msg.NodeList {
log.Infof(ctx, "rx node update: %v", nodeInfo)
app.NodeTab.Update(nodeInfo)
// XXX we have to provide IdTimestamp when requesting identification to other peers
// (e.g. Spy checks this is what master broadcast them and if not replis "unknown by master")
if nodeInfo.UUID == app.MyInfo.UUID {
// XXX recheck locking
// XXX do .MyInfo = nodeInfo ?
app.MyInfo.IdTimestamp = nodeInfo.IdTimestamp
}
}
// FIXME logging under lock (if caller took e.g. .StateMu before applying updates)
......
......@@ -157,6 +157,7 @@ xmysql() {
mysql --defaults-file=$mycnf "$@"
}
# spawn neo/py cluster working on mariadb
neopysql() {
MDB
sleep 1 # XXX fragile
......@@ -206,9 +207,11 @@ gensqlite() {
#neopylite
neopysql
time demo-zbigarray read neo://$cluster@$Mbind
#time demo-zbigarray read neo://$cluster@$Mbind
./zsha1.py neo://$cluster@$Mbind
go run zsha1.go neo://$cluster@$Mbind
xneoctl set cluster stopping
xmysql -e "SHUTDOWN"
wait
exit
......
......@@ -5,6 +5,7 @@ import (
"context"
"crypto/sha1"
"log"
"flag"
"fmt"
"os"
"time"
......@@ -16,6 +17,7 @@ import (
)
func main() {
flag.Parse()
url := os.Args[1] // XXX dirty
bg := context.Background()
......
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