Commit 533d3a3e authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 7877e55c
// gmigrate - show number of times G migrates to another M (OS thread).
// usage: `go tool trace -d <trace.out> |gmigrate`
package main
// +build ignore
package main
import (
"bufio"
"errors"
......
......@@ -88,6 +88,7 @@ func NewClient(clusterName, masterAddr string, net xnet.Networker) *Client {
// spawn background process which performs master talk
ctx, cancel := context.WithCancel(context.Background())
cli.talkMasterCancel = cancel
cli.node.OnShutdown = cancel // XXX ok?
go cli.talkMaster(ctx)
return cli
......
......@@ -1146,6 +1146,9 @@ func (c *Conn) Recv() (Msg, error) {
// TODO use free-list for decoded messages + when possible decode in-place
msg := reflect.New(msgType).Interface().(Msg)
// msg := reflect.NewAt(msgType, bufAlloc(msgType.Size())
_, err = msg.neoMsgDecode(pkt.Payload())
if err != nil {
return nil, &ConnError{Conn: c, Op: "decode", Err: err} // XXX "decode:" is already in ErrDecodeOverflow
......
......@@ -31,7 +31,6 @@ import (
"context"
"fmt"
"net"
"os"
"sync"
"lab.nexedi.com/kirr/go123/xerr"
......@@ -69,6 +68,9 @@ type NodeApp struct {
NodeTab *NodeTable // information about nodes in the cluster
PartTab *PartitionTable // information about data distribution in the cluster
ClusterState ClusterState // master idea about cluster state
// should be set by user so NodeApp can notify when master tells this node to shutdown
OnShutdown func()
}
// NewNodeApp creates new node application
......@@ -346,7 +348,9 @@ func (app *NodeApp) UpdateNodeTab(ctx context.Context, msg *NotifyNodeInformatio
if nodeInfo.State == DOWN {
log.Info(ctx, "master told us to shutdown")
log.Flush()
os.Exit(1)
app.OnShutdown()
// os.Exit(1)
return
}
}
}
......
......@@ -94,6 +94,7 @@ func (stor *Storage) Run(ctx context.Context) error {
// start serving incoming connections
wg := sync.WaitGroup{}
serveCtx, serveCancel := context.WithCancel(ctx)
stor.node.OnShutdown = serveCancel
wg.Add(1)
go func(ctx context.Context) (err error) {
defer wg.Done()
......
......@@ -75,7 +75,7 @@ Sgo() {
# -alsologtostderr
exec -a Sgo \
neo -log_dir=$log storage -cluster=$cluster -bind=$Sbind -masters=$Mbind "$@" &
neo -cpuprofile cpu.out -log_dir=$log storage -cluster=$cluster -bind=$Sbind -masters=$Mbind "$@" &
}
......
// zsha1 - compute sha1 of whole latest objects stream in a ZODB database
package main
// +build ignore
package main
import (
"context"
"crypto/sha1"
......
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