mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 18:47:20 +01:00
durable: log when a detach's I/O stop began (the operational flip), next to when StopIO returned
A guest error after the flip is a refusal by contract; only an error on I/O admitted before the flip is a data-path failure. The detach now logs 'I/O stop began at' (taken just before the flip: plain stop, live StopIO, or the pre-copy TryStopIO) beside 'StopIO returned at', both RFC 3339 nanoseconds, so a measurement can count from the flip (#375). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
089373518a
commit
76e56fc6cd
1 file changed
+12
-3
@@ -1121,10 +1121,17 @@ func (p *DurableProvider) detachVolume(ctx context.Context, volumeID string, pla
|
||||
// the cut gets three quarters, the settlement what is left. The bound is
|
||||
// cooperative (contexts): a syscall that never returns is not bounded here.
|
||||
var start time.Time
|
||||
var stopIOReturned time.Time
|
||||
// stopIOBegan is taken just before the operational flip (from then on new
|
||||
// I/O is refused by contract), stopIOReturned when the admitted I/O has
|
||||
// drained; both are logged so a measurement can tell a refusal after the
|
||||
// flip from an admitted I/O that failed.
|
||||
var stopIOBegan, stopIOReturned time.Time
|
||||
defer func() {
|
||||
if !stopIOReturned.IsZero() {
|
||||
// Emit after the cut releases its barrier, using the actual return time.
|
||||
// Emit after the cut releases its barrier, using the actual times.
|
||||
if !stopIOBegan.IsZero() {
|
||||
log.Printf("durable: volume=%s I/O stop began at %s", volumeID, stopIOBegan.UTC().Format(time.RFC3339Nano))
|
||||
}
|
||||
log.Printf("durable: volume=%s StopIO returned at %s", volumeID, stopIOReturned.UTC().Format(time.RFC3339Nano))
|
||||
}
|
||||
}()
|
||||
@@ -1194,10 +1201,11 @@ func (p *DurableProvider) detachVolume(ctx context.Context, volumeID string, pla
|
||||
// Cancel/join the periodic owner before any final freeze, while serving.
|
||||
p.stopChunkLoop(h)
|
||||
r, err = owner.PrecopyDetachWithAdmission(hostlimit.WithClass(cutCtx, hostlimit.Urgent), h.backend.BeginPrecopyPause, func() bool {
|
||||
began := time.Now()
|
||||
if !h.backend.TryStopIO("chunk pre-copy: final detached cut") {
|
||||
return false
|
||||
}
|
||||
stopIOReturned = time.Now()
|
||||
stopIOBegan, stopIOReturned = began, time.Now()
|
||||
h.chunkDetach = true
|
||||
beginFreeze()
|
||||
return true
|
||||
@@ -1238,6 +1246,7 @@ func (p *DurableProvider) detachVolume(ctx context.Context, volumeID string, pla
|
||||
}
|
||||
} else {
|
||||
beginFreeze()
|
||||
stopIOBegan = time.Now()
|
||||
if plain {
|
||||
if err := h.backend.stopPlainDetachIfIdle(); err != nil {
|
||||
return r, 0, err
|
||||
|
||||
Reference in new issue
Block a user