mirror of https://github.com/milvus-io/milvus.git
Fix Data race of loadType in querynode/collection.go (#17275)
Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>pull/17278/head
parent
11834a0948
commit
cecbd40a22
|
@ -33,6 +33,7 @@ import (
|
|||
"fmt"
|
||||
"math"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"unsafe"
|
||||
|
||||
"github.com/milvus-io/milvus/internal/util/typeutil"
|
||||
|
@ -61,7 +62,7 @@ type Collection struct {
|
|||
vDeltaChannels []Channel
|
||||
pDeltaChannels []Channel
|
||||
|
||||
loadType loadType
|
||||
loadType int32
|
||||
|
||||
releaseMu sync.RWMutex // guards release
|
||||
releasedPartitions map[UniqueID]struct{}
|
||||
|
@ -283,12 +284,13 @@ func (c *Collection) getReleaseTime() (Timestamp, bool) {
|
|||
|
||||
// setLoadType set the loading type of collection, which is loadTypeCollection or loadTypePartition
|
||||
func (c *Collection) setLoadType(l loadType) {
|
||||
c.loadType = l
|
||||
atomic.StoreInt32(&c.loadType, int32(l))
|
||||
}
|
||||
|
||||
// getLoadType get the loadType of collection, which is loadTypeCollection or loadTypePartition
|
||||
func (c *Collection) getLoadType() loadType {
|
||||
return c.loadType
|
||||
l := atomic.LoadInt32(&c.loadType)
|
||||
return loadType(l)
|
||||
}
|
||||
|
||||
// getFieldType get the field type according to the field id.
|
||||
|
|
Loading…
Reference in New Issue