mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-09 20:37:52 +00:00
Close process on fragment.openStorage error
When *fragment.openStorage is invoked in both f.importValue and f.importValueSmallWrite and it returns an error, this means there's some underlying error with the storage device and at the point of this commit, the sane thing to do is to close the process, otherwise the operation of Pilosa might proceed in an inconsistent state thus precipiatting other silent but hairy errors along the way such as dereferencing *fragment.gen later on which is set to nil once openStorage fails.
This commit is contained in:
parent
c75d5553b9
commit
92426a9d1b
1 changed files with 14 additions and 2 deletions
16
fragment.go
16
fragment.go
|
|
@ -2651,7 +2651,13 @@ func (f *fragment) importValueSmallWrite(tx Tx, columnIDs []uint64, values []int
|
|||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
_ = f.openStorage(true)
|
||||
errOpenStorage := f.openStorage(true)
|
||||
if errOpenStorage != nil {
|
||||
f.Logger.Printf("failed to import data into fragment: %v", err)
|
||||
f.Logger.Printf("recovery with openStorage failed for fragment: %v", errOpenStorage)
|
||||
f.Logger.Debugf("%s", debug.Stack())
|
||||
os.Exit(1)
|
||||
}
|
||||
return err
|
||||
}
|
||||
rowSet := make(map[uint64]struct{}, bitDepth+1)
|
||||
|
|
@ -2705,7 +2711,13 @@ func (f *fragment) importValue(tx Tx, columnIDs []uint64, values []int64, bitDep
|
|||
// Flush changes in bulk back to the transaction.
|
||||
return txb.Flush()
|
||||
}(); err != nil {
|
||||
_ = f.openStorage(true)
|
||||
errOpenStorage := f.openStorage(true)
|
||||
if errOpenStorage != nil {
|
||||
f.Logger.Printf("failed to import data into fragment: %v", err)
|
||||
f.Logger.Printf("recovery with openStorage failed for fragment: %v", errOpenStorage)
|
||||
f.Logger.Debugf("%s", debug.Stack())
|
||||
os.Exit(1)
|
||||
}
|
||||
return err
|
||||
}
|
||||
// Keep stats accurate. We don't call incrementOpN here because it may
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue