Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
reshke committed Apr 3, 2024
1 parent e1537a5 commit 191b7a8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docker/router/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ FROM spqr-base-image
RUN apt-get update && apt-get install -y postgresql-client
COPY ./docker/router/ssl/localhost.crt /etc/spqr/ssl/server.crt
COPY ./docker/router/ssl/localhost.key /etc/spqr/ssl/server.key
ENTRYPOINT CONFIG_PATH=${ROUTER_CONFIG=/spqr/docker/router/cfg.yaml} COORD_CONFIG_PATH=${COORDINATOR_CONFIG=/spqr/docker/coordinator/cfg.yaml} && CUR_HOST=$(cat ${CONFIG_PATH} | grep "host:") && sed -i "s/${CUR_HOST}/${ROUTER_HOST=${CUR_HOST}}/g" ${CONFIG_PATH} && /spqr/spqr-router run --config ${CONFIG_PATH} --coordinator-config ${COORD_CONFIG_PATH} --proto-debug
ENTRYPOINT CONFIG_PATH=${ROUTER_CONFIG=/spqr/docker/router/cfg.yaml} COORD_CONFIG_PATH=${COORDINATOR_CONFIG=/spqr/docker/coordinator/cfg.yaml} && CUR_HOST=$(cat ${CONFIG_PATH} | grep "host:") && sed -i "s/${CUR_HOST}/${ROUTER_HOST=${CUR_HOST}}/g" ${CONFIG_PATH} && /spqr/spqr-router run --config ${CONFIG_PATH} --coordinator-config ${COORD_CONFIG_PATH}
25 changes: 20 additions & 5 deletions router/instance/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package instance

import (
"context"
"time"

"github.com/pg-sharding/spqr/pkg/models/distributions"
"github.com/pg-sharding/spqr/pkg/models/kr"
Expand Down Expand Up @@ -47,11 +48,25 @@ func (e *EtcdMetadataBootstraper) InitializeMetadata(ctx context.Context, r Rout
}
}

c, err := etcdConn.GetCoordinator(ctx)
if err != nil {
return err
}
if err := r.Console().Mgr().UpdateCoordinator(ctx, c); err != nil {
retryCnt := 50

for {
c, err := etcdConn.GetCoordinator(ctx)
if err != nil {
if retryCnt > 0 {
/* await the roiter to appear */
time.Sleep(time.Second)
retryCnt--
continue
}
return err
}

err = r.Console().Mgr().UpdateCoordinator(ctx, c)

if err == nil {
break
}
return err
}

Expand Down
1 change: 1 addition & 0 deletions test/feature/conf/router_cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ admin_console_port: '7432'
grpc_api_port: '7000'
router_mode: PROXY
log_level: debug
log_filename: router.log
time_quantiles:
- 0.75
world_shard_fallback: true
Expand Down

0 comments on commit 191b7a8

Please sign in to comment.