Skip to content

Commit

Permalink
Merge pull request #594 from SiaFoundation/chris/missing-buffer-start…
Browse files Browse the repository at this point in the history
…up-fix

Fix missing buffer keeping renterd from starting by logging error instead
  • Loading branch information
ChrisSchinnerl authored Sep 8, 2023
2 parents 7d3d3d9 + 0ba29c1 commit 8ac2468
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions stores/slabbuffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,28 @@ func newSlabBufferManager(sqlStore *SQLStore, slabBufferCompletionThreshold int6
}
continue
}
// Get the encryption key.
var ec object.EncryptionKey
if err := ec.UnmarshalText(buffer.DBSlab.Key); err != nil {
return nil, err
}
// Open the file.
file, err := os.OpenFile(filepath.Join(partialSlabDir, buffer.Filename), os.O_RDWR, 0600)
if err != nil {
return nil, err
_ = sqlStore.alerts.RegisterAlert(context.Background(), alerts.Alert{
ID: types.HashBytes([]byte(buffer.Filename)),
Severity: alerts.SeverityCritical,
Message: "failed to read buffer file on startup",
Data: map[string]interface{}{
"filename": buffer.Filename,
"slabKey": ec,
},
Timestamp: time.Now(),
})
sqlStore.logger.Errorf("failed to open buffer file %v for slab %v: %v", buffer.Filename, buffer.DBSlab.Key, err)
continue
}
// Create the slab buffer.
var ec object.EncryptionKey
if err := ec.UnmarshalText(buffer.DBSlab.Key); err != nil {
return nil, err
}
sb := &SlabBuffer{
dbID: buffer.ID,
filename: buffer.Filename,
Expand Down

0 comments on commit 8ac2468

Please sign in to comment.