Commit 40410799 authored by Kirill Smelkov's avatar Kirill Smelkov

X recovery: on startup S PENDING -> RUNNING

parent ca0ffd62
......@@ -211,14 +211,14 @@ func TestMasterStorage(t *testing.T) {
Mhost := xnet.NetTrace(net.Host("m"), tracer)
Shost := xnet.NetTrace(net.Host("s"), tracer)
wg := &xsync.WorkGroup{}
gwg := &xsync.WorkGroup{}
// start master
Mclock := &vclock{}
M := NewMaster("abc1", ":1", Mhost)
M.monotime = Mclock.monotime
Mctx, Mcancel := context.WithCancel(context.Background())
wg.Gox(func() {
gwg.Gox(func() {
err := M.Run(Mctx)
fmt.Println("M err: ", err)
_ = err // XXX
......@@ -235,7 +235,7 @@ func TestMasterStorage(t *testing.T) {
zstor := xfs1stor("../../zodb/storage/fs1/testdata/1.fs")
S := NewStorage("abc1", "m:1", ":1", Shost, zstor)
Sctx, Scancel := context.WithCancel(context.Background())
wg.Gox(func() {
gwg.Gox(func() {
err := S.Run(Sctx)
fmt.Println("S err: ", err)
_ = err // XXX
......@@ -285,8 +285,14 @@ func TestMasterStorage(t *testing.T) {
tc.Expect(masterStartReady(M, true))
// M <- start cmd
wg := &xsync.WorkGroup{}
wg.Gox(func() {
err := M.Start()
exc.Raiseif(err)
})
tc.Expect(node(M.nodeTab, "s:1", neo.STORAGE, 1, neo.RUNNING, 0.01))
xwait(wg)
// XXX M.partTab <- S1
// XXX M can start -> writes parttab to S and goes to verification
......@@ -328,7 +334,7 @@ func TestMasterStorage(t *testing.T) {
// TODO test M.recovery starting back from verification/service
// (M needs to resend to all storages recovery messages just from start)
xwait(wg)
xwait(gwg)
Mcancel() // XXX temp
Scancel() // XXX temp
}
......
......@@ -451,6 +451,19 @@ loop2:
}
}
if err != nil {
return err
}
// recovery successful - we are starting
// S PENDING -> RUNNING
for _, stor := range m.nodeTab.StorageList() {
if stor.State == neo.PENDING {
m.nodeTab.SetNodeState(stor, neo.RUNNING)
}
}
// if we are starting for new cluster - create partition table
if err != nil && m.partTab.PTid == 0 {
// XXX -> m.nodeTab.StorageList(State > DOWN)
......@@ -461,9 +474,10 @@ loop2:
}
}
m.partTab = neo.MakePartTab(1 /* XXX hardcoded */, storv)
m.partTab.PTid = 1
}
return err
return nil
}
// storCtlRecovery drives a storage node during cluster recovering state
......
......@@ -58,6 +58,7 @@ func NewSyncTracer() *SyncTracer {
// Trace1 sends message with 1 tracing event to a consumer and waits for ack
func (st *SyncTracer) Trace1(event interface{}) {
ack := make(chan struct{})
//fmt.Printf("trace: send: %T %v\n", event, event)
st.tracech <- &SyncTraceMsg{event, ack}
<-ack
}
......
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