Skip to content

Bug fix/special upgrade #296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# ArangoDB Starter Changelog

## Changes from 0.14.13 to 0.15.0-1

- Do not run ResignLeadership when upgrading from <= 3.6.14 or
3.7 with <= 3.7.13.

## Changes from 0.14.12 to 0.14.13

- Fixed upgrade for active failover when there are nodes without single server.
Expand Down
24 changes: 13 additions & 11 deletions pkg/definitions/server_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ import (
type ServerType string

const (
ServerTypeUnknown = "unknown"
ServerTypeCoordinator = "coordinator"
ServerTypeDBServer = "dbserver"
ServerTypeAgent = "agent"
ServerTypeSingle = "single"
ServerTypeResilientSingle = "resilientsingle"
ServerTypeSyncMaster = "syncmaster"
ServerTypeSyncWorker = "syncworker"
ServerTypeUnknown = "unknown"
ServerTypeCoordinator = "coordinator"
ServerTypeDBServer = "dbserver"
ServerTypeDBServerNoResign = "dbserver_noresign"
ServerTypeAgent = "agent"
ServerTypeSingle = "single"
ServerTypeResilientSingle = "resilientsingle"
ServerTypeSyncMaster = "syncmaster"
ServerTypeSyncWorker = "syncworker"
)

// String returns a string representation of the given ServerType.
Expand All @@ -50,7 +51,7 @@ func (s ServerType) PortOffset() int {
switch s {
case ServerTypeCoordinator, ServerTypeSingle, ServerTypeResilientSingle:
return PortOffsetCoordinator
case ServerTypeDBServer:
case ServerTypeDBServer, ServerTypeDBServerNoResign:
return PortOffsetDBServer
case ServerTypeAgent:
return PortOffsetAgent
Expand Down Expand Up @@ -82,7 +83,7 @@ func (s ServerType) ExpectedServerRole() (string, string) {
return "SINGLE", ""
case ServerTypeResilientSingle:
return "SINGLE", "resilient"
case ServerTypeDBServer:
case ServerTypeDBServer, ServerTypeDBServerNoResign:
return "PRIMARY", ""
case ServerTypeAgent:
return "AGENT", ""
Expand All @@ -98,7 +99,7 @@ func (s ServerType) GetName() string {
switch s {
case ServerTypeAgent:
return "agent"
case ServerTypeDBServer:
case ServerTypeDBServer, ServerTypeDBServerNoResign:
return "dbserver"
case ServerTypeCoordinator:
return "coordinator"
Expand All @@ -117,6 +118,7 @@ func AllServerTypes() []ServerType {
return []ServerType{
ServerTypeCoordinator,
ServerTypeDBServer,
ServerTypeDBServerNoResign,
ServerTypeAgent,
ServerTypeSingle,
ServerTypeResilientSingle,
Expand Down
2 changes: 1 addition & 1 deletion service/runtime_server_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ func (s *runtimeServerManager) RestartServer(log zerolog.Logger, serverType defi
switch serverType {
case definitions.ServerTypeAgent:
p = s.agentProc.Process()
case definitions.ServerTypeDBServer:
case definitions.ServerTypeDBServer, definitions.ServerTypeDBServerNoResign:
p = s.dbserverProc.Process()
case definitions.ServerTypeCoordinator:
p = s.coordinatorProc.Process()
Expand Down
28 changes: 21 additions & 7 deletions service/upgrade_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,11 @@ const (
// UpgradePlanEntry is the JSON structure that describes a single entry
// in an upgrade plan.
type UpgradePlanEntry struct {
PeerID string `json:"peer_id"`
Type UpgradeEntryType `json:"type"`
Failures int `json:"failures,omitempty"`
Reason string `json:"reason,omitempty"`
PeerID string `json:"peer_id"`
Type UpgradeEntryType `json:"type"`
Failures int `json:"failures,omitempty"`
Reason string `json:"reason,omitempty"`
WithoutResign bool `json:"withoutResign,omitempty"`
}

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

// Check if we can upgrade from running to binary versions
specialUpgradeFrom346 := false
specialUpgradeFrom3614 := false
rules := upgraderules.CheckUpgradeRules
if forceMinorUpgrade {
rules = upgraderules.CheckSoftUpgradeRules
Expand All @@ -267,6 +269,14 @@ func (m *upgradeManager) StartDatabaseUpgrade(ctx context.Context, forceMinorUpg
if from.CompareTo("3.4.6") == 0 {
specialUpgradeFrom346 = true
}
subint, found := from.SubInt()
if !found {
subint = 0
}
if (from.Major() == 3 && from.Minor() <= 6 && subint <= 14) ||
(from.Major() == 3 && from.Minor() == 7 && subint <= 12) {
specialUpgradeFrom3614 = true
}
}

// Fetch mode
Expand Down Expand Up @@ -403,8 +413,9 @@ func (m *upgradeManager) StartDatabaseUpgrade(ctx context.Context, forceMinorUpg
for _, p := range config.AllPeers {
if p.HasDBServer() {
plan.Entries = append(plan.Entries, UpgradePlanEntry{
Type: UpgradeEntryTypeDBServer,
PeerID: p.ID,
Type: UpgradeEntryTypeDBServer,
PeerID: p.ID,
WithoutResign: specialUpgradeFrom3614,
})
}
}
Expand Down Expand Up @@ -993,7 +1004,10 @@ func (m *upgradeManager) processUpgradePlan(ctx context.Context, plan UpgradePla
m.upgradeServerType = definitions.ServerTypeDBServer
m.updateNeeded = true
upgrade := func() error {
if err := m.upgradeManagerContext.RestartServer(definitions.ServerTypeDBServer); err != nil {
if firstEntry.WithoutResign {
fmt.Printf("Without resign")
}
if err := m.upgradeManagerContext.RestartServer(definitions.ServerTypeDBServerNoResign); err != nil {
return recordFailure(errors.Wrap(err, "Failed to restart dbserver"))
}

Expand Down