Added some debug logging, ultimately not needed

This commit is contained in:
Brian Picciano 2022-11-16 17:25:55 +01:00
parent b498ee271d
commit 2181da14a1
2 changed files with 15 additions and 2 deletions

View File

@ -11,6 +11,7 @@ import (
"strconv"
"code.betamike.com/cryptic-io/pmux/pmuxlib"
"github.com/mediocregopher/mediocre-go-lib/v2/mctx"
"github.com/mediocregopher/mediocre-go-lib/v2/mlog"
)
@ -57,7 +58,7 @@ func waitForGarageAndNebula(
return nil
}
logger = garageAdminClientLogger(logger)
adminClientLogger := garageAdminClientLogger(logger)
for _, alloc := range allocs {
@ -69,9 +70,12 @@ func waitForGarageAndNebula(
adminClient := garage.NewAdminClient(
adminAddr,
hostBootstrap.Garage.AdminToken,
logger,
adminClientLogger,
)
ctx := mctx.Annotate(ctx, "garage-admin-addr", adminAddr)
logger.Debug(ctx, "wating for garage instance to start")
if err := adminClient.Wait(ctx); err != nil {
return fmt.Errorf("waiting for garage instance %q to start up: %w", adminAddr, err)
}

View File

@ -10,6 +10,7 @@ import (
"net/http/httputil"
"time"
"github.com/mediocregopher/mediocre-go-lib/v2/mctx"
"github.com/mediocregopher/mediocre-go-lib/v2/mlog"
)
@ -149,6 +150,7 @@ func (c *AdminClient) Wait(ctx context.Context) error {
return ctxErr
} else if err != nil {
c.logger.Warn(ctx, "waiting for instance to become ready", err)
continue
}
@ -160,9 +162,16 @@ func (c *AdminClient) Wait(ctx context.Context) error {
}
}
ctx := mctx.Annotate(ctx,
"num-known-nodes", len(clusterStatus.KnownNodes),
"num-up", numUp,
)
if numUp >= ReplicationFactor-1 {
c.logger.Debug(ctx, "instance appears to be online")
return nil
}
c.logger.Debug(ctx, "instance not online yet, will continue waiting")
}
}