Skip to content

Commit 642dbf1

Browse files
committed
Removed force flag
1 parent 3171999 commit 642dbf1

File tree

5 files changed

+12
-18
lines changed

5 files changed

+12
-18
lines changed

client/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ type API interface {
5151
Shutdown(ctx context.Context, goodbye bool) error
5252

5353
// StartDatabaseUpgrade is called to start the upgrade process
54-
StartDatabaseUpgrade(ctx context.Context, force bool) error
54+
StartDatabaseUpgrade(ctx context.Context) error
5555

5656
// RetryDatabaseUpgrade resets a failure mark in the existing upgrade plan
5757
// such that the starters will retry the upgrade once more.

client/client.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,8 @@ func (c *client) Shutdown(ctx context.Context, goodbye bool) error {
199199
}
200200

201201
// StartDatabaseUpgrade is called to start the upgrade process
202-
func (c *client) StartDatabaseUpgrade(ctx context.Context, force bool) error {
203-
q := url.Values{}
204-
if force {
205-
q.Set("force", "true")
206-
}
207-
url := c.createURL("/database-auto-upgrade", q)
202+
func (c *client) StartDatabaseUpgrade(ctx context.Context) error {
203+
url := c.createURL("/database-auto-upgrade", nil)
208204

209205
req, err := http.NewRequest("POST", url, nil)
210206
if err != nil {

service/server.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -617,11 +617,9 @@ func (s *httpServer) databaseAutoUpgradeHandler(w http.ResponseWriter, r *http.R
617617
switch r.Method {
618618
case "POST":
619619
// Start the upgrade process
620-
force, _ := strconv.ParseBool(r.FormValue("force"))
621-
622620
if isRunningMaster || mode.IsSingleMode() {
623621
// We're the starter leader, process the request
624-
if err := s.context.UpgradeManager().StartDatabaseUpgrade(ctx, force); err != nil {
622+
if err := s.context.UpgradeManager().StartDatabaseUpgrade(ctx); err != nil {
625623
handleError(w, err)
626624
} else {
627625
w.WriteHeader(http.StatusOK)
@@ -634,7 +632,7 @@ func (s *httpServer) databaseAutoUpgradeHandler(w http.ResponseWriter, r *http.R
634632
if err != nil {
635633
handleError(w, err)
636634
} else {
637-
if err := c.StartDatabaseUpgrade(ctx, force); err != nil {
635+
if err := c.StartDatabaseUpgrade(ctx); err != nil {
638636
s.log.Debug().Err(err).Msg("Forwarding StartDatabaseUpgrade failed")
639637
handleError(w, err)
640638
} else {

service/upgrade_manager.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import (
4242
// UpgradeManager is the API of a service used to control the upgrade process from 1 database version to the next.
4343
type UpgradeManager interface {
4444
// StartDatabaseUpgrade is called to start the upgrade process
45-
StartDatabaseUpgrade(ctx context.Context, force bool) error
45+
StartDatabaseUpgrade(ctx context.Context) error
4646

4747
// RetryDatabaseUpgrade resets a failure mark in the existing upgrade plan
4848
// such that the starters will retry the upgrade once more.
@@ -212,7 +212,7 @@ type upgradeManager struct {
212212
}
213213

214214
// StartDatabaseUpgrade is called to start the upgrade process
215-
func (m *upgradeManager) StartDatabaseUpgrade(ctx context.Context, force bool) error {
215+
func (m *upgradeManager) StartDatabaseUpgrade(ctx context.Context) error {
216216
m.mutex.Lock()
217217
defer m.mutex.Unlock()
218218

@@ -297,7 +297,7 @@ func (m *upgradeManager) StartDatabaseUpgrade(ctx context.Context, force bool) e
297297
}
298298

299299
// Check plan status
300-
if !plan.IsReady() && !force {
300+
if !plan.IsReady() {
301301
return maskAny(client.NewBadRequestError("Current upgrade plan has not finished yet"))
302302
}
303303

upgrade.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ func init() {
9090
}
9191

9292
func cmdUpgradeRun(cmd *cobra.Command, args []string) {
93-
runUpgrade(upgradeOptions.starterEndpoint, false, false)
93+
runUpgrade(upgradeOptions.starterEndpoint, false)
9494
}
9595

9696
func cmdRetryUpgradeRun(cmd *cobra.Command, args []string) {
97-
runUpgrade(retryUpgradeOptions.starterEndpoint, false, true)
97+
runUpgrade(retryUpgradeOptions.starterEndpoint, true)
9898
}
9999

100100
func cmdAbortUpgradeRun(cmd *cobra.Command, args []string) {
@@ -114,7 +114,7 @@ func cmdAbortUpgradeRun(cmd *cobra.Command, args []string) {
114114
}
115115
}
116116

117-
func runUpgrade(starterEndpoint string, force, retry bool) {
117+
func runUpgrade(starterEndpoint string, retry bool) {
118118
// Setup logging
119119
consoleOnly := true
120120
configureLogging(consoleOnly)
@@ -129,7 +129,7 @@ func runUpgrade(starterEndpoint string, force, retry bool) {
129129
}
130130
action = "restarted"
131131
} else {
132-
if err := c.StartDatabaseUpgrade(ctx, force); err != nil {
132+
if err := c.StartDatabaseUpgrade(ctx); err != nil {
133133
log.Fatal().Err(err).Msg("Failed to start database automatic upgrade")
134134
}
135135
action = "started"

0 commit comments

Comments
 (0)