This is an automated email from the ASF dual-hosted git repository.
hanahmily pushed a commit to branch doc
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git
The following commit(s) were added to refs/heads/doc by this push:
new 4f0c1aa2 Fix the bug that accesses restored data
4f0c1aa2 is described below
commit 4f0c1aa2c0318d2442925b93b284eb5acd727694
Author: Gao Hongtao <[email protected]>
AuthorDate: Sun Oct 6 01:35:43 2024 +0000
Fix the bug that accesses restored data
Signed-off-by: Gao Hongtao <[email protected]>
---
banyand/measure/query.go | 19 ++++++++++---------
banyand/stream/query.go | 19 ++++++++++---------
2 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/banyand/measure/query.go b/banyand/measure/query.go
index e4b1cb3d..299402fe 100644
--- a/banyand/measure/query.go
+++ b/banyand/measure/query.go
@@ -480,17 +480,18 @@ func (qr *queryResult) Pull() *model.MeasureResult {
blankCursorList := []int{}
for completed := 0; completed < len(qr.data); completed++ {
- select {
- case <-qr.ctx.Done():
- return &model.MeasureResult{
- Error:
errors.WithMessagef(qr.ctx.Err(), "interrupt: loaded %d/%d cursors", completed,
len(qr.data)),
- }
- case result := <-cursorChan:
- if result != -1 {
- blankCursorList =
append(blankCursorList, result)
- }
+ result := <-cursorChan
+ if result != -1 {
+ blankCursorList = append(blankCursorList,
result)
}
}
+ select {
+ case <-qr.ctx.Done():
+ return &model.MeasureResult{
+ Error: errors.WithMessagef(qr.ctx.Err(),
"interrupt: blank/total=%d/%d", len(blankCursorList), len(qr.data)),
+ }
+ default:
+ }
sort.Slice(blankCursorList, func(i, j int) bool {
return blankCursorList[i] > blankCursorList[j]
})
diff --git a/banyand/stream/query.go b/banyand/stream/query.go
index d96e39ee..d8e14b28 100644
--- a/banyand/stream/query.go
+++ b/banyand/stream/query.go
@@ -296,16 +296,17 @@ func (qr *queryResult) load(ctx context.Context, qo
queryOptions) *model.StreamR
blankCursorList := []int{}
for completed := 0; completed < len(qr.data); completed++ {
- select {
- case <-ctx.Done():
- return &model.StreamResult{
- Error: errors.WithMessagef(ctx.Err(),
"interrupt: loaded %d/%d cursors", completed, len(qr.data)),
- }
- case result := <-cursorChan:
- if result != -1 {
- blankCursorList =
append(blankCursorList, result)
- }
+ result := <-cursorChan
+ if result != -1 {
+ blankCursorList = append(blankCursorList,
result)
+ }
+ }
+ select {
+ case <-ctx.Done():
+ return &model.StreamResult{
+ Error: errors.WithMessagef(ctx.Err(),
"interrupt: blank/total=%d/%d", len(blankCursorList), len(qr.data)),
}
+ default:
}
sort.Slice(blankCursorList, func(i, j int) bool {
return blankCursorList[i] > blankCursorList[j]