fix: Move compress binlog after check result GetCompactionResult error (#30127)

See also: #28873

When datanode returns error or go offline during GetCompactionResult
call, the compress binlog logic will panic since it was using a nil
result

This PR move it after the CheckRPCCall error to prevent this case.

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
congqixia 2024-01-19 14:12:55 +08:00 committed by GitHub
parent f542bdbf3c
commit 15716ec283
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -287,18 +287,15 @@ func (c *SessionManagerImpl) GetCompactionPlansResults() map[int64]*datapb.Compa
),
})
// for compatibility issue, before 2.3.4, resp has only logpath
// try to parse path and fill logid
for _, result := range resp.Results {
binlog.CompressCompactionBinlogs(result.GetSegments())
}
if err := merr.CheckRPCCall(resp, err); err != nil {
log.Info("Get State failed", zap.Error(err))
return
}
for _, rst := range resp.GetResults() {
// for compatibility issue, before 2.3.4, resp has only logpath
// try to parse path and fill logid
binlog.CompressCompactionBinlogs(rst.GetSegments())
plans.Insert(rst.PlanID, rst)
}
}(nodeID, s)