Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: kpango <kpango@vdaas.org>
  • Loading branch information
kpango committed Feb 1, 2021
1 parent 24a9d97 commit f172b77
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Makefile.d/k8s.mk
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ k8s/external/redis/initialize:
## deploy cassandra to k8s
k8s/external/cassandra/deploy:
kubectl apply -f https://raw.githubusercontent.com/datastax/cass-operator/master/docs/user/cass-operator-manifests-$(K8S_SERVER_VERSION).yaml
sleep 2
sleep $(K8S_SLEEP_DURATION_FOR_WAIT_COMMAND)
kubectl apply -n cass-operator -f k8s/jobs/db/initialize/cassandra/secret.yaml
kubectl wait -n cass-operator --for=condition=ready pod -l name=cass-operator --timeout=600s
kubectl apply -f k8s/external/cassandra
Expand Down
12 changes: 5 additions & 7 deletions pkg/gateway/lb/handler/grpc/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,15 @@ func (s *server) Exists(ctx context.Context, meta *payload.Object_ID) (id *paylo
}
return nil
}
if oid != nil && oid.Id != "" {
if oid != nil && oid.GetId() != "" {
once.Do(func() {
id = &payload.Object_ID{
Id: oid.Id,
}
id = oid
cancel()
})
}
return nil
})
if err != nil || id == nil || id.Id == "" {
if err != nil || id == nil || id.GetId() == "" {
err = status.WrapWithNotFound(fmt.Sprintf("Exists API meta %s's uuid not found", meta.GetId()), err,
&errdetails.RequestInfo{
RequestId: meta.GetId(),
Expand Down Expand Up @@ -783,7 +781,8 @@ func (s *server) Insert(ctx context.Context, req *payload.Insert_Request) (ce *p
if span != nil {
span.SetStatus(trace.StatusCodeInternal(err.Error()))
}
if err == errors.ErrRPCCallFailed(target, context.Canceled) {
rpcerr := errors.ErrRPCCallFailed(target, context.Canceled)
if err == rpcerr || errors.Is(err, rpcerr) {
return nil
}
return err
Expand Down Expand Up @@ -1570,7 +1569,6 @@ func (s *server) Remove(ctx context.Context, req *payload.Remove_Request) (locs
}()
loc, err := vc.Remove(ctx, req, copts...)
if err != nil {
log.Debug(err)
if span != nil {
span.SetStatus(trace.StatusCodeInternal(err.Error()))
}
Expand Down
4 changes: 0 additions & 4 deletions pkg/gateway/lb/service/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"github.com/vdaas/vald/internal/client/v1/client/discoverer"
"github.com/vdaas/vald/internal/errgroup"
"github.com/vdaas/vald/internal/errors"
"github.com/vdaas/vald/internal/log"
"github.com/vdaas/vald/internal/net/grpc"
"github.com/vdaas/vald/internal/observability/trace"
)
Expand Down Expand Up @@ -76,7 +75,6 @@ func (g *gateway) BroadCast(ctx context.Context,
default:
err = f(ictx, addr, vald.NewValdClient(conn), copts...)
if err != nil {
log.Debug(addr, err)
return err
}
}
Expand All @@ -95,15 +93,13 @@ func (g *gateway) DoMulti(ctx context.Context, num int,
var cur uint32 = 0
limit := uint32(num)
addrs := g.client.GetAddrs(sctx)
log.Debug("DoMulti", addrs)
err = g.client.GetClient().OrderedRange(sctx, addrs, func(ictx context.Context,
addr string,
conn *grpc.ClientConn,
copts ...grpc.CallOption) (err error) {
if atomic.LoadUint32(&cur) < limit {
err = f(ictx, addr, vald.NewValdClient(conn), copts...)
if err != nil {
log.Debug(addr, err)
return err
}
atomic.AddUint32(&cur, 1)
Expand Down
26 changes: 26 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
podname=`kubectl get pods --selector=app=vald-lb-gateway | tail -1 | awk '{print $1}'`
NAME=TestE2EInsert
# NAME=TestE2ESearch
# NAME=TestE2EUpdate
# NAME=TestE2ERemove
go test \
-run ${NAME} \
-v tests/e2e/crud_test.go \
-tags "e2e" \
-timeout 15m \
-host=127.0.0.1 \
-port=8082 \
-dataset=${GOPATH}/src/github.com/vdaas/vald/hack/benchmark/assets/dataset/fashion-mnist-784-euclidean.hdf5 \
-insert-num=1000 \
-search-num=1000 \
-search-by-id-num=10 \
-get-object-num=10 \
-update-num=3 \
-remove-num=2 \
-wait-after-insert=2m \
-portforward \
-portforward-ns=default \
-portforward-pod-name=${podname} \
-portforward-pod-port=8081

# -run TestE2ERemove \

0 comments on commit f172b77

Please sign in to comment.