mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-04 04:49:08 +08:00
Add lock for segment manager during bulk insert (#23111)
/kind bug issue: #23106 Signed-off-by: Yuchen Gao <yuchen.gao@zilliz.com>
This commit is contained in:
parent
8b7c9d4ff2
commit
1596abf6e8
@ -292,11 +292,15 @@ func (s *SegmentManager) AllocSegment(ctx context.Context, collectionID UniqueID
|
||||
// allocSegmentForImport allocates one segment allocation for bulk insert.
|
||||
func (s *SegmentManager) allocSegmentForImport(ctx context.Context, collectionID UniqueID,
|
||||
partitionID UniqueID, channelName string, requestRows int64, importTaskID int64) (*Allocation, error) {
|
||||
// init allocation
|
||||
allocation := getAllocation(requestRows)
|
||||
_, sp := otel.Tracer(typeutil.DataCoordRole).Start(ctx, "Alloc-ImportSegment")
|
||||
defer sp.End()
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
// create new segments and add allocations to meta
|
||||
// to avoid mixing up with growing segments, the segment state is "Importing"
|
||||
// Init allocation.
|
||||
allocation := getAllocation(requestRows)
|
||||
// Create new segments and add allocations to meta.
|
||||
// To avoid mixing up with growing segments, the segment state is "Importing"
|
||||
expireTs, err := s.genExpireTs(ctx, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Loading…
Reference in New Issue
Block a user