From bead080d5e564206c23dcfbea3e6cf6f316e7f6c Mon Sep 17 00:00:00 2001 From: Hussein Galal Date: Tue, 30 Mar 2021 22:02:15 +0200 Subject: [PATCH] Fix bootstrap save (#3129) Signed-off-by: galal-hussein --- pkg/cluster/cluster.go | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/pkg/cluster/cluster.go b/pkg/cluster/cluster.go index d8ed8c4a3e..65eec7e14f 100644 --- a/pkg/cluster/cluster.go +++ b/pkg/cluster/cluster.go @@ -73,15 +73,25 @@ func (c *Cluster) Start(ctx context.Context) (<-chan struct{}, error) { return nil, errors.Wrap(err, "start managed database") } - // get the wait channel for testing managed database readiness ready, err := c.testClusterDB(ctx) if err != nil { - if c.shouldBootstrap { - if err := c.bootstrapped(); err != nil { - return nil, err - } + return nil, err + } + + // if necessary, store bootstrap data to datastore + if c.saveBootstrap { + if err := c.save(ctx); err != nil { + return nil, err } } + + // if necessary, record successful bootstrap + if c.shouldBootstrap { + if err := c.bootstrapped(); err != nil { + return nil, err + } + } + return ready, c.startStorage(ctx) }