Skip to content

Commit

Permalink
Merge #55453
Browse files Browse the repository at this point in the history
55453: clusterversion: clean up unused 19.2/20.1 cluster versions r=lucy-zhang a=lucy-zhang

clusterversion: remove commented-out old cluster versions

From now on, we're going to delete the entries for obsolete cluster
versions entirely instead of commenting them out.

Release note: None

----

clusterversion: clean up unused 19.2/20.1 cluster versions

Related to #47447.

Release note: None

Co-authored-by: Lucy Zhang <[email protected]>
  • Loading branch information
craig[bot] and thoszhang committed Oct 15, 2020
2 parents 38e2c1f + f757119 commit f53bbc8
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 231 deletions.
181 changes: 2 additions & 179 deletions pkg/clusterversion/cockroach_versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,15 @@ type VersionKey int
//
// To delete a version.
// - Remove its associated runtime checks.
// - If the version is not the latest one, delete the constant, comment out
// its stanza, and say "Removed." above the versionsSingleton.
// - If the version is not the latest one, delete the constant and remove its
// entry in the versionsSingleton.
//
//go:generate stringer -type=VersionKey
const (
_ VersionKey = iota - 1 // want first named one to start at zero
Version19_1
VersionStart19_2
VersionLearnerReplicas
VersionTopLevelForeignKeys
VersionAtomicChangeReplicasTrigger
VersionAtomicChangeReplicas
VersionTableDescModificationTimeFromMVCC
VersionPartitionedBackup
Version19_2
VersionStart20_1
Expand All @@ -50,7 +46,6 @@ const (
VersionPrimaryKeyChanges
VersionAuthLocalAndTrustRejectMethods
VersionPrimaryKeyColumnsOutOfFamilyZero
VersionRootPassword
VersionNoExplicitForeignKeyIndexIDs
VersionHashShardedIndexes
VersionCreateRolePrivilege
Expand Down Expand Up @@ -105,160 +100,11 @@ const (
// minor version until we are absolutely sure that no new migrations will need
// to be added (i.e., when cutting the final release candidate).
var versionsSingleton = keyedVersions([]keyedVersion{
//{
// Removed
// VersionUnreplicatedRaftTruncatedState is https://github.com/cockroachdb/cockroach/pull/34660.
// When active, it moves the truncated state into unreplicated keyspace
// on log truncations.
//
// The migration works as follows:
//
// 1. at any log position, the replicas of a Range either use the new
// (unreplicated) key or the old one, and exactly one of them exists.
//
// 2. When a log truncation evaluates under the new cluster version,
// it initiates the migration by deleting the old key. Under the old cluster
// version, it behaves like today, updating the replicated truncated state.
//
// 3. The deletion signals new code downstream of Raft and triggers a write
// to the new, unreplicated, key (atomic with the deletion of the old key).
//
// 4. Future log truncations don't write any replicated data any more, but
// (like before) send along the TruncatedState which is written downstream
// of Raft atomically with the deletion of the log entries. This actually
// uses the same code as 3.
// What's new is that the truncated state needs to be verified before
// replacing a previous one. If replicas disagree about their truncated
// state, it's possible for replica X at FirstIndex=100 to apply a
// truncated state update that sets FirstIndex to, say, 50 (proposed by a
// replica with a "longer" historical log). In that case, the truncated
// state update must be ignored (this is straightforward downstream-of-Raft
// code).
//
// 5. When a split trigger evaluates, it seeds the RHS with the legacy
// key iff the LHS uses the legacy key, and the unreplicated key otherwise.
// This makes sure that the invariant that all replicas agree on the
// state of the migration is upheld.
//
// 6. When a snapshot is applied, the receiver is told whether the snapshot
// contains a legacy key. If not, it writes the truncated state (which is
// part of the snapshot metadata) in its unreplicated version. Otherwise
// it doesn't have to do anything (the range will migrate later).
//
// The following diagram visualizes the above. Note that it abuses sequence
// diagrams to get a nice layout; the vertical lines belonging to NewState
// and OldState don't imply any particular ordering of operations.
//
// ┌────────┐ ┌────────┐
// │OldState│ │NewState│
// └───┬────┘ └───┬────┘
// │ Bootstrap under old version
// │ <─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
// │ │
// │ │ Bootstrap under new version
// │ │ <─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
// │ │
// │─ ─ ┐
// │ | Log truncation under old version
// │< ─ ┘
// │ │
// │─ ─ ┐ │
// │ | Snapshot │
// │< ─ ┘ │
// │ │
// │ │─ ─ ┐
// │ │ | Snapshot
// │ │< ─ ┘
// │ │
// │ Log truncation under new version │
// │ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─>│
// │ │
// │ │─ ─ ┐
// │ │ | Log truncation under new version
// │ │< ─ ┘
// │ │
// │ │─ ─ ┐
// │ │ | Log truncation under old version
// │ │< ─ ┘ (necessarily running new binary)
//
// Source: http://www.plantuml.com/plantuml/uml/ and the following input:
//
// @startuml
// scale 600 width
//
// OldState <--] : Bootstrap under old version
// NewState <--] : Bootstrap under new version
// OldState --> OldState : Log truncation under old version
// OldState --> OldState : Snapshot
// NewState --> NewState : Snapshot
// OldState --> NewState : Log truncation under new version
// NewState --> NewState : Log truncation under new version
// NewState --> NewState : Log truncation under old version\n(necessarily running new binary)
// @enduml

//Key: VersionUnreplicatedRaftTruncatedState,
//Version: roachpb.Version{Major: 2, Minor: 1, Unstable: 6},
//},
{
// Version19_1 is CockroachDB v19.1. It's used for all v19.1.x patch releases.
Key: Version19_1,
Version: roachpb.Version{Major: 19, Minor: 1},
},
{
// VersionStart19_2 demarcates work towards CockroachDB v19.2.
Key: VersionStart19_2,
Version: roachpb.Version{Major: 19, Minor: 1, Unstable: 1},
},
// Removed.
// {
// // VersionQueryTxnTimestamp is https://github.com/cockroachdb/cockroach/pull/36307.
// Key: VersionQueryTxnTimestamp,
// Version: roachpb.Version{Major: 19, Minor: 1, Unstable: 2},
// },
// Removed.
// {
// // VersionStickyBit is https://github.com/cockroachdb/cockroach/pull/37506.
// Key: VersionStickyBit,
// Version: roachpb.Version{Major: 19, Minor: 1, Unstable: 3},
// },
// Removed.
// {
// // VersionParallelCommits is https://github.com/cockroachdb/cockroach/pull/37777.
// Key: VersionParallelCommits,
// Version: roachpb.Version{Major: 19, Minor: 1, Unstable: 4},
// },
// Removed.
// {
// // VersionGenerationComparable is https://github.com/cockroachdb/cockroach/pull/38334.
// Key: VersionGenerationComparable,
// Version: roachpb.Version{Major: 19, Minor: 1, Unstable: 5},
// },
{
// VersionLearnerReplicas is https://github.com/cockroachdb/cockroach/pull/38149.
Key: VersionLearnerReplicas,
Version: roachpb.Version{Major: 19, Minor: 1, Unstable: 6},
},
{
// VersionTopLevelForeignKeys is https://github.com/cockroachdb/cockroach/pull/39173.
//
// It represents an upgrade to the table descriptor format in which foreign
// key references are pulled out of the index descriptors where they
// originally were kept, and rewritten into a top level field on the index's
// parent table descriptors. During a mixed-version state, the database will
// write old-style table descriptors at all system boundaries, but upgrade
// all old-style table descriptors into the new format upon read. Once the
// upgrade is finalized, the database will write the upgraded format, but
// continue to upgrade old-style descriptors on-demand.
//
// This version is also used for the new foreign key schema changes which
// are run in the schema changer, requiring new types of mutations on the
// table descriptor. The same version is used for both of these changes
// because the changes are intertwined, and it slightly simplifies some of
// the logic to assume that either neither or both sets of changes can be
// active.
Key: VersionTopLevelForeignKeys,
Version: roachpb.Version{Major: 19, Minor: 1, Unstable: 7},
},
{
// VersionAtomicChangeReplicasTrigger is https://github.com/cockroachdb/cockroach/pull/39485.
//
Expand All @@ -278,18 +124,6 @@ var versionsSingleton = keyedVersions([]keyedVersion{
Key: VersionAtomicChangeReplicas,
Version: roachpb.Version{Major: 19, Minor: 1, Unstable: 9},
},
{
// VersionTableDescModificationTimeFromMVCC is https://github.com/cockroachdb/cockroach/pull/40581
//
// It represents an upgrade to the table descriptor format in which
// CreateAsOfTime and ModifiedTime are set to zero when new versions of
// table descriptors are written. This removes the need to fix the commit
// timestamp for transactions which update table descriptors. The value
// is then populated by the reading client with the MVCC timestamp of the
// row which contained the serialized table descriptor.
Key: VersionTableDescModificationTimeFromMVCC,
Version: roachpb.Version{Major: 19, Minor: 1, Unstable: 10},
},
{
// VersionPartitionedBackup is https://github.com/cockroachdb/cockroach/pull/39250.
Key: VersionPartitionedBackup,
Expand Down Expand Up @@ -409,17 +243,6 @@ var versionsSingleton = keyedVersions([]keyedVersion{
Key: VersionPrimaryKeyColumnsOutOfFamilyZero,
Version: roachpb.Version{Major: 19, Minor: 2, Unstable: 9},
},
{
// VersionRootPassword enables setting a password for the `root`
// user from SQL. Even though introducing a password for the root
// user in 20.1 does not prevent 19.2 nodes from using the root
// account, we need a cluster setting: the 19.2 nodes do not even
// *check* the password, so setting a pw in a hybrid 20.1/19.2
// cluster would yield different client auth successes in
// different nodes (which is poor UX).
Key: VersionRootPassword,
Version: roachpb.Version{Major: 19, Minor: 2, Unstable: 10},
},
{
// VersionNoExplicitForeignKeyIndexIDs is https://github.com/cockroachdb/cockroach/pull/43332.
//
Expand Down
99 changes: 47 additions & 52 deletions pkg/clusterversion/versionkey_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f53bbc8

Please sign in to comment.