Skip to content

Commit 5402e05

Browse files
authored
[Bugfix] Special upgrade (#296)
1 parent 74b0760 commit 5402e05

File tree

4 files changed

+40
-19
lines changed

4 files changed

+40
-19
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# ArangoDB Starter Changelog
22

3+
## Changes from 0.14.13 to 0.15.0-1
4+
5+
- Do not run ResignLeadership when upgrading from <= 3.6.14 or
6+
3.7 with <= 3.7.13.
7+
38
## Changes from 0.14.12 to 0.14.13
49

510
- Fixed upgrade for active failover when there are nodes without single server.

pkg/definitions/server_type.go

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,15 @@ import (
3030
type ServerType string
3131

3232
const (
33-
ServerTypeUnknown = "unknown"
34-
ServerTypeCoordinator = "coordinator"
35-
ServerTypeDBServer = "dbserver"
36-
ServerTypeAgent = "agent"
37-
ServerTypeSingle = "single"
38-
ServerTypeResilientSingle = "resilientsingle"
39-
ServerTypeSyncMaster = "syncmaster"
40-
ServerTypeSyncWorker = "syncworker"
33+
ServerTypeUnknown = "unknown"
34+
ServerTypeCoordinator = "coordinator"
35+
ServerTypeDBServer = "dbserver"
36+
ServerTypeDBServerNoResign = "dbserver_noresign"
37+
ServerTypeAgent = "agent"
38+
ServerTypeSingle = "single"
39+
ServerTypeResilientSingle = "resilientsingle"
40+
ServerTypeSyncMaster = "syncmaster"
41+
ServerTypeSyncWorker = "syncworker"
4142
)
4243

4344
// String returns a string representation of the given ServerType.
@@ -50,7 +51,7 @@ func (s ServerType) PortOffset() int {
5051
switch s {
5152
case ServerTypeCoordinator, ServerTypeSingle, ServerTypeResilientSingle:
5253
return PortOffsetCoordinator
53-
case ServerTypeDBServer:
54+
case ServerTypeDBServer, ServerTypeDBServerNoResign:
5455
return PortOffsetDBServer
5556
case ServerTypeAgent:
5657
return PortOffsetAgent
@@ -82,7 +83,7 @@ func (s ServerType) ExpectedServerRole() (string, string) {
8283
return "SINGLE", ""
8384
case ServerTypeResilientSingle:
8485
return "SINGLE", "resilient"
85-
case ServerTypeDBServer:
86+
case ServerTypeDBServer, ServerTypeDBServerNoResign:
8687
return "PRIMARY", ""
8788
case ServerTypeAgent:
8889
return "AGENT", ""
@@ -98,7 +99,7 @@ func (s ServerType) GetName() string {
9899
switch s {
99100
case ServerTypeAgent:
100101
return "agent"
101-
case ServerTypeDBServer:
102+
case ServerTypeDBServer, ServerTypeDBServerNoResign:
102103
return "dbserver"
103104
case ServerTypeCoordinator:
104105
return "coordinator"
@@ -117,6 +118,7 @@ func AllServerTypes() []ServerType {
117118
return []ServerType{
118119
ServerTypeCoordinator,
119120
ServerTypeDBServer,
121+
ServerTypeDBServerNoResign,
120122
ServerTypeAgent,
121123
ServerTypeSingle,
122124
ServerTypeResilientSingle,

service/runtime_server_manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ func (s *runtimeServerManager) RestartServer(log zerolog.Logger, serverType defi
511511
switch serverType {
512512
case definitions.ServerTypeAgent:
513513
p = s.agentProc.Process()
514-
case definitions.ServerTypeDBServer:
514+
case definitions.ServerTypeDBServer, definitions.ServerTypeDBServerNoResign:
515515
p = s.dbserverProc.Process()
516516
case definitions.ServerTypeCoordinator:
517517
p = s.coordinatorProc.Process()

service/upgrade_manager.go

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,11 @@ const (
171171
// UpgradePlanEntry is the JSON structure that describes a single entry
172172
// in an upgrade plan.
173173
type UpgradePlanEntry struct {
174-
PeerID string `json:"peer_id"`
175-
Type UpgradeEntryType `json:"type"`
176-
Failures int `json:"failures,omitempty"`
177-
Reason string `json:"reason,omitempty"`
174+
PeerID string `json:"peer_id"`
175+
Type UpgradeEntryType `json:"type"`
176+
Failures int `json:"failures,omitempty"`
177+
Reason string `json:"reason,omitempty"`
178+
WithoutResign bool `json:"withoutResign,omitempty"`
178179
}
179180

180181
// CreateStatusServer creates a UpgradeStatusServer for the given entry.
@@ -255,6 +256,7 @@ func (m *upgradeManager) StartDatabaseUpgrade(ctx context.Context, forceMinorUpg
255256

256257
// Check if we can upgrade from running to binary versions
257258
specialUpgradeFrom346 := false
259+
specialUpgradeFrom3614 := false
258260
rules := upgraderules.CheckUpgradeRules
259261
if forceMinorUpgrade {
260262
rules = upgraderules.CheckSoftUpgradeRules
@@ -267,6 +269,14 @@ func (m *upgradeManager) StartDatabaseUpgrade(ctx context.Context, forceMinorUpg
267269
if from.CompareTo("3.4.6") == 0 {
268270
specialUpgradeFrom346 = true
269271
}
272+
subint, found := from.SubInt()
273+
if !found {
274+
subint = 0
275+
}
276+
if (from.Major() == 3 && from.Minor() <= 6 && subint <= 14) ||
277+
(from.Major() == 3 && from.Minor() == 7 && subint <= 12) {
278+
specialUpgradeFrom3614 = true
279+
}
270280
}
271281

272282
// Fetch mode
@@ -403,8 +413,9 @@ func (m *upgradeManager) StartDatabaseUpgrade(ctx context.Context, forceMinorUpg
403413
for _, p := range config.AllPeers {
404414
if p.HasDBServer() {
405415
plan.Entries = append(plan.Entries, UpgradePlanEntry{
406-
Type: UpgradeEntryTypeDBServer,
407-
PeerID: p.ID,
416+
Type: UpgradeEntryTypeDBServer,
417+
PeerID: p.ID,
418+
WithoutResign: specialUpgradeFrom3614,
408419
})
409420
}
410421
}
@@ -993,7 +1004,10 @@ func (m *upgradeManager) processUpgradePlan(ctx context.Context, plan UpgradePla
9931004
m.upgradeServerType = definitions.ServerTypeDBServer
9941005
m.updateNeeded = true
9951006
upgrade := func() error {
996-
if err := m.upgradeManagerContext.RestartServer(definitions.ServerTypeDBServer); err != nil {
1007+
if firstEntry.WithoutResign {
1008+
fmt.Printf("Without resign")
1009+
}
1010+
if err := m.upgradeManagerContext.RestartServer(definitions.ServerTypeDBServerNoResign); err != nil {
9971011
return recordFailure(errors.Wrap(err, "Failed to restart dbserver"))
9981012
}
9991013

0 commit comments

Comments
 (0)