Skip to content

Commit 3553591

Browse files
committed
fs backend storage init fix
1 parent 91dadd9 commit 3553591

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

backend/chaindb.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,6 @@ func NewChainDB(config *params.Config) (*ChainDB, error) {
129129

130130
//fs.history()
131131

132-
log.Info("Storage ID generated", "id", fs.id.Load(), "version", fs.version)
133-
134132
return fs, nil
135133
}
136134

@@ -154,6 +152,8 @@ func (fs *ChainDB) Init() (err error) {
154152
log.Error("Init node id error", "err", err)
155153
//return err
156154
}
155+
156+
log.Info("Storage ID generated", "id", fs.id.Load(), "version", fs.version)
157157
})
158158

159159
return
@@ -609,6 +609,8 @@ func (fs *ChainDB) initID() error {
609609
return err
610610
}
611611
id := binary.LittleEndian.Uint64([]byte(uid[:]))
612+
613+
log.Info("New random id generated !!!", "key", ID_+fs.version, "id", id)
612614
e := buk.Put([]byte("key"), []byte(strconv.FormatUint(id, 16)))
613615
fs.id.Store(id) //binary.LittleEndian.Uint64([]byte(id[:]))//uint64(id[:])
614616

monitor.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ func New(flag *params.Config, cache, compress, listen bool, callback chan any) (
141141
} else {
142142
m.fs = fs_
143143
}
144+
145+
m.fs.Init()
146+
144147
m.lastNumber.Store(0)
145148
m.currentNumber.Store(0)
146149
m.startNumber.Store(0)
@@ -599,7 +602,7 @@ func (m *Monitor) Start() error {
599602
m.wg.Add(1)
600603
go func() {
601604
defer m.wg.Done()
602-
m.fs.Init()
605+
//m.fs.Init()
603606
if err := m.run(); err != nil {
604607
log.Error("Fs monitor start failed", "err", err)
605608
}

0 commit comments

Comments
 (0)