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

enhance: [2.4] Cherry pick 39051, 38350 #9

Merged
merged 4 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions internal/querynodev2/segments/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import "C"

import (
"context"
"fmt"
"sync"
"unsafe"

Expand Down Expand Up @@ -112,10 +113,15 @@ func (m *collectionManager) PutOrRef(collectionID int64, schema *schemapb.Collec
}
collection.Ref(1)
m.collections[collectionID] = collection
m.updateMetric()

return nil
}

func (m *collectionManager) updateMetric() {
metrics.QueryNodeNumCollections.WithLabelValues(fmt.Sprint(paramtable.GetNodeID())).Set(float64(len(m.collections)))
}

func (m *collectionManager) Ref(collectionID int64, count uint32) bool {
m.mut.Lock()
defer m.mut.Unlock()
Expand All @@ -140,6 +146,7 @@ func (m *collectionManager) Unref(collectionID int64, count uint32) bool {
DeleteCollection(collection)

metrics.CleanupQueryNodeCollectionMetrics(paramtable.GetNodeID(), collectionID)
m.updateMetric()
return true
}
return false
Expand Down
Loading