From 590397229e00dc90366d1f7eb15b85a0f88037dd Mon Sep 17 00:00:00 2001 From: chrislu Date: Thu, 11 Jul 2024 00:26:18 -0700 Subject: [PATCH] fix heap init --- weed/filer/filer_notify_read.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/weed/filer/filer_notify_read.go b/weed/filer/filer_notify_read.go index 1cdf12d63..115a925e9 100644 --- a/weed/filer/filer_notify_read.go +++ b/weed/filer/filer_notify_read.go @@ -226,17 +226,19 @@ func (c *LogFileEntryCollector) collectMore(v *OrderedLogVisitor) (err error) { glog.Errorf("Unexpected! failed to find iterator for filer %s", filerId) continue } - next, err := iter.getNext(v) - if err != nil { - if err == io.EOF { + next, nextErr := iter.getNext(v) + if nextErr != nil { + if nextErr == io.EOF { // do nothing since the filer has no more log entries + }else { + return fmt.Errorf("failed to get next log entry for %v: %v", entryName, err) } - return fmt.Errorf("failed to get next log entry for %v: %v", entryName, err) + } else { + heap.Push(v.pq, &LogEntryItem{ + Entry: next, + filer: filerId, + }) } - heap.Push(v.pq, &LogEntryItem{ - Entry: next, - filer: filerId, - }) } return nil