Closed krish-nr closed 3 months ago
==>
if _, ok := dl.buffer.(*nodebufferlist); ok {
persistentID := rawdb.ReadPersistentStateID(dl.db.diskdb)
if limit >= persistentID {
log.Info("No prune ancient under nodebufferlist, less than db config state history limit", "persistent_id", persistentID, "limit", limit)
return ndl, nil
}
targetOldest := persistentID - limit + 1
realOldest, err := dl.db.freezer.Tail()
if err == nil && targetOldest <= realOldest {
log.Info("No prune ancient under nodebufferlist due to truncate oldest less than real oldest, which maybe happened in abnormal restart",
"tartget_oldest_id", targetOldest, "real_oldest_id", realOldest, "error", err)
return ndl, nil
}
oldest = targetOldest
log.Info("Forcing prune ancient under nodebufferlist", "disk_persistent_state_id",
persistentID, "truncate_tail", oldest)
}
maybe better.
The problem probably occurs because there may be a gap between write wal and write stateid. Write wal occurs during commit to disklayer, and write stateid occurs during disklayer background flush. Therefore, stateid (ReadPersistentStateID) may be smaller than the actual wal head, and stateid - limit may be smaller than the actual wal tail.
Pls refine PR title and description. as unclean shutdown happens
is misleading.
Description
ignore truncation target range as flush not operated on time
Rationale
bufferlist meet an update failure when unclean shutdown happens and lead to a panic, ignore the range judgement in this scenario
Example
N/A
Changes