File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -9044,6 +9044,13 @@ func (fs *fileStore) purge(fseq uint64) (uint64, error) {
90449044 // Leave a tombstone so we can remember our starting sequence in case
90459045 // full state becomes corrupted.
90469046 fs .writeTombstone (lseq , lmb .last .ts )
9047+ if lmb .mfd != nil {
9048+ // Sync is critical here: after purge, the message block may be 0 bytes (especially for workqueue streams), and
9049+ // the index may also be 0 bytes. The tombstone will be the only persistent record of the last sequence number.
9050+ // We must ensure it's durably written to disk before returning; otherwise, a crash could leave the
9051+ // stream in an unrecoverable state with no sequence history.
9052+ lmb .mfd .Sync ()
9053+ }
90479054 }
90489055
90499056 cb := fs .scb
You can’t perform that action at this time.
0 commit comments