Skip to content

Commit

Permalink
Merge 3217dd4 into 851e6d6
Browse files Browse the repository at this point in the history
  • Loading branch information
rinx authored Mar 16, 2021
2 parents 851e6d6 + 3217dd4 commit 769061e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
20 changes: 10 additions & 10 deletions internal/db/rdb/mysql/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func (m *mySQLClient) Open(ctx context.Context) (err error) {
func (m *mySQLClient) Ping(ctx context.Context) (err error) {
if m.session == nil {
err = errors.ErrMySQLSessionNil
m.outputLog(err)
m.errorLog(err)
return err
}
pctx, cancel := context.WithTimeout(ctx, m.initialPingTimeLimit)
Expand Down Expand Up @@ -183,7 +183,7 @@ func (m *mySQLClient) Ping(ctx context.Context) (err error) {
func (m *mySQLClient) Close(ctx context.Context) (err error) {
if m.session == nil {
err = errors.ErrMySQLSessionNil
m.outputLog(err)
m.errorLog(err)
m.connected.Store(false)
return err
}
Expand All @@ -205,7 +205,7 @@ func (m *mySQLClient) GetVector(ctx context.Context, uuid string) (Vector, error

if m.session == nil {
err := errors.ErrMySQLSessionNil
m.outputLog(err)
m.errorLog(err)
return nil, err
}

Expand Down Expand Up @@ -238,7 +238,7 @@ func (m *mySQLClient) GetIPs(ctx context.Context, uuid string) ([]string, error)

if m.session == nil {
err := errors.ErrMySQLSessionNil
m.outputLog(err)
m.errorLog(err)
return nil, err
}

Expand Down Expand Up @@ -281,7 +281,7 @@ func (m *mySQLClient) SetVector(ctx context.Context, vec Vector) error {

if m.session == nil {
err := errors.ErrMySQLSessionNil
m.outputLog(err)
m.errorLog(err)
return err
}

Expand Down Expand Up @@ -338,7 +338,7 @@ func (m *mySQLClient) SetVectors(ctx context.Context, vecs ...Vector) error {

if m.session == nil {
err := errors.ErrMySQLSessionNil
m.outputLog(err)
m.errorLog(err)
return err
}

Expand Down Expand Up @@ -398,7 +398,7 @@ func (m *mySQLClient) deleteVector(ctx context.Context, val string) error {

if m.session == nil {
err := errors.ErrMySQLSessionNil
m.outputLog(err)
m.errorLog(err)
return err
}

Expand Down Expand Up @@ -457,7 +457,7 @@ func (m *mySQLClient) SetIPs(ctx context.Context, uuid string, ips ...string) er

if m.session == nil {
err := errors.ErrMySQLSessionNil
m.outputLog(err)
m.errorLog(err)
return err
}

Expand Down Expand Up @@ -496,7 +496,7 @@ func (m *mySQLClient) RemoveIPs(ctx context.Context, ips ...string) error {

if m.session == nil {
err := errors.ErrMySQLSessionNil
m.outputLog(err)
m.errorLog(err)
return err
}

Expand All @@ -514,7 +514,7 @@ func (m *mySQLClient) RemoveIPs(ctx context.Context, ips ...string) error {
return tx.Commit()
}

func (m *mySQLClient) outputLog(err error) {
func (m *mySQLClient) errorLog(err error) {
log.Errorf(
"err: %v, { host: %s, port: %d, user: %s, name: %s, db: %s, charset: %s, socketPath: %s, network: %s} ",
err, m.host, m.port, m.user, m.name, m.db, m.charset, m.socketPath, m.network,
Expand Down
6 changes: 3 additions & 3 deletions pkg/gateway/lb/handler/grpc/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ func (s *server) SearchByID(ctx context.Context, req *payload.Search_IDRequest)
if serr == nil {
return res, nil
}
err = errors.Wrap(err, status.WrapWithInternal("SearchByID API failed to process search request", err,
err = errors.Wrap(err, status.WrapWithInternal("SearchByID API failed to process search request", serr,
&errdetails.RequestInfo{
RequestId: req.GetConfig().GetRequestId(),
ServingData: errdetails.Serialize(req),
Expand All @@ -252,11 +252,11 @@ func (s *server) SearchByID(ctx context.Context, req *payload.Search_IDRequest)
ResourceType: errdetails.ValdGRPCResourceTypePrefix + "/vald.v1.SearchByID",
ResourceName: strings.Join(s.gateway.Addrs(ctx), ", "),
Owner: errdetails.ValdResourceOwner,
Description: err.Error(),
Description: serr.Error(),
}).Error())
log.Error(err)
if span != nil {
span.SetStatus(trace.StatusCodeNotFound(err.Error()))
span.SetStatus(trace.StatusCodeInternal(err.Error()))
}
return nil, err
}
Expand Down

0 comments on commit 769061e

Please sign in to comment.