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

.

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