mirror of
https://github.com/Nanaloveyuki/BitLogger.git
synced 2026-07-24 00:42:18 +00:00
🩹 harden file rotation failures
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
name: file-sink-reopen-append
|
||||
group: api
|
||||
category: sink
|
||||
update-time: 20260613
|
||||
update-time: 20260717
|
||||
description: Reopen a FileSink in append mode.
|
||||
key-word:
|
||||
- file
|
||||
@@ -37,6 +37,7 @@ Detailed rules explaining key parameters and behaviors
|
||||
- Reopen behavior is fixed to append mode.
|
||||
- The stored append policy is updated to `true` as part of the reopen path.
|
||||
- On failure, the sink remains unavailable and `open_failures` is incremented.
|
||||
- After a rotation failure, this is the explicit recovery path once the underlying remove, rename, or open condition has been resolved.
|
||||
|
||||
### How to Use
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
name: file-sink-rotation-failures
|
||||
group: api
|
||||
category: sink
|
||||
update-time: 20260707
|
||||
update-time: 20260717
|
||||
description: Read the number of rotation failures recorded by a FileSink.
|
||||
key-word:
|
||||
- file
|
||||
@@ -36,6 +36,7 @@ Detailed rules explaining key parameters and behaviors
|
||||
- The sink reports its recorded rotation-failure count directly.
|
||||
- The counter increases when a rotation attempt cannot complete its critical file steps, such as removing the active file with zero backups, renaming a live file into `.1`, shifting an existing backup to a higher slot, or reopening the fresh active file afterward.
|
||||
- Missing optional backup slots do not count by themselves; only steps that fail while their source path still exists are treated as rotation failures.
|
||||
- When a critical rotation step fails, the triggering record is not written and the sink remains unavailable until an explicit reopen succeeds.
|
||||
- The counter is cumulative until reset.
|
||||
- This helper is observation-only and does not mutate sink state.
|
||||
|
||||
@@ -70,6 +71,8 @@ e.g.:
|
||||
|
||||
- This counter alone does not say whether the sink is currently available.
|
||||
|
||||
- After a recorded rotation failure, use `reopen_append()` only after the underlying filesystem condition has been resolved.
|
||||
|
||||
### Notes
|
||||
|
||||
1. Use this helper when diagnosing incomplete direct file rotations.
|
||||
|
||||
Reference in New Issue
Block a user