mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
Init rand.Seed
Signed-off-by: sunby <bingyi.sun@zilliz.com>
This commit is contained in:
parent
403212c5fa
commit
ab21115d54
@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"math/rand"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
@ -49,7 +50,7 @@ type DataNode struct {
|
||||
}
|
||||
|
||||
func NewDataNode(ctx context.Context, factory msgstream.Factory) *DataNode {
|
||||
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
ctx2, cancel2 := context.WithCancel(ctx)
|
||||
node := &DataNode{
|
||||
ctx: ctx2,
|
||||
|
||||
@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"path"
|
||||
"strconv"
|
||||
"strings"
|
||||
@ -63,6 +64,7 @@ type Server struct {
|
||||
}
|
||||
|
||||
func CreateServer(ctx context.Context, factory msgstream.Factory) (*Server, error) {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
ch := make(chan struct{})
|
||||
s := &Server{
|
||||
ctx: ctx,
|
||||
|
||||
@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
"github.com/opentracing/opentracing-go"
|
||||
@ -49,6 +50,7 @@ type IndexNode struct {
|
||||
}
|
||||
|
||||
func NewIndexNode(ctx context.Context) (*IndexNode, error) {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
ctx1, cancel := context.WithCancel(ctx)
|
||||
b := &IndexNode{
|
||||
loopCtx: ctx1,
|
||||
|
||||
@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"math/rand"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@ -58,6 +59,7 @@ type UniqueID = typeutil.UniqueID
|
||||
type Timestamp = typeutil.Timestamp
|
||||
|
||||
func NewIndexService(ctx context.Context) (*IndexService, error) {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
ctx1, cancel := context.WithCancel(ctx)
|
||||
i := &IndexService{
|
||||
loopCtx: ctx1,
|
||||
|
||||
@ -7,7 +7,6 @@ import (
|
||||
"math/rand"
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
grpcproxynodeclient "github.com/zilliztech/milvus-distributed/internal/distributed/proxynode/client"
|
||||
"github.com/zilliztech/milvus-distributed/internal/types"
|
||||
@ -28,7 +27,6 @@ type GlobalNodeInfoTable struct {
|
||||
}
|
||||
|
||||
func (table *GlobalNodeInfoTable) randomPick() UniqueID {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
l := len(table.nodeIDs)
|
||||
choice := rand.Intn(l)
|
||||
return table.nodeIDs[choice]
|
||||
|
||||
@ -15,8 +15,10 @@ import "C"
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/zilliztech/milvus-distributed/internal/types"
|
||||
|
||||
@ -62,6 +64,7 @@ type QueryNode struct {
|
||||
}
|
||||
|
||||
func NewQueryNode(ctx context.Context, queryNodeID UniqueID, factory msgstream.Factory) *QueryNode {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
ctx1, cancel := context.WithCancel(ctx)
|
||||
node := &QueryNode{
|
||||
queryNodeLoopCtx: ctx1,
|
||||
|
||||
@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"math/rand"
|
||||
"sort"
|
||||
"strconv"
|
||||
"sync"
|
||||
@ -642,6 +643,7 @@ func (qs *QueryService) GetSegmentInfo(ctx context.Context, req *querypb.Segment
|
||||
}
|
||||
|
||||
func NewQueryService(ctx context.Context, factory msgstream.Factory) (*QueryService, error) {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
nodes := make(map[int64]*queryNodeInfo)
|
||||
queryChannels := make([]*queryChannelInfo, 0)
|
||||
ctx1, cancel := context.WithCancel(ctx)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user