mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 02:27:26 +01:00
blockvolume, volume: report classifiable open failures too; document io_error
Review of #139 (codex01 AMEND): 1. #133 covers open AND replay. A classifiable EnsureStorage failure now takes the same fail-closed path as a replay failure: local readiness blocked (frontend I/O refused), the typed reason recorded through ReportLocalRecoveryFailure, and the process kept up serving status and heartbeats, so a primary assignment reports it at once. An open failure that cannot be classified exits as before. 2. io_error is documented as deliberately broad: the volume's local storage could not be opened or read at startup. A path error such as ENOENT, EACCES or EISDIR is io_error too, which says the storage is unusable, not that the disk is physically damaged. The underlying error stays in the readiness evidence and is now in the log line. Refs #133 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1e0e79e236
commit
184f755feb
2 files changed
+21
-6
No files matched your search
@@ -5,6 +5,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/seaweedfs/seaweed-block/core/frontend/durable"
|
||||
"github.com/seaweedfs/seaweed-block/core/host/volume"
|
||||
"github.com/seaweedfs/seaweed-block/core/storage"
|
||||
)
|
||||
|
||||
@@ -43,7 +44,13 @@ const (
|
||||
// exit.
|
||||
func openAndRecoverDurable(dp durableStartup, h localRecoveryHost, volumeID string, recoverTimeout time.Duration) (durableStartupOutcome, string, error) {
|
||||
if _, err := dp.EnsureStorage(volumeID); err != nil {
|
||||
return durableStartupFatal, "", err // RED: open failures still exit unreported
|
||||
if volume.LocalRecoveryHealthReason(err) == "" {
|
||||
return durableStartupFatal, "", err
|
||||
}
|
||||
evidence := "durable storage open failed: " + err.Error()
|
||||
h.BlockLocalReadiness(evidence)
|
||||
h.ReportLocalRecoveryFailure(err)
|
||||
return durableStartupFaulted, evidence, err
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), recoverTimeout)
|
||||
defer cancel()
|
||||
|
||||
@@ -205,10 +205,18 @@ func (h *Host) CatchUpSince() time.Time {
|
||||
return h.wd.catchUpSince()
|
||||
}
|
||||
|
||||
// LocalRecoveryHealthReason classifies a local durable recovery failure
|
||||
// into a typed unhealthy reason (#133): wal_corrupt for a WAL/extent
|
||||
// integrity fault, io_error for a storage I/O failure. It returns "" for
|
||||
// an error it cannot classify (the watchdog's timeout still covers that).
|
||||
// LocalRecoveryHealthReason classifies a local durable open or replay
|
||||
// failure into a typed unhealthy reason (#133). It returns "" for an
|
||||
// error it cannot classify (the watchdog's timeout still covers that).
|
||||
//
|
||||
// - wal_corrupt: the substrate found a WAL/extent integrity fault
|
||||
// (storage.RecoveryFailure kind WALIntegrity, or ErrWALIntegrityFault).
|
||||
// - io_error: the local storage could not be opened or read at startup:
|
||||
// kind SubstrateIO, any fs.PathError, io.ErrUnexpectedEOF or EIO. This
|
||||
// is deliberately broad. A path error such as ENOENT, EACCES or EISDIR
|
||||
// is io_error too: it says the volume's local storage is unusable, NOT
|
||||
// that the physical disk is damaged. The underlying error is kept in
|
||||
// the readiness evidence and the log line, for diagnosis.
|
||||
func LocalRecoveryHealthReason(err error) string {
|
||||
if err == nil {
|
||||
return ""
|
||||
@@ -240,7 +248,7 @@ func (h *Host) ReportLocalRecoveryFailure(err error) string {
|
||||
reason := LocalRecoveryHealthReason(err)
|
||||
h.localRecoveryReason.Store(reason)
|
||||
if reason != "" {
|
||||
h.log.Printf("blockvolume: volume %s local durable recovery failed (%s): a primary assignment reports it as unhealthy", h.cfg.VolumeID, reason)
|
||||
h.log.Printf("blockvolume: volume %s local durable open/recovery failed (%s): %v; a primary assignment reports it as unhealthy", h.cfg.VolumeID, reason, err)
|
||||
}
|
||||
return reason
|
||||
}
|
||||
Reference in new issue
Block a user