This commit is contained in:
vyzo 2022-01-30 15:43:52 +02:00
parent 20b75022aa
commit 7931f1f8f9
4 changed files with 13 additions and 9 deletions

View File

@ -60,7 +60,7 @@ func (e *MapMarkSetEnv) Recover(name string) (MarkSet, error) {
if err != nil {
return nil, xerrors.Errorf("error opening markset file for read: %w", err)
}
defer in.Close()
defer in.Close() //nolint:errcheck
// wrap a buffered reader to make this faster
buf := bufio.NewReader(in)

View File

@ -317,7 +317,7 @@ func testMarkSetVisitorRecovery(t *testing.T, lsType string) {
t.Fatal(err)
}
visitor, err = env.Recover("test")
_, err = env.Recover("test")
if err == nil {
t.Fatal("expected recovery to fail")
}
@ -430,7 +430,7 @@ func testMarkSetRecovery(t *testing.T, lsType string) {
t.Fatal(err)
}
markSet, err = env.Recover("test")
_, err = env.Recover("test")
if err == nil {
t.Fatal("expected recovery to fail")
}
@ -537,7 +537,7 @@ func testMarkSetMarkMany(t *testing.T, lsType string) {
t.Fatal(err)
}
markSet, err = env.Recover("test")
_, err = env.Recover("test")
if err == nil {
t.Fatal("expected recovery to fail")
}

View File

@ -208,7 +208,7 @@ func Open(path string, ds dstore.Datastore, hot, cold bstore.Blockstore, cfg *Co
if ss.checkpointExists() {
log.Info("found compaction checkpoint; resuming compaction")
if err := ss.completeCompaction(); err != nil {
markSetEnv.Close()
markSetEnv.Close() //nolint:errcheck
return nil, xerrors.Errorf("error resuming compaction: %w", err)
}
}

View File

@ -58,8 +58,6 @@ var (
const (
batchSize = 16384
defaultColdPurgeSize = 7_000_000
)
func (s *SplitStore) HeadChange(_, apply []*types.TipSet) error {
@ -497,7 +495,9 @@ func (s *SplitStore) doCompact(curTs *types.TipSet) error {
}
// it's cold, mark it as candidate for move
coldw.Write(c)
if err := coldw.Write(c); err != nil {
return xerrors.Errorf("error writing cid to coldstore: %w", err)
}
coldCnt++
return nil
@ -942,7 +942,7 @@ func (s *SplitStore) has(c cid.Cid) (bool, error) {
func (s *SplitStore) moveColdBlocks(coldr *ColdSetReader) error {
batch := make([]blocks.Block, 0, batchSize)
coldr.ForEach(func(c cid.Cid) error {
err := coldr.ForEach(func(c cid.Cid) error {
if err := s.checkClosing(); err != nil {
return err
}
@ -969,6 +969,10 @@ func (s *SplitStore) moveColdBlocks(coldr *ColdSetReader) error {
return nil
})
if err != nil {
return xerrors.Errorf("error iterating coldset: %w", err)
}
if len(batch) > 0 {
err := s.cold.PutMany(s.ctx, batch)
if err != nil {