Skip to content

Commit

Permalink
fs backend storage init fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ucwong committed Sep 17, 2023
1 parent 91dadd9 commit 3553591
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions backend/chaindb.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,6 @@ func NewChainDB(config *params.Config) (*ChainDB, error) {

//fs.history()

log.Info("Storage ID generated", "id", fs.id.Load(), "version", fs.version)

return fs, nil
}

Expand All @@ -154,6 +152,8 @@ func (fs *ChainDB) Init() (err error) {
log.Error("Init node id error", "err", err)
//return err
}

log.Info("Storage ID generated", "id", fs.id.Load(), "version", fs.version)
})

return
Expand Down Expand Up @@ -609,6 +609,8 @@ func (fs *ChainDB) initID() error {
return err
}
id := binary.LittleEndian.Uint64([]byte(uid[:]))

log.Info("New random id generated !!!", "key", ID_+fs.version, "id", id)
e := buk.Put([]byte("key"), []byte(strconv.FormatUint(id, 16)))
fs.id.Store(id) //binary.LittleEndian.Uint64([]byte(id[:]))//uint64(id[:])

Expand Down
5 changes: 4 additions & 1 deletion monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ func New(flag *params.Config, cache, compress, listen bool, callback chan any) (
} else {
m.fs = fs_
}

m.fs.Init()

m.lastNumber.Store(0)
m.currentNumber.Store(0)
m.startNumber.Store(0)
Expand Down Expand Up @@ -599,7 +602,7 @@ func (m *Monitor) Start() error {
m.wg.Add(1)
go func() {
defer m.wg.Done()
m.fs.Init()
//m.fs.Init()
if err := m.run(); err != nil {
log.Error("Fs monitor start failed", "err", err)
}
Expand Down

0 comments on commit 3553591

Please sign in to comment.