Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
wenhuiZilliz committed Jul 15, 2024
1 parent bdf7617 commit 8460436
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 16 deletions.
32 changes: 24 additions & 8 deletions core/dbclient/milvus2x.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/zilliztech/milvus-migration/internal/log"
"github.com/zilliztech/milvus-migration/storage/milvus2x"
"go.uber.org/zap"
"google.golang.org/grpc"
"strconv"
"time"
)
Expand Down Expand Up @@ -37,15 +38,30 @@ func NewMilvus2xClient(cfg *config.Milvus2xConfig) (*Milvus2x, error) {
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()

if cfg.UserName == "" {
log.Info("[Milvus2x] find username is empty, will use NewDefaultGrpcClient() to new client")
milvus, err = client.NewDefaultGrpcClient(ctx, cfg.Endpoint)
} else {
log.Info("[Milvus2x] find username not empty, will use NewDefaultGrpcClientWithURI() to new client")
milvus, err = client.NewDefaultGrpcClientWithURI(ctx, cfg.Endpoint, cfg.UserName, cfg.Password)
}
//if cfg.UserName == "" {
// log.Info("[Milvus2x] find username is empty, will use NewDefaultGrpcClient() to new client")
// milvus, err = client.NewDefaultGrpcClient(ctx, cfg.Endpoint)
//} else {
// log.Info("[Milvus2x] find username not empty, will use NewDefaultGrpcClientWithURI() to new client")
// milvus, err = client.NewDefaultGrpcClientWithURI(ctx, cfg.Endpoint, cfg.UserName, cfg.Password)
//}
//if err != nil {
// log.Error("[Milvus2x] new milvus client error", zap.Error(err))
// return nil, err
//}

milvus, err = client.NewClient(ctx, client.Config{
Address: cfg.Endpoint,
Username: cfg.UserName,
Password: cfg.Password,
DialOptions: []grpc.DialOption{
grpc.WithDefaultCallOptions(
grpc.MaxCallRecvMsgSize(67108864),
grpc.MaxCallSendMsgSize(268435456),
),
},
})
if err != nil {
log.Error("[Milvus2x] new milvus client error", zap.Error(err))
return nil, err
}

Expand Down
32 changes: 24 additions & 8 deletions storage/milvus2x/milvus2_3_ver.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/zilliztech/milvus-migration/core/type/milvus2xtype"
"github.com/zilliztech/milvus-migration/internal/log"
"go.uber.org/zap"
"google.golang.org/grpc"
"io"
"strconv"
"time"
Expand Down Expand Up @@ -117,15 +118,30 @@ func _createMilvus23VerClient(cfg *config.Milvus2xConfig) (*Milvus23VerClient, e
var err error
ctx := context.Background()

if cfg.UserName == "" {
log.Info("[Milvus23x] find username is empty, will use NewDefaultGrpcClient() to new client")
milvus, err = client.NewDefaultGrpcClient(ctx, cfg.Endpoint)
} else {
log.Info("[Milvus23x] find username not empty, will use NewDefaultGrpcClientWithURI() to new client")
milvus, err = client.NewDefaultGrpcClientWithURI(ctx, cfg.Endpoint, cfg.UserName, cfg.Password)
}
//if cfg.UserName == "" {
// log.Info("[Milvus23x] find username is empty, will use NewDefaultGrpcClient() to new client")
// milvus, err = client.NewDefaultGrpcClient(ctx, cfg.Endpoint)
//} else {
// log.Info("[Milvus23x] find username not empty, will use NewDefaultGrpcClientWithURI() to new client")
// milvus, err = client.NewDefaultGrpcClientWithURI(ctx, cfg.Endpoint, cfg.UserName, cfg.Password)
//}
//if err != nil {
// log.Error("[Milvus23x] new milvus client error", zap.Error(err))
// return nil, err
//}

milvus, err = client.NewClient(ctx, client.Config{
Address: cfg.Endpoint,
Username: cfg.UserName,
Password: cfg.Password,
DialOptions: []grpc.DialOption{
grpc.WithDefaultCallOptions(
grpc.MaxCallRecvMsgSize(67108864),
grpc.MaxCallSendMsgSize(268435456),
),
},
})
if err != nil {
log.Error("[Milvus23x] new milvus client error", zap.Error(err))
return nil, err
}

Expand Down

0 comments on commit 8460436

Please sign in to comment.