Fix 6990, enhance the log when parsing grpc recv/send parameters (#6993)

Signed-off-by: dragondriver <jiquan.long@zilliz.com>
This commit is contained in:
dragondriver 2021-08-12 16:16:09 +08:00 committed by GitHub
parent 3f21e3d062
commit b3f10ae5cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 496 additions and 125 deletions

View File

@ -12,6 +12,7 @@
package grpcdatacoordclient
import (
"strconv"
"sync"
"github.com/milvus-io/milvus/internal/distributed/grpcconfigs"
@ -42,22 +43,46 @@ func (pt *ParamTable) Init() {
func (pt *ParamTable) initClientMaxSendSize() {
var err error
pt.ClientMaxSendSize, err = pt.ParseIntWithErr("dataCoord.grpc.clientMaxSendSize")
if err != nil {
valueStr, err := pt.Load("dataCoord.grpc.clientMaxSendSize")
if err != nil { // not set
pt.ClientMaxSendSize = grpcconfigs.DefaultClientMaxSendSize
log.Debug("dataCoord.grpc.clientMaxSendSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse dataCoord.grpc.clientMaxSendSize, set to default",
zap.String("dataCoord.grpc.clientMaxSendSize", valueStr),
zap.Error(err))
pt.ClientMaxSendSize = grpcconfigs.DefaultClientMaxSendSize
} else {
pt.ClientMaxSendSize = value
}
log.Debug("initClientMaxSendSize",
zap.Int("dataCoord.grpc.clientMaxSendSize", pt.ClientMaxSendSize))
}
func (pt *ParamTable) initClientMaxRecvSize() {
var err error
pt.ClientMaxRecvSize, err = pt.ParseIntWithErr("dataCoord.grpc.clientMaxRecvSize")
if err != nil {
valueStr, err := pt.Load("dataCoord.grpc.clientMaxRecvSize")
if err != nil { // not set
pt.ClientMaxRecvSize = grpcconfigs.DefaultClientMaxRecvSize
log.Debug("dataCoord.grpc.clientMaxRecvSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse dataCoord.grpc.clientMaxRecvSize, set to default",
zap.String("dataCoord.grpc.clientMaxRecvSize", valueStr),
zap.Error(err))
pt.ClientMaxRecvSize = grpcconfigs.DefaultClientMaxRecvSize
} else {
pt.ClientMaxRecvSize = value
}
log.Debug("initClientMaxRecvSize",
zap.Int("dataCoord.grpc.clientMaxRecvSize", pt.ClientMaxRecvSize))
}

View File

@ -12,6 +12,7 @@
package grpcdatacoordclient
import (
"strconv"
"sync"
"github.com/milvus-io/milvus/internal/distributed/grpcconfigs"
@ -78,22 +79,46 @@ func (pt *ParamTable) initDataCoordAddress() {
func (pt *ParamTable) initServerMaxSendSize() {
var err error
pt.ServerMaxSendSize, err = pt.ParseIntWithErr("dataCoord.grpc.serverMaxSendSize")
if err != nil {
valueStr, err := pt.Load("dataCoord.grpc.serverMaxSendSize")
if err != nil { // not set
pt.ServerMaxSendSize = grpcconfigs.DefaultServerMaxSendSize
log.Debug("dataCoord.grpc.serverMaxSendSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse dataCoord.grpc.serverMaxSendSize, set to default",
zap.String("dataCoord.grpc.serverMaxSendSize", valueStr),
zap.Error(err))
pt.ServerMaxSendSize = grpcconfigs.DefaultServerMaxSendSize
} else {
pt.ServerMaxSendSize = value
}
log.Debug("initServerMaxSendSize",
zap.Int("dataCoord.grpc.serverMaxSendSize", pt.ServerMaxSendSize))
}
func (pt *ParamTable) initServerMaxRecvSize() {
var err error
pt.ServerMaxRecvSize, err = pt.ParseIntWithErr("dataCoord.grpc.serverMaxRecvSize")
if err != nil {
valueStr, err := pt.Load("dataCoord.grpc.serverMaxRecvSize")
if err != nil { // not set
pt.ServerMaxRecvSize = grpcconfigs.DefaultServerMaxRecvSize
log.Debug("dataCoord.grpc.serverMaxRecvSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse dataCoord.grpc.serverMaxRecvSize, set to default",
zap.String("dataCoord.grpc.serverMaxRecvSize", valueStr),
zap.Error(err))
pt.ServerMaxRecvSize = grpcconfigs.DefaultServerMaxRecvSize
} else {
pt.ServerMaxRecvSize = value
}
log.Debug("initServerMaxRecvSize",
zap.Int("dataCoord.grpc.serverMaxRecvSize", pt.ServerMaxRecvSize))
}

View File

@ -12,6 +12,7 @@
package grpcdatanodeclient
import (
"strconv"
"sync"
"github.com/milvus-io/milvus/internal/distributed/grpcconfigs"
@ -42,22 +43,46 @@ func (pt *ParamTable) Init() {
func (pt *ParamTable) initClientMaxSendSize() {
var err error
pt.ClientMaxSendSize, err = pt.ParseIntWithErr("dataNode.grpc.clientMaxSendSize")
if err != nil {
valueStr, err := pt.Load("dataNode.grpc.clientMaxSendSize")
if err != nil { // not set
pt.ClientMaxSendSize = grpcconfigs.DefaultClientMaxSendSize
log.Debug("dataNode.grpc.clientMaxSendSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse dataNode.grpc.clientMaxSendSize, set to default",
zap.String("dataNode.grpc.clientMaxSendSize", valueStr),
zap.Error(err))
pt.ClientMaxSendSize = grpcconfigs.DefaultClientMaxSendSize
} else {
pt.ClientMaxSendSize = value
}
log.Debug("initClientMaxSendSize",
zap.Int("dataNode.grpc.clientMaxSendSize", pt.ClientMaxSendSize))
}
func (pt *ParamTable) initClientMaxRecvSize() {
var err error
pt.ClientMaxRecvSize, err = pt.ParseIntWithErr("dataNode.grpc.clientMaxRecvSize")
if err != nil {
valueStr, err := pt.Load("dataNode.grpc.clientMaxRecvSize")
if err != nil { // not set
pt.ClientMaxRecvSize = grpcconfigs.DefaultClientMaxRecvSize
log.Debug("dataNode.grpc.clientMaxRecvSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse dataNode.grpc.clientMaxRecvSize, set to default",
zap.String("dataNode.grpc.clientMaxRecvSize", valueStr),
zap.Error(err))
pt.ClientMaxRecvSize = grpcconfigs.DefaultClientMaxRecvSize
} else {
pt.ClientMaxRecvSize = value
}
log.Debug("initClientMaxRecvSize",
zap.Int("dataNode.grpc.clientMaxRecvSize", pt.ClientMaxRecvSize))
}

View File

@ -13,6 +13,7 @@ package grpcdatanode
import (
"net"
"strconv"
"sync"
"github.com/milvus-io/milvus/internal/distributed/grpcconfigs"
@ -90,22 +91,46 @@ func (pt *ParamTable) initDataCoordAddress() {
func (pt *ParamTable) initServerMaxSendSize() {
var err error
pt.ServerMaxSendSize, err = pt.ParseIntWithErr("dataNode.grpc.serverMaxSendSize")
if err != nil {
valueStr, err := pt.Load("dataNode.grpc.serverMaxSendSize")
if err != nil { // not set
pt.ServerMaxSendSize = grpcconfigs.DefaultServerMaxSendSize
log.Debug("dataNode.grpc.serverMaxSendSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse dataNode.grpc.serverMaxSendSize, set to default",
zap.String("dataNode.grpc.serverMaxSendSize", valueStr),
zap.Error(err))
pt.ServerMaxSendSize = grpcconfigs.DefaultServerMaxSendSize
} else {
pt.ServerMaxSendSize = value
}
log.Debug("initServerMaxSendSize",
zap.Int("dataNode.grpc.serverMaxSendSize", pt.ServerMaxSendSize))
}
func (pt *ParamTable) initServerMaxRecvSize() {
var err error
pt.ServerMaxRecvSize, err = pt.ParseIntWithErr("dataNode.grpc.serverMaxRecvSize")
if err != nil {
valueStr, err := pt.Load("dataNode.grpc.serverMaxRecvSize")
if err != nil { // not set
pt.ServerMaxRecvSize = grpcconfigs.DefaultServerMaxRecvSize
log.Debug("dataNode.grpc.serverMaxRecvSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse dataNode.grpc.serverMaxRecvSize, set to default",
zap.String("dataNode.grpc.serverMaxRecvSize", valueStr),
zap.Error(err))
pt.ServerMaxRecvSize = grpcconfigs.DefaultServerMaxRecvSize
} else {
pt.ServerMaxRecvSize = value
}
log.Debug("initServerMaxRecvSize",
zap.Int("dataNode.grpc.serverMaxRecvSize", pt.ServerMaxRecvSize))
}

View File

@ -12,6 +12,7 @@
package grpcindexcoordclient
import (
"strconv"
"sync"
"github.com/milvus-io/milvus/internal/distributed/grpcconfigs"
@ -42,22 +43,46 @@ func (pt *ParamTable) Init() {
func (pt *ParamTable) initClientMaxSendSize() {
var err error
pt.ClientMaxSendSize, err = pt.ParseIntWithErr("indexCoord.grpc.clientMaxSendSize")
if err != nil {
valueStr, err := pt.Load("indexCoord.grpc.clientMaxSendSize")
if err != nil { // not set
pt.ClientMaxSendSize = grpcconfigs.DefaultClientMaxSendSize
log.Debug("indexCoord.grpc.clientMaxSendSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse indexCoord.grpc.clientMaxSendSize, set to default",
zap.String("indexCoord.grpc.clientMaxSendSize", valueStr),
zap.Error(err))
pt.ClientMaxSendSize = grpcconfigs.DefaultClientMaxSendSize
} else {
pt.ClientMaxSendSize = value
}
log.Debug("initClientMaxSendSize",
zap.Int("indexCoord.grpc.clientMaxSendSize", pt.ClientMaxSendSize))
}
func (pt *ParamTable) initClientMaxRecvSize() {
var err error
pt.ClientMaxRecvSize, err = pt.ParseIntWithErr("indexCoord.grpc.clientMaxRecvSize")
if err != nil {
valueStr, err := pt.Load("indexCoord.grpc.clientMaxRecvSize")
if err != nil { // not set
pt.ClientMaxRecvSize = grpcconfigs.DefaultClientMaxRecvSize
log.Debug("indexCoord.grpc.clientMaxRecvSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse indexCoord.grpc.clientMaxRecvSize, set to default",
zap.String("indexCoord.grpc.clientMaxRecvSize", valueStr),
zap.Error(err))
pt.ClientMaxRecvSize = grpcconfigs.DefaultClientMaxRecvSize
} else {
pt.ClientMaxRecvSize = value
}
log.Debug("initClientMaxRecvSize",
zap.Int("indexCoord.grpc.clientMaxRecvSize", pt.ClientMaxRecvSize))
}

View File

@ -12,6 +12,7 @@
package grpcindexcoord
import (
"strconv"
"sync"
"github.com/milvus-io/milvus/internal/distributed/grpcconfigs"
@ -63,22 +64,46 @@ func (pt *ParamTable) initServiceAddress() {
func (pt *ParamTable) initServerMaxSendSize() {
var err error
pt.ServerMaxSendSize, err = pt.ParseIntWithErr("indexCoord.grpc.serverMaxSendSize")
if err != nil {
valueStr, err := pt.Load("indexCoord.grpc.serverMaxSendSize")
if err != nil { // not set
pt.ServerMaxSendSize = grpcconfigs.DefaultServerMaxSendSize
log.Debug("indexCoord.grpc.serverMaxSendSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse indexCoord.grpc.serverMaxSendSize, set to default",
zap.String("indexCoord.grpc.serverMaxSendSize", valueStr),
zap.Error(err))
pt.ServerMaxSendSize = grpcconfigs.DefaultServerMaxSendSize
} else {
pt.ServerMaxSendSize = value
}
log.Debug("initServerMaxSendSize",
zap.Int("indexCoord.grpc.serverMaxSendSize", pt.ServerMaxSendSize))
}
func (pt *ParamTable) initServerMaxRecvSize() {
var err error
pt.ServerMaxRecvSize, err = pt.ParseIntWithErr("indexCoord.grpc.serverMaxRecvSize")
if err != nil {
valueStr, err := pt.Load("indexCoord.grpc.serverMaxRecvSize")
if err != nil { // not set
pt.ServerMaxRecvSize = grpcconfigs.DefaultServerMaxRecvSize
log.Debug("indexCoord.grpc.serverMaxRecvSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse indexCoord.grpc.serverMaxRecvSize, set to default",
zap.String("indexCoord.grpc.serverMaxRecvSize", valueStr),
zap.Error(err))
pt.ServerMaxRecvSize = grpcconfigs.DefaultServerMaxRecvSize
} else {
pt.ServerMaxRecvSize = value
}
log.Debug("initServerMaxRecvSize",
zap.Int("indexCoord.grpc.serverMaxRecvSize", pt.ServerMaxRecvSize))
}

View File

@ -12,6 +12,7 @@
package grpcindexnodeclient
import (
"strconv"
"sync"
"github.com/milvus-io/milvus/internal/distributed/grpcconfigs"
@ -42,22 +43,46 @@ func (pt *ParamTable) Init() {
func (pt *ParamTable) initClientMaxSendSize() {
var err error
pt.ClientMaxSendSize, err = pt.ParseIntWithErr("indexNode.grpc.clientMaxSendSize")
if err != nil {
valueStr, err := pt.Load("indexNode.grpc.clientMaxSendSize")
if err != nil { // not set
pt.ClientMaxSendSize = grpcconfigs.DefaultClientMaxSendSize
log.Debug("indexNode.grpc.clientMaxSendSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse indexNode.grpc.clientMaxSendSize, set to default",
zap.String("indexNode.grpc.clientMaxSendSize", valueStr),
zap.Error(err))
pt.ClientMaxSendSize = grpcconfigs.DefaultClientMaxSendSize
} else {
pt.ClientMaxSendSize = value
}
log.Debug("initClientMaxSendSize",
zap.Int("indexNode.grpc.clientMaxSendSize", pt.ClientMaxSendSize))
}
func (pt *ParamTable) initClientMaxRecvSize() {
var err error
pt.ClientMaxRecvSize, err = pt.ParseIntWithErr("indexNode.grpc.clientMaxRecvSize")
if err != nil {
valueStr, err := pt.Load("indexNode.grpc.clientMaxRecvSize")
if err != nil { // not set
pt.ClientMaxRecvSize = grpcconfigs.DefaultClientMaxRecvSize
log.Debug("indexNode.grpc.clientMaxRecvSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse indexNode.grpc.clientMaxRecvSize, set to default",
zap.String("indexNode.grpc.clientMaxRecvSize", valueStr),
zap.Error(err))
pt.ClientMaxRecvSize = grpcconfigs.DefaultClientMaxRecvSize
} else {
pt.ClientMaxRecvSize = value
}
log.Debug("initClientMaxRecvSize",
zap.Int("indexNode.grpc.clientMaxRecvSize", pt.ClientMaxRecvSize))
}

View File

@ -12,6 +12,7 @@
package grpcindexnode
import (
"strconv"
"sync"
"github.com/milvus-io/milvus/internal/distributed/grpcconfigs"
@ -77,22 +78,46 @@ func (pt *ParamTable) initPort() {
func (pt *ParamTable) initServerMaxSendSize() {
var err error
pt.ServerMaxSendSize, err = pt.ParseIntWithErr("indexNode.grpc.serverMaxSendSize")
if err != nil {
valueStr, err := pt.Load("indexNode.grpc.serverMaxSendSize")
if err != nil { // not set
pt.ServerMaxSendSize = grpcconfigs.DefaultServerMaxSendSize
log.Debug("indexNode.grpc.serverMaxSendSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse indexNode.grpc.serverMaxSendSize, set to default",
zap.String("indexNode.grpc.serverMaxSendSize", valueStr),
zap.Error(err))
pt.ServerMaxSendSize = grpcconfigs.DefaultServerMaxSendSize
} else {
pt.ServerMaxSendSize = value
}
log.Debug("initServerMaxSendSize",
zap.Int("indexNode.grpc.serverMaxSendSize", pt.ServerMaxSendSize))
}
func (pt *ParamTable) initServerMaxRecvSize() {
var err error
pt.ServerMaxRecvSize, err = pt.ParseIntWithErr("indexNode.grpc.serverMaxRecvSize")
if err != nil {
valueStr, err := pt.Load("indexNode.grpc.serverMaxRecvSize")
if err != nil { // not set
pt.ServerMaxRecvSize = grpcconfigs.DefaultServerMaxRecvSize
log.Debug("indexNode.grpc.serverMaxRecvSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse indexNode.grpc.serverMaxRecvSize, set to default",
zap.String("indexNode.grpc.serverMaxRecvSize", valueStr),
zap.Error(err))
pt.ServerMaxRecvSize = grpcconfigs.DefaultServerMaxRecvSize
} else {
pt.ServerMaxRecvSize = value
}
log.Debug("initServerMaxRecvSize",
zap.Int("indexNode.grpc.serverMaxRecvSize", pt.ServerMaxRecvSize))
}

View File

@ -12,6 +12,7 @@
package grpcproxyclient
import (
"strconv"
"sync"
"github.com/milvus-io/milvus/internal/distributed/grpcconfigs"
@ -42,22 +43,46 @@ func (pt *ParamTable) Init() {
func (pt *ParamTable) initClientMaxSendSize() {
var err error
pt.ClientMaxSendSize, err = pt.ParseIntWithErr("proxy.grpc.clientMaxSendSize")
if err != nil {
valueStr, err := pt.Load("proxy.grpc.clientMaxSendSize")
if err != nil { // not set
pt.ClientMaxSendSize = grpcconfigs.DefaultClientMaxSendSize
log.Debug("proxy.grpc.clientMaxSendSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse proxy.grpc.clientMaxSendSize, set to default",
zap.String("proxy.grpc.clientMaxSendSize", valueStr),
zap.Error(err))
pt.ClientMaxSendSize = grpcconfigs.DefaultClientMaxSendSize
} else {
pt.ClientMaxSendSize = value
}
log.Debug("initClientMaxSendSize",
zap.Int("proxy.grpc.clientMaxSendSize", pt.ClientMaxSendSize))
}
func (pt *ParamTable) initClientMaxRecvSize() {
var err error
pt.ClientMaxRecvSize, err = pt.ParseIntWithErr("proxy.grpc.clientMaxRecvSize")
if err != nil {
valueStr, err := pt.Load("proxy.grpc.clientMaxRecvSize")
if err != nil { // not set
pt.ClientMaxRecvSize = grpcconfigs.DefaultClientMaxRecvSize
log.Debug("proxy.grpc.clientMaxRecvSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse proxy.grpc.clientMaxRecvSize, set to default",
zap.String("proxy.grpc.clientMaxRecvSize", valueStr),
zap.Error(err))
pt.ClientMaxRecvSize = grpcconfigs.DefaultClientMaxRecvSize
} else {
pt.ClientMaxRecvSize = value
}
log.Debug("initClientMaxRecvSize",
zap.Int("proxy.grpc.clientMaxRecvSize", pt.ClientMaxRecvSize))
}

View File

@ -12,6 +12,7 @@
package grpcproxy
import (
"strconv"
"sync"
"github.com/milvus-io/milvus/internal/distributed/grpcconfigs"
@ -110,22 +111,46 @@ func (pt *ParamTable) initPort() {
func (pt *ParamTable) initServerMaxSendSize() {
var err error
pt.ServerMaxSendSize, err = pt.ParseIntWithErr("proxy.grpc.serverMaxSendSize")
if err != nil {
valueStr, err := pt.Load("proxy.grpc.serverMaxSendSize")
if err != nil { // not set
pt.ServerMaxSendSize = grpcconfigs.DefaultServerMaxSendSize
log.Debug("proxy.grpc.serverMaxSendSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse proxy.grpc.serverMaxSendSize, set to default",
zap.String("proxy.grpc.serverMaxSendSize", valueStr),
zap.Error(err))
pt.ServerMaxSendSize = grpcconfigs.DefaultServerMaxSendSize
} else {
pt.ServerMaxSendSize = value
}
log.Debug("initServerMaxSendSize",
zap.Int("proxy.grpc.serverMaxSendSize", pt.ServerMaxSendSize))
}
func (pt *ParamTable) initServerMaxRecvSize() {
var err error
pt.ServerMaxRecvSize, err = pt.ParseIntWithErr("proxy.grpc.serverMaxRecvSize")
if err != nil {
valueStr, err := pt.Load("proxy.grpc.serverMaxRecvSize")
if err != nil { // not set
pt.ServerMaxRecvSize = grpcconfigs.DefaultServerMaxRecvSize
log.Debug("proxy.grpc.serverMaxRecvSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse proxy.grpc.serverMaxRecvSize, set to default",
zap.String("proxy.grpc.serverMaxRecvSize", valueStr),
zap.Error(err))
pt.ServerMaxRecvSize = grpcconfigs.DefaultServerMaxRecvSize
} else {
pt.ServerMaxRecvSize = value
}
log.Debug("initServerMaxRecvSize",
zap.Int("proxy.grpc.serverMaxRecvSize", pt.ServerMaxRecvSize))
}

View File

@ -12,6 +12,7 @@
package grpcquerycoordclient
import (
"strconv"
"sync"
"github.com/milvus-io/milvus/internal/distributed/grpcconfigs"
@ -42,22 +43,46 @@ func (pt *ParamTable) Init() {
func (pt *ParamTable) initClientMaxSendSize() {
var err error
pt.ClientMaxSendSize, err = pt.ParseIntWithErr("queryCoord.grpc.clientMaxSendSize")
if err != nil {
valueStr, err := pt.Load("queryCoord.grpc.clientMaxSendSize")
if err != nil { // not set
pt.ClientMaxSendSize = grpcconfigs.DefaultClientMaxSendSize
log.Debug("queryCoord.grpc.clientMaxSendSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse queryCoord.grpc.clientMaxSendSize, set to default",
zap.String("queryCoord.grpc.clientMaxSendSize", valueStr),
zap.Error(err))
pt.ClientMaxSendSize = grpcconfigs.DefaultClientMaxSendSize
} else {
pt.ClientMaxSendSize = value
}
log.Debug("initClientMaxSendSize",
zap.Int("queryCoord.grpc.clientMaxSendSize", pt.ClientMaxSendSize))
}
func (pt *ParamTable) initClientMaxRecvSize() {
var err error
pt.ClientMaxRecvSize, err = pt.ParseIntWithErr("queryCoord.grpc.clientMaxRecvSize")
if err != nil {
valueStr, err := pt.Load("queryCoord.grpc.clientMaxRecvSize")
if err != nil { // not set
pt.ClientMaxRecvSize = grpcconfigs.DefaultClientMaxRecvSize
log.Debug("queryCoord.grpc.clientMaxRecvSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse queryCoord.grpc.clientMaxRecvSize, set to default",
zap.String("queryCoord.grpc.clientMaxRecvSize", valueStr),
zap.Error(err))
pt.ClientMaxRecvSize = grpcconfigs.DefaultClientMaxRecvSize
} else {
pt.ClientMaxRecvSize = value
}
log.Debug("initClientMaxRecvSize",
zap.Int("queryCoord.grpc.clientMaxRecvSize", pt.ClientMaxRecvSize))
}

View File

@ -12,6 +12,7 @@
package grpcquerycoord
import (
"strconv"
"sync"
"github.com/milvus-io/milvus/internal/distributed/grpcconfigs"
@ -69,22 +70,46 @@ func (pt *ParamTable) initPort() {
func (pt *ParamTable) initServerMaxSendSize() {
var err error
pt.ServerMaxSendSize, err = pt.ParseIntWithErr("queryCoord.grpc.serverMaxSendSize")
if err != nil {
valueStr, err := pt.Load("queryCoord.grpc.serverMaxSendSize")
if err != nil { // not set
pt.ServerMaxSendSize = grpcconfigs.DefaultServerMaxSendSize
log.Debug("queryCoord.grpc.serverMaxSendSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse queryCoord.grpc.serverMaxSendSize, set to default",
zap.String("queryCoord.grpc.serverMaxSendSize", valueStr),
zap.Error(err))
pt.ServerMaxSendSize = grpcconfigs.DefaultServerMaxSendSize
} else {
pt.ServerMaxSendSize = value
}
log.Debug("initServerMaxSendSize",
zap.Int("queryCoord.grpc.serverMaxSendSize", pt.ServerMaxSendSize))
}
func (pt *ParamTable) initServerMaxRecvSize() {
var err error
pt.ServerMaxRecvSize, err = pt.ParseIntWithErr("queryCoord.grpc.serverMaxRecvSize")
if err != nil {
valueStr, err := pt.Load("queryCoord.grpc.serverMaxRecvSize")
if err != nil { // not set
pt.ServerMaxRecvSize = grpcconfigs.DefaultServerMaxRecvSize
log.Debug("queryCoord.grpc.serverMaxRecvSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse queryCoord.grpc.serverMaxRecvSize, set to default",
zap.String("queryCoord.grpc.serverMaxRecvSize", valueStr),
zap.Error(err))
pt.ServerMaxRecvSize = grpcconfigs.DefaultServerMaxRecvSize
} else {
pt.ServerMaxRecvSize = value
}
log.Debug("initServerMaxRecvSize",
zap.Int("queryCoord.grpc.serverMaxRecvSize", pt.ServerMaxRecvSize))
}

View File

@ -12,6 +12,7 @@
package grpcquerynodeclient
import (
"strconv"
"sync"
"github.com/milvus-io/milvus/internal/distributed/grpcconfigs"
@ -42,22 +43,46 @@ func (pt *ParamTable) Init() {
func (pt *ParamTable) initClientMaxSendSize() {
var err error
pt.ClientMaxSendSize, err = pt.ParseIntWithErr("queryNode.grpc.clientMaxSendSize")
if err != nil {
valueStr, err := pt.Load("queryNode.grpc.clientMaxSendSize")
if err != nil { // not set
pt.ClientMaxSendSize = grpcconfigs.DefaultClientMaxSendSize
log.Debug("queryNode.grpc.clientMaxSendSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse queryNode.grpc.clientMaxSendSize, set to default",
zap.String("queryNode.grpc.clientMaxSendSize", valueStr),
zap.Error(err))
pt.ClientMaxSendSize = grpcconfigs.DefaultClientMaxSendSize
} else {
pt.ClientMaxSendSize = value
}
log.Debug("initClientMaxSendSize",
zap.Int("queryNode.grpc.clientMaxSendSize", pt.ClientMaxSendSize))
}
func (pt *ParamTable) initClientMaxRecvSize() {
var err error
pt.ClientMaxRecvSize, err = pt.ParseIntWithErr("queryNode.grpc.clientMaxRecvSize")
if err != nil {
valueStr, err := pt.Load("queryNode.grpc.clientMaxRecvSize")
if err != nil { // not set
pt.ClientMaxRecvSize = grpcconfigs.DefaultClientMaxRecvSize
log.Debug("queryNode.grpc.clientMaxRecvSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse queryNode.grpc.clientMaxRecvSize, set to default",
zap.String("queryNode.grpc.clientMaxRecvSize", valueStr),
zap.Error(err))
pt.ClientMaxRecvSize = grpcconfigs.DefaultClientMaxRecvSize
} else {
pt.ClientMaxRecvSize = value
}
log.Debug("initClientMaxRecvSize",
zap.Int("queryNode.grpc.clientMaxRecvSize", pt.ClientMaxRecvSize))
}

View File

@ -12,6 +12,7 @@
package grpcquerynode
import (
"strconv"
"sync"
"github.com/milvus-io/milvus/internal/distributed/grpcconfigs"
@ -102,22 +103,46 @@ func (pt *ParamTable) initPort() {
func (pt *ParamTable) initServerMaxSendSize() {
var err error
pt.ServerMaxSendSize, err = pt.ParseIntWithErr("queryNode.grpc.serverMaxSendSize")
if err != nil {
valueStr, err := pt.Load("queryNode.grpc.serverMaxSendSize")
if err != nil { // not set
pt.ServerMaxSendSize = grpcconfigs.DefaultServerMaxSendSize
log.Debug("queryNode.grpc.serverMaxSendSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse queryNode.grpc.serverMaxSendSize, set to default",
zap.String("queryNode.grpc.serverMaxSendSize", valueStr),
zap.Error(err))
pt.ServerMaxSendSize = grpcconfigs.DefaultServerMaxSendSize
} else {
pt.ServerMaxSendSize = value
}
log.Debug("initServerMaxSendSize",
zap.Int("queryNode.grpc.serverMaxSendSize", pt.ServerMaxSendSize))
}
func (pt *ParamTable) initServerMaxRecvSize() {
var err error
pt.ServerMaxRecvSize, err = pt.ParseIntWithErr("queryNode.grpc.serverMaxRecvSize")
if err != nil {
valueStr, err := pt.Load("queryNode.grpc.serverMaxRecvSize")
if err != nil { // not set
pt.ServerMaxRecvSize = grpcconfigs.DefaultServerMaxRecvSize
log.Debug("queryNode.grpc.serverMaxRecvSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse queryNode.grpc.serverMaxRecvSize, set to default",
zap.String("queryNode.grpc.serverMaxRecvSize", valueStr),
zap.Error(err))
pt.ServerMaxRecvSize = grpcconfigs.DefaultServerMaxRecvSize
} else {
pt.ServerMaxRecvSize = value
}
log.Debug("initServerMaxRecvSize",
zap.Int("queryNode.grpc.serverMaxRecvSize", pt.ServerMaxRecvSize))
}

View File

@ -12,6 +12,7 @@
package grpcrootcoordclient
import (
"strconv"
"sync"
"github.com/milvus-io/milvus/internal/distributed/grpcconfigs"
@ -42,22 +43,46 @@ func (pt *ParamTable) Init() {
func (pt *ParamTable) initClientMaxSendSize() {
var err error
pt.ClientMaxSendSize, err = pt.ParseIntWithErr("rootCoord.grpc.clientMaxSendSize")
if err != nil {
valueStr, err := pt.Load("rootCoord.grpc.clientMaxSendSize")
if err != nil { // not set
pt.ClientMaxSendSize = grpcconfigs.DefaultClientMaxSendSize
log.Debug("rootCoord.grpc.clientMaxSendSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse rootCoord.grpc.clientMaxSendSize, set to default",
zap.String("rootCoord.grpc.clientMaxSendSize", valueStr),
zap.Error(err))
pt.ClientMaxSendSize = grpcconfigs.DefaultClientMaxSendSize
} else {
pt.ClientMaxSendSize = value
}
log.Debug("initClientMaxSendSize",
zap.Int("rootCoord.grpc.clientMaxSendSize", pt.ClientMaxSendSize))
}
func (pt *ParamTable) initClientMaxRecvSize() {
var err error
pt.ClientMaxRecvSize, err = pt.ParseIntWithErr("rootCoord.grpc.clientMaxRecvSize")
if err != nil {
valueStr, err := pt.Load("rootCoord.grpc.clientMaxRecvSize")
if err != nil { // not set
pt.ClientMaxRecvSize = grpcconfigs.DefaultClientMaxRecvSize
log.Debug("rootCoord.grpc.clientMaxRecvSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse rootCoord.grpc.clientMaxRecvSize, set to default",
zap.String("rootCoord.grpc.clientMaxRecvSize", valueStr),
zap.Error(err))
pt.ClientMaxRecvSize = grpcconfigs.DefaultClientMaxRecvSize
} else {
pt.ClientMaxRecvSize = value
}
log.Debug("initClientMaxRecvSize",
zap.Int("rootCoord.grpc.clientMaxRecvSize", pt.ClientMaxRecvSize))
}

View File

@ -12,6 +12,7 @@
package grpcrootcoord
import (
"strconv"
"sync"
"github.com/milvus-io/milvus/internal/distributed/grpcconfigs"
@ -94,22 +95,46 @@ func (p *ParamTable) initDataCoordAddress() {
func (p *ParamTable) initServerMaxSendSize() {
var err error
p.ServerMaxSendSize, err = p.ParseIntWithErr("rootCoord.grpc.serverMaxSendSize")
if err != nil {
valueStr, err := p.Load("rootCoord.grpc.serverMaxSendSize")
if err != nil { // not set
p.ServerMaxSendSize = grpcconfigs.DefaultServerMaxSendSize
log.Debug("rootCoord.grpc.serverMaxSendSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse rootCoord.grpc.serverMaxSendSize, set to default",
zap.String("rootCoord.grpc.serverMaxSendSize", valueStr),
zap.Error(err))
p.ServerMaxSendSize = grpcconfigs.DefaultServerMaxSendSize
} else {
p.ServerMaxSendSize = value
}
log.Debug("initServerMaxSendSize",
zap.Int("rootCoord.grpc.serverMaxSendSize", p.ServerMaxSendSize))
}
func (p *ParamTable) initServerMaxRecvSize() {
var err error
p.ServerMaxRecvSize, err = p.ParseIntWithErr("rootCoord.grpc.serverMaxRecvSize")
if err != nil {
valueStr, err := p.Load("rootCoord.grpc.serverMaxRecvSize")
if err != nil { // not set
p.ServerMaxRecvSize = grpcconfigs.DefaultServerMaxRecvSize
log.Debug("rootCoord.grpc.serverMaxRecvSize not set, set to default")
}
value, err := strconv.Atoi(valueStr)
if err != nil { // not in valid format
log.Warn("Failed to parse rootCoord.grpc.serverMaxRecvSize, set to default",
zap.String("rootCoord.grpc.serverMaxRecvSize", valueStr),
zap.Error(err))
p.ServerMaxRecvSize = grpcconfigs.DefaultServerMaxRecvSize
} else {
p.ServerMaxRecvSize = value
}
log.Debug("initServerMaxRecvSize",
zap.Int("rootCoord.grpc.serverMaxRecvSize", p.ServerMaxRecvSize))
}

View File

@ -316,18 +316,6 @@ func (gp *BaseTable) ParseInt(key string) int {
return value
}
func (gp *BaseTable) ParseIntWithErr(key string) (int, error) {
valueStr, err := gp.Load(key)
if err != nil {
return 0, err
}
value, err := strconv.Atoi(valueStr)
if err != nil {
return 0, err
}
return value, nil
}
// package methods
func ConvertRangeToIntRange(rangeStr, sep string) []int {

View File

@ -111,20 +111,3 @@ func TestGlobalParamsTable_LoadYaml(t *testing.T) {
_, err = baseParams.Load("pulsar.port")
assert.Nil(t, err)
}
func TestBaseTable_ParseIntWithErr(t *testing.T) {
var err error
key1 := "ParseIntWithErrInt"
err = baseParams.Save(key1, "10")
assert.Nil(t, err)
ten, err := baseParams.ParseIntWithErr(key1)
assert.Nil(t, err)
assert.Equal(t, 10, ten)
key2 := "ParseIntWithErrInvalidInt"
err = baseParams.Save(key2, "invalid")
assert.Nil(t, err)
_, err = baseParams.ParseIntWithErr(key2)
assert.NotNil(t, err)
}