Skip to content

Commit

Permalink
[WIP] migrations: introduce new system which supports long-running mi…
Browse files Browse the repository at this point in the history
…grations

This subsumes the cluster version cluster setting. There is a large
overlap with pkg/sqlmigrations, which should be cleaned up in the
future.

With the new system a CockroachDB binary upgrade will work as follows:

- If the customer wants the upgrade to auto-finalize, they leave the
  `cluster.preserve_downgrade_option` cluster setting to its default
  value. (same as before)
- Each node is rolled one-by-one onto the new binary, waiting for it to
  health check and for latencies to stabilize before moving onto the
  next node. (same as before)
- If the `cluster.preserve_downgrade_option` option is used, the cluster
  can be rolled back to the previous binary, but (some) new features are
  not available. Once the cluster stabilizes, the customer can commit to
  the new version to unlock these features.
- To commit to the new version, the user runs: (same as before)
  `SET CLUSTER SETTING version = 'v20.1.0'`
  or
  `RESET CLUSTER SETTING cluster.preserve_downgrade_option`
- [NEW] Before, the new features were available quickly, but now there
  may be a delay. To wait for the features to be available, the user
  polls:
  `SHOW UPGRADE STATUS`
- [NEW] If a user quickly upgrades from major version X to major version
  X+1 and then onto major version X+2, they must wait for the X+1
  upgrade to finish finalization before rolling any nodes onto X+2. If
  an X+2 node connects to this cluster before the upgrade finalization
  is done, it will crash (which hopefully will be noticed by the
  deployment tooling). This is unfortunate but a necessary trade off in
  allowing us to reduce our technical debt.

Closes #39182

Release note (<category, see below>): <what> <show> <why>
  • Loading branch information
danhhz committed Jan 23, 2020
1 parent 3187f08 commit 7381c2a
Show file tree
Hide file tree
Showing 14 changed files with 975 additions and 28 deletions.
31 changes: 31 additions & 0 deletions pkg/migration/connect/connect.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2020 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

// Package connect provides a no-dependency mechanism for a new or restarting
// node to discover the cluster information it needs to boot.
package connect

import (
"context"

"github.com/cockroachdb/cockroach/pkg/base"
)

// Connect retrieves information that is necessary to boot a node joining an
// existing cluster. This information comes via a low-dependency rpc to an
// existing node in the cluster.
func Connect(ctx context.Context, joinList base.JoinListType) (*ConnectResponse, error) {
panic(`WIP`)
// TODO(dan): This is using the joinList to keep the dependencies minimal, but
// gossip is doing all sorts of smarts with this before actually using it
// (filtering out self, etc). On one hand it'd be nice to keep this from
// depending on gossip (so the response could be _used_ by gossip), but it
// would be unfortuante to duplicate this initial work.
}
Loading

0 comments on commit 7381c2a

Please sign in to comment.