Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix NGT flush logic #2598

Merged
merged 17 commits into from
Sep 11, 2024
19 changes: 14 additions & 5 deletions pkg/agent/core/ngt/service/ngt.go
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@
}
return ctx.Err()
case <-tick.C:
if n.vq.IVQLen() >= n.alen {
if n.vq != nil && !n.IsFlushing() && n.vq.IVQLen() >= n.alen {

Check warning on line 911 in pkg/agent/core/ngt/service/ngt.go

View check run for this annotation

Codecov / codecov/patch

pkg/agent/core/ngt/service/ngt.go#L911

Added line #L911 was not covered by tests
err = n.CreateIndex(ctx, n.poolSize)
}
case <-limit.C:
Expand Down Expand Up @@ -1249,7 +1249,7 @@
runtime.GC()
atomic.AddUint64(&n.nogce, 1)

if n.inMem {
if !n.inMem {

Check warning on line 1252 in pkg/agent/core/ngt/service/ngt.go

View check run for this annotation

Codecov / codecov/patch

pkg/agent/core/ngt/service/ngt.go#L1252

Added line #L1252 was not covered by tests
hlts2 marked this conversation as resolved.
Show resolved Hide resolved
// delete file
err = file.DeleteDir(ctx, n.path)
if err != nil {
Expand Down Expand Up @@ -1941,15 +1941,24 @@
}

func (n *ngt) Len() uint64 {
return n.kvs.Len()
if n != nil && n.kvs != nil && !n.IsFlushing() {
return n.kvs.Len()
}
return 0

Check warning on line 1947 in pkg/agent/core/ngt/service/ngt.go

View check run for this annotation

Codecov / codecov/patch

pkg/agent/core/ngt/service/ngt.go#L1947

Added line #L1947 was not covered by tests
hlts2 marked this conversation as resolved.
Show resolved Hide resolved
}

func (n *ngt) InsertVQueueBufferLen() uint64 {
return uint64(n.vq.IVQLen())
if n != nil && n.vq != nil && !n.IsFlushing() {
return uint64(n.vq.IVQLen())
}
return 0

Check warning on line 1954 in pkg/agent/core/ngt/service/ngt.go

View check run for this annotation

Codecov / codecov/patch

pkg/agent/core/ngt/service/ngt.go#L1954

Added line #L1954 was not covered by tests
}

func (n *ngt) DeleteVQueueBufferLen() uint64 {
return uint64(n.vq.DVQLen())
if n != nil && n.vq != nil && !n.IsFlushing() {
return uint64(n.vq.DVQLen())
}
return 0

Check warning on line 1961 in pkg/agent/core/ngt/service/ngt.go

View check run for this annotation

Codecov / codecov/patch

pkg/agent/core/ngt/service/ngt.go#L1961

Added line #L1961 was not covered by tests
hlts2 marked this conversation as resolved.
Show resolved Hide resolved
}

func (n *ngt) GetDimensionSize() int {
Expand Down
Loading