guard copyDataBasedOnIndexFile size check against nil needle map

The post-compaction size validation at line 538 accesses
v.nm.ContentSize() and v.nm.DeletedSize(). If CommitCompact has
concurrently set v.nm to nil, this causes a SIGSEGV. Skip the
validation when v.nm is nil since the actual data copy uses local
needle maps (oldNm/newNm) and is unaffected.

Fixes #8591
This commit is contained in:
Chris Lu committed 2026-03-10 12:24:28 -07:00
1 parent 889ae7d22d
commit 0b7d5aac94
1 file changed
+1 -1
+1 -1
View File
@@ -533,7 +533,7 @@ func (v *Volume) copyDataBasedOnIndexFile(opts *CompactOptions) (err error) {
if err != nil {
return err
}
if v.Ttl.String() == "" {
if v.Ttl.String() == "" && v.nm != nil {
dstDatSize, _, err := dstDatBackend.GetStat()
if err != nil {
return err