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
17 changes: 13 additions & 4 deletions pkg/agent/core/ngt/service/ngt.go
Original file line number Diff line number Diff line change
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.kvs != 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
hlts2 marked this conversation as resolved.
Show resolved Hide resolved
}

func (n *ngt) DeleteVQueueBufferLen() uint64 {
return uint64(n.vq.DVQLen())
if n != nil && n.kvs != 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