add Sync to the tracking store
This commit is contained in:
parent
364076c1ea
commit
783dcda19c
@ -13,6 +13,7 @@ type TrackingStore interface {
|
|||||||
Get(cid.Cid) (abi.ChainEpoch, error)
|
Get(cid.Cid) (abi.ChainEpoch, error)
|
||||||
Delete(cid.Cid) error
|
Delete(cid.Cid) error
|
||||||
ForEach(func(cid.Cid, abi.ChainEpoch) error) error
|
ForEach(func(cid.Cid, abi.ChainEpoch) error) error
|
||||||
|
Sync() error
|
||||||
Close() error
|
Close() error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ func NewBoltTrackingStore(path string) (*BoltTrackingStore, error) {
|
|||||||
db, err := bolt.Open(path, 0644,
|
db, err := bolt.Open(path, 0644,
|
||||||
&bolt.Options{
|
&bolt.Options{
|
||||||
Timeout: 1 * time.Second,
|
Timeout: 1 * time.Second,
|
||||||
|
NoSync: true,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -97,6 +98,10 @@ func (s *BoltTrackingStore) ForEach(f func(cid.Cid, abi.ChainEpoch) error) error
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *BoltTrackingStore) Sync() error {
|
||||||
|
return s.db.Sync()
|
||||||
|
}
|
||||||
|
|
||||||
func (s *BoltTrackingStore) Close() error {
|
func (s *BoltTrackingStore) Close() error {
|
||||||
return s.db.Close()
|
return s.db.Close()
|
||||||
}
|
}
|
||||||
|
@ -155,6 +155,10 @@ func (s *LMDBTrackingStore) ForEach(f func(cid.Cid, abi.ChainEpoch) error) error
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *LMDBTrackingStore) Sync() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (s *LMDBTrackingStore) Close() error {
|
func (s *LMDBTrackingStore) Close() error {
|
||||||
s.env.CloseDBI(s.db)
|
s.env.CloseDBI(s.db)
|
||||||
return s.env.Close()
|
return s.env.Close()
|
||||||
|
@ -633,6 +633,12 @@ func (s *SplitStore) compactFull() {
|
|||||||
log.Infow("sweeping done", "took", time.Since(startSweep))
|
log.Infow("sweeping done", "took", time.Since(startSweep))
|
||||||
log.Infow("compaction stats", "hot", stHot, "cold", stCold, "dead", stDead)
|
log.Infow("compaction stats", "hot", stHot, "cold", stCold, "dead", stDead)
|
||||||
|
|
||||||
|
err = s.snoop.Sync()
|
||||||
|
if err != nil {
|
||||||
|
// TODO do something better here
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
err = s.setBaseEpoch(coldEpoch)
|
err = s.setBaseEpoch(coldEpoch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// TODO do something better here
|
// TODO do something better here
|
||||||
|
Loading…
Reference in New Issue
Block a user