Fix panic when flushing segment (#10182)

issue: #10180
Signed-off-by: sunby <bingyi.sun@zilliz.com>
This commit is contained in:
sunby 2021-10-19 19:06:37 +08:00 committed by GitHub
parent 736a2cc358
commit 4031b8746f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -246,8 +246,11 @@ func (ibNode *insertBufferNode) Operate(in []Msg) []Msg {
segmentsToFlush = append(segmentsToFlush, currentSegID)
bd, ok := ibNode.insertBuffer.Load(currentSegID)
var err error
buf := bd.(*BufferData)
if !ok || buf.size <= 0 { // Buffer empty
var buf *BufferData
if ok {
buf = bd.(*BufferData)
}
if buf == nil || buf.size <= 0 { // Buffer empty
log.Debug(".. Buffer empty ...")
err = ibNode.flushManager.flushBufferData(nil, currentSegID, true, endPositions[0])
} else { // Buffer not empty