From b7645b2546c07e4cfd6c378f9bc04cc92a9ccf5e Mon Sep 17 00:00:00 2001 From: Marius Posta Date: Thu, 5 Jan 2023 15:46:26 -0500 Subject: [PATCH] sql: fix mixed-version behaviour of create_tenant() Previously, running create_tenant on the latest binary in a mixed-version cluster would bootstrap the system schema using the logic from the latest binary, in which all system database migration upgrade steps have been "baked in". This might not be compatible with the the tenant cluster's version which is (correctly) set to the active host cluster version, the idea there being that tenant clusters versions cannot be greater than host cluster versions. This commit fixes this by version-gating the tenant cluster system schema bootstrapping, and using hard-coded values when bootstrapping into the old version. Informs #94773. Release note: None --- .../kvccl/kvtenantccl/tenant_upgrade_test.go | 11 +- .../roachtest/tests/multitenant_upgrade.go | 1 + pkg/sql/catalog/bootstrap/BUILD.bazel | 5 +- pkg/sql/catalog/bootstrap/previous_release.go | 138 ++++++++++++++++++ pkg/sql/tenant.go | 38 ++++- pkg/sql/tenant_test.go | 37 ++++- pkg/startupmigrations/BUILD.bazel | 2 + pkg/startupmigrations/migrations.go | 30 +++- 8 files changed, 241 insertions(+), 21 deletions(-) create mode 100644 pkg/sql/catalog/bootstrap/previous_release.go diff --git a/pkg/ccl/kvccl/kvtenantccl/tenant_upgrade_test.go b/pkg/ccl/kvccl/kvtenantccl/tenant_upgrade_test.go index 13647d164024..2a3efa3c6da7 100644 --- a/pkg/ccl/kvccl/kvtenantccl/tenant_upgrade_test.go +++ b/pkg/ccl/kvccl/kvtenantccl/tenant_upgrade_test.go @@ -82,6 +82,7 @@ func TestTenantUpgrade(t *testing.T) { cleanupPGUrl() } } + expectedInitialTenantVersion, _, _ := v0v1v2() mkTenant := func(t *testing.T, id uint64) (tenantDB *gosql.DB, cleanup func()) { settings := cluster.MakeTestingClusterSettingsWithVersions( clusterversion.TestingBinaryVersion, @@ -90,7 +91,7 @@ func TestTenantUpgrade(t *testing.T) { ) // Initialize the version to the minimum it could be. require.NoError(t, clusterversion.Initialize(ctx, - clusterversion.TestingBinaryMinSupportedVersion, &settings.SV)) + expectedInitialTenantVersion, &settings.SV)) tenantArgs := base.TestTenantArgs{ TenantID: roachpb.MakeTenantID(id), TestingKnobs: base.TestingKnobs{}, @@ -109,7 +110,7 @@ func TestTenantUpgrade(t *testing.T) { // Ensure that the tenant works. initialTenantRunner.CheckQueryResults(t, "SHOW CLUSTER SETTING version", - [][]string{{clusterversion.TestingBinaryMinSupportedVersion.String()}}) + [][]string{{expectedInitialTenantVersion.String()}}) initialTenantRunner.Exec(t, "CREATE TABLE t (i INT PRIMARY KEY)") initialTenantRunner.Exec(t, "INSERT INTO t VALUES (1), (2)") @@ -172,11 +173,9 @@ func TestTenantUpgrade(t *testing.T) { } -// Returns two versions v0, v1, v2 which correspond to adjacent releases. v0 will -// equal the TestingBinaryMinSupportedVersion to avoid rot in tests using this -// (as we retire old versions). +// Returns two versions v0, v1, v2 which correspond to adjacent releases. func v0v1v2() (roachpb.Version, roachpb.Version, roachpb.Version) { - v0 := clusterversion.TestingBinaryMinSupportedVersion + v0 := clusterversion.ByKey(clusterversion.V22_1) v1 := clusterversion.TestingBinaryVersion v2 := clusterversion.TestingBinaryVersion if v1.Internal > 2 { diff --git a/pkg/cmd/roachtest/tests/multitenant_upgrade.go b/pkg/cmd/roachtest/tests/multitenant_upgrade.go index 57d26d5177e5..26f5c05af37e 100644 --- a/pkg/cmd/roachtest/tests/multitenant_upgrade.go +++ b/pkg/cmd/roachtest/tests/multitenant_upgrade.go @@ -164,6 +164,7 @@ func runMultiTenantUpgrade(ctx context.Context, t test.Test, c cluster.Cluster, t.Status("verifying that the tenant 13 server works and is at the earlier version") verifySQL(t, tenant13.pgURL, + mkStmt(`CREATE USER my_user`), mkStmt(`CREATE TABLE foo (id INT PRIMARY KEY, v STRING)`), mkStmt(`INSERT INTO foo VALUES($1, $2)`, 1, "bar"), mkStmt(`SELECT * FROM foo LIMIT 1`). diff --git a/pkg/sql/catalog/bootstrap/BUILD.bazel b/pkg/sql/catalog/bootstrap/BUILD.bazel index 4a903845bc35..237ad8339307 100644 --- a/pkg/sql/catalog/bootstrap/BUILD.bazel +++ b/pkg/sql/catalog/bootstrap/BUILD.bazel @@ -3,7 +3,10 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") go_library( name = "bootstrap", - srcs = ["metadata.go"], + srcs = [ + "metadata.go", + "previous_release.go", + ], importpath = "github.com/cockroachdb/cockroach/pkg/sql/catalog/bootstrap", visibility = ["//visibility:public"], deps = [ diff --git a/pkg/sql/catalog/bootstrap/previous_release.go b/pkg/sql/catalog/bootstrap/previous_release.go new file mode 100644 index 000000000000..31ca6783029c --- /dev/null +++ b/pkg/sql/catalog/bootstrap/previous_release.go @@ -0,0 +1,138 @@ +// Copyright 2022 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 bootstrap + +import ( + "bytes" + "crypto/sha256" + "encoding/hex" + "sort" + + "github.com/cockroachdb/cockroach/pkg/config/zonepb" + "github.com/cockroachdb/cockroach/pkg/keys" + "github.com/cockroachdb/cockroach/pkg/roachpb" + "github.com/cockroachdb/errors" +) + +// InitialValuesForTenantV221 returns the initial values as produced by the +// binary for the 22.1 release, for a non-system tenant. The only difference +// is that the contents of the system.zones table are overwritten with the new +// values. +func InitialValuesForTenantV221( + codec keys.SQLCodec, + defaultZoneConfig *zonepb.ZoneConfig, + defaultSystemZoneConfig *zonepb.ZoneConfig, +) (kvs []roachpb.KeyValue, splits []roachpb.RKey, _ error) { + h := sha256.Sum256([]byte(nonSystem221)) + if actualHash := hex.EncodeToString(h[:]); actualHash != nonSystem221SHA256 { + return nil, nil, errors.AssertionFailedf("expected %s, got %s", nonSystem221SHA256, actualHash) + } + var initialKVs []roachpb.KeyValue + initialKVs, splits, err := InitialValuesFromString(codec, nonSystem221) + if err != nil { + return nil, nil, err + } + // Replace system.zones entries. + kvs = InitialZoneConfigKVs(codec, defaultZoneConfig, defaultSystemZoneConfig) + zonesTablePrefix := codec.TablePrefix(keys.ZonesTableID) + for _, kv := range initialKVs { + if !bytes.Equal(zonesTablePrefix, kv.Key[:len(zonesTablePrefix)]) { + kvs = append(kvs, kv) + } + } + sort.Sort(roachpb.KeyValueByKey(kvs)) + return kvs, splits, nil +} + +const ( + // nonSystem221 is the hard-coded string representation of the + // initial values for a non-system tenant as produced by the 22.1 + // release binary. + nonSystem221 = `[{"key":""} +,{"key":"8b89898a89","value":"0312390a0673797374656d10011a250a0d0a0561646d696e1080101880100a0c0a04726f6f7410801018801012046e6f646518022200280140004a00"} +,{"key":"8b898b8a89","value":"030af2020a0a64657363726970746f721803200128013a0042270a02696410011a0c08011040180030005014600020003000680070007800800100880100980100422f0a0a64657363726970746f7210021a0c08081000180030005011600020013000680070007800800100880100980100480352640a077072696d61727910011801220269642a0a64657363726970746f72300140004a10080010001a00200028003000380040005a0070027a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d0010160026a210a0b0a0561646d696e103018300a0a0a04726f6f741030183012046e6f64651802800101880103980100b201130a077072696d61727910001a02696420012800b201240a1066616d5f325f64657363726970746f7210021a0a64657363726970746f7220022802b80103c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302"} +,{"key":"8b898c8a89","value":"030af0030a0575736572731804200128013a00422d0a08757365726e616d6510011a0c0807100018003000501960002000300068007000780080010088010098010042330a0e68617368656450617373776f726410021a0c0808100018003000501160002001300068007000780080010088010098010042320a066973526f6c6510031a0c08001000180030005010600020002a0566616c73653000680070007800800100880100980100480452780a077072696d617279100118012208757365726e616d652a0e68617368656450617373776f72642a066973526f6c65300140004a10080010001a00200028003000380040005a00700270037a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d0010160026a250a0d0a0561646d696e10f00318f0030a0c0a04726f6f7410f00318f00312046e6f64651802800101880103980100b201190a077072696d61727910001a08757365726e616d6520012800b2012c0a1466616d5f325f68617368656450617373776f726410021a0e68617368656450617373776f726420022802b2011c0a0c66616d5f335f6973526f6c6510031a066973526f6c6520032803b80104c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302"} +,{"key":"8b898d8a89","value":"030ae1020a057a6f6e65731805200128013a0042270a02696410011a0c08011040180030005014600020003000680070007800800100880100980100422b0a06636f6e66696710021a0c08081000180030005011600020013000680070007800800100880100980100480352600a077072696d61727910011801220269642a06636f6e666967300140004a10080010001a00200028003000380040005a0070027a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d0010160026a250a0d0a0561646d696e10f00318f0030a0c0a04726f6f7410f00318f00312046e6f64651802800101880103980100b201130a077072696d61727910001a02696420012800b2011c0a0c66616d5f325f636f6e66696710021a06636f6e66696720022802b80103c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302"} +,{"key":"8b898e8a89","value":"030a9f040a0873657474696e67731806200128013a0042290a046e616d6510011a0c08071000180030005019600020003000680070007800800100880100980100422a0a0576616c756510021a0c0807100018003000501960002000300068007000780080010088010098010042440a0b6c6173745570646174656410031a0d080510001800300050da08600020002a116e6f7728293a3a3a54494d455354414d503000680070007800800100880100980100422e0a0976616c75655479706510041a0c080710001800300050196000200130006800700078008001008801009801004805527d0a077072696d6172791001180122046e616d652a0576616c75652a0b6c617374557064617465642a0976616c756554797065300140004a10080010001a00200028003000380040005a007002700370047a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d0010160026a250a0d0a0561646d696e10f00318f0030a0c0a04726f6f7410f00318f00312046e6f64651802800101880103980100b201590a2666616d5f305f6e616d655f76616c75655f6c617374557064617465645f76616c75655479706510001a046e616d651a0576616c75651a0b6c617374557064617465641a0976616c75655479706520012002200320042800b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302"} +,{"key":"8b898f8a89","value":"030abb020a1164657363726970746f725f69645f7365711807200128013a00422a0a0576616c756510011a0c08011040180030005014600020003000680070007800800100880100980100480052590a077072696d61727910011800220576616c7565300140004a10080010001a00200028003000380040005a007a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d0010060006a210a0b0a0561646d696e103018300a0a0a04726f6f741030183012046e6f64651802800100880103980100b201160a077072696d61727910001a0576616c756520012801b80100c20100e2011c0801100118ffffffffffffffff7f2001280032040800100038014200e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880300"} +,{"key":"8b89938a89","value":"030af1030a056c65617365180b200128013a00422b0a0664657363494410011a0c08011040180030005014600020003000680070007800800100880100980100422c0a0776657273696f6e10021a0c08011040180030005014600020003000680070007800800100880100980100422b0a066e6f6465494410031a0c0801104018003000501460002000300068007000780080010088010098010042300a0a65787069726174696f6e10041a0d080510001800300050da0860002000300068007000780080010088010098010048055283010a077072696d617279100118012206646573634944220776657273696f6e220a65787069726174696f6e22066e6f64654944300130023004300340004000400040004a10080010001a00200028003000380040005a007a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d0010160026a250a0d0a0561646d696e10f00318f0030a0c0a04726f6f7410f00318f00312046e6f64651802800101880103980100b2013a0a077072696d61727910001a066465736349441a0776657273696f6e1a066e6f646549441a0a65787069726174696f6e20012002200320042800b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302"} +,{"key":"8b89948a89","value":"030af1050a086576656e746c6f67180c200128013a00422f0a0974696d657374616d7010011a0d080510001800300050da08600020003000680070007800800100880100980100422e0a096576656e745479706510021a0c08071000180030005019600020003000680070007800800100880100980100422d0a08746172676574494410031a0c0801104018003000501460002000300068007000780080010088010098010042300a0b7265706f7274696e67494410041a0c0801104018003000501460002000300068007000780080010088010098010042290a04696e666f10051a0c0807100018003000501960002001300068007000780080010088010098010042380a08756e69717565494410061a0c08081000180030005011600020002a09757569645f7634282930006800700078008001008801009801004807529b010a077072696d61727910011801220974696d657374616d702208756e6971756549442a096576656e74547970652a0874617267657449442a0b7265706f7274696e6749442a04696e666f30013006400040004a10080010001a00200028003000380040005a0070027003700470057a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d0010160026a250a0d0a0561646d696e10f00318f0030a0c0a04726f6f7410f00318f00312046e6f64651802800101880103980100b201260a077072696d61727910001a0974696d657374616d701a08756e697175654944200120062800b201220a0f66616d5f325f6576656e745479706510021a096576656e745479706520022802b201200a0e66616d5f335f746172676574494410031a08746172676574494420032803b201260a1166616d5f345f7265706f7274696e67494410041a0b7265706f7274696e67494420042804b201180a0a66616d5f355f696e666f10051a04696e666f20052805b80106c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302"} +,{"key":"8b89958a89","value":"030ad0060a0872616e67656c6f67180d200128013a00422f0a0974696d657374616d7010011a0d080510001800300050da08600020003000680070007800800100880100980100422c0a0772616e6765494410021a0c08011040180030005014600020003000680070007800800100880100980100422c0a0773746f7265494410031a0c08011040180030005014600020003000680070007800800100880100980100422e0a096576656e745479706510041a0c0807100018003000501960002000300068007000780080010088010098010042310a0c6f7468657252616e6765494410051a0c0801104018003000501460002001300068007000780080010088010098010042290a04696e666f10061a0c08071000180030005019600020013000680070007800800100880100980100423d0a08756e69717565494410071a0c08011040180030005014600020002a0e756e697175655f726f77696428293000680070007800800100880100980100480852a6010a077072696d61727910011801220974696d657374616d702208756e6971756549442a0772616e676549442a0773746f726549442a096576656e74547970652a0c6f7468657252616e676549442a04696e666f30013007400040004a10080010001a00200028003000380040005a00700270037004700570067a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d0010160026a250a0d0a0561646d696e10f00318f0030a0c0a04726f6f7410f00318f00312046e6f64651802800101880103980100b201260a077072696d61727910001a0974696d657374616d701a08756e697175654944200120072800b2011e0a0d66616d5f325f72616e6765494410021a0772616e6765494420022802b2011e0a0d66616d5f335f73746f7265494410031a0773746f7265494420032803b201220a0f66616d5f345f6576656e745479706510041a096576656e745479706520042804b201280a1266616d5f355f6f7468657252616e6765494410051a0c6f7468657252616e6765494420052805b201180a0a66616d5f365f696e666f10061a04696e666f20062806b80107c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302"} +,{"key":"8b89968a89","value":"030ac8030a027569180e200128013a0042280a036b657910011a0c08071000180030005019600020003000680070007800800100880100980100422a0a0576616c756510021a0c0808100018003000501160002001300068007000780080010088010098010042310a0b6c6173745570646174656410031a0d080510001800300050da086000200030006800700078008001008801009801004804526f0a077072696d6172791001180122036b65792a0576616c75652a0b6c61737455706461746564300140004a10080010001a00200028003000380040005a00700270037a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d0010160026a250a0d0a0561646d696e10f00318f0030a0c0a04726f6f7410f00318f00312046e6f64651802800101880103980100b201140a077072696d61727910001a036b657920012800b2011a0a0b66616d5f325f76616c756510021a0576616c756520022802b201260a1166616d5f335f6c6173745570646174656410031a0b6c6173745570646174656420032803b80104c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302"} +,{"key":"8b89978a89","value":"030ad30d0a046a6f6273180f200128013a0042370a02696410011a0c08011040180030005014600020002a0e756e697175655f726f77696428293000680070007800800100880100980100422b0a0673746174757310021a0c0807100018003000501960002000300068007000780080010088010098010042400a076372656174656410031a0d080510001800300050da08600020002a116e6f7728293a3a3a54494d455354414d503000680070007800800100880100980100422c0a077061796c6f616410041a0c08081000180030005011600020003000680070007800800100880100980100422d0a0870726f677265737310051a0c0808100018003000501160002001300068007000780080010088010098010042340a0f637265617465645f62795f7479706510061a0c0807100018003000501960002001300068007000780080010088010098010042320a0d637265617465645f62795f696410071a0c0801104018003000501460002001300068007000780080010088010098010042350a10636c61696d5f73657373696f6e5f696410081a0c0808100018003000501160002001300068007000780080010088010098010042360a11636c61696d5f696e7374616e63655f696410091a0c08011040180030005014600020013000680070007800800100880100980100422d0a086e756d5f72756e73100a1a0c08011040180030005014600020013000680070007800800100880100980100422e0a086c6173745f72756e100b1a0d080510001800300050da08600020013000680070007800800100880100980100480c52e7010a077072696d61727910011801220269642a067374617475732a07637265617465642a077061796c6f61642a0870726f67726573732a0f637265617465645f62795f747970652a0d637265617465645f62795f69642a10636c61696d5f73657373696f6e5f69642a11636c61696d5f696e7374616e63655f69642a086e756d5f72756e732a086c6173745f72756e300140004a10080010001a00200028003000380040005a0070027003700470057006700770087009700a700b7a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d001015a790a176a6f62735f7374617475735f637265617465645f696478100218002206737461747573220763726561746564300230033801400040004a10080010001a00200028003000380040005a007a0408002000800100880100900103980100a20106080012001800a80100b20100ba0100c00100c80100d001005aa1010a266a6f62735f637265617465645f62795f747970655f637265617465645f62795f69645f69647810031800220f637265617465645f62795f74797065220d637265617465645f62795f69642a06737461747573300630073801400040004a10080010001a00200028003000380040005a0070027a0408002000800100880100900103980100a20106080012001800a80100b20100ba0100c00100c80100d001005ab9020a126a6f62735f72756e5f73746174735f696478100418002210636c61696d5f73657373696f6e5f696422067374617475732207637265617465642a086c6173745f72756e2a086e756d5f72756e732a11636c61696d5f696e7374616e63655f696430083002300338014000400040004a10080010001a00200028003000380040005a00700b700a70097a0408002000800100880100900103980100a20106080012001800a80100b20100ba01810173746174757320494e20282772756e6e696e67273a3a3a535452494e472c2027726576657274696e67273a3a3a535452494e472c202770656e64696e67273a3a3a535452494e472c202770617573652d726571756573746564273a3a3a535452494e472c202763616e63656c2d726571756573746564273a3a3a535452494e4729c00100c80100d0010060056a250a0d0a0561646d696e10f00318f0030a0c0a04726f6f7410f00318f00312046e6f64651802800101880103980100b2016f0a1f66616d5f305f69645f7374617475735f637265617465645f7061796c6f616410001a0269641a067374617475731a07637265617465641a077061796c6f61641a0f637265617465645f62795f747970651a0d637265617465645f62795f69642001200220032004200620072800b2011a0a0870726f677265737310011a0870726f677265737320052805b2014c0a05636c61696d10021a10636c61696d5f73657373696f6e5f69641a11636c61696d5f696e7374616e63655f69641a086e756d5f72756e731a086c6173745f72756e20082009200a200b2800b80103c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302"} +,{"key":"8b899b8a89","value":"030af90a0a0c7765625f73657373696f6e731813200128013a0042370a02696410011a0c08011040180030005014600020002a0e756e697175655f726f7769642829300068007000780080010088010098010042310a0c68617368656453656372657410021a0c08081000180030005011600020003000680070007800800100880100980100422d0a08757365726e616d6510031a0c0807100018003000501960002000300068007000780080010088010098010042420a0963726561746564417410041a0d080510001800300050da08600020002a116e6f7728293a3a3a54494d455354414d503000680070007800800100880100980100422f0a0965787069726573417410051a0d080510001800300050da08600020003000680070007800800100880100980100422f0a097265766f6b6564417410061a0d080510001800300050da0860002001300068007000780080010088010098010042430a0a6c61737455736564417410071a0d080510001800300050da08600020002a116e6f7728293a3a3a54494d455354414d503000680070007800800100880100980100422e0a096175646974496e666f10081a0c08071000180030005019600020013000680070007800800100880100980100480952b4010a077072696d61727910011801220269642a0c6861736865645365637265742a08757365726e616d652a096372656174656441742a096578706972657341742a097265766f6b656441742a0a6c6173745573656441742a096175646974496e666f300140004a10080010001a00200028003000380040005a0070027003700470057006700770087a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d001015a720a1a7765625f73657373696f6e735f6578706972657341745f6964781002180022096578706972657341743005380140004a10080010001a00200028003000380040005a007a0408002000800100880100900103980100a20106080012001800a80100b20100ba0100c00100c80100d001005a720a1a7765625f73657373696f6e735f6372656174656441745f6964781003180022096372656174656441743004380140004a10080010001a00200028003000380040005a007a0408002000800100880100900103980100a20106080012001800a80100b20100ba0100c00100c80100d001005a720a1a7765625f73657373696f6e735f7265766f6b656441745f6964781004180022097265766f6b656441743006380140004a10080010001a00200028003000380040005a007a0408002000800100880100900103980100a20106080012001800a80100b20100ba0100c00100c80100d001005a740a1b7765625f73657373696f6e735f6c6173745573656441745f69647810051800220a6c6173745573656441743007380140004a10080010001a00200028003000380040005a007a0408002000800100880100900103980100a20106080012001800a80100b20100ba0100c00100c80100d0010060066a250a0d0a0561646d696e10f00318f0030a0c0a04726f6f7410f00318f00312046e6f64651802800101880103980100b201bb010a5166616d5f305f69645f6861736865645365637265745f757365726e616d655f6372656174656441745f6578706972657341745f7265766f6b656441745f6c6173745573656441745f6175646974496e666f10001a0269641a0c6861736865645365637265741a08757365726e616d651a096372656174656441741a096578706972657341741a097265766f6b656441741a0a6c6173745573656441741a096175646974496e666f200120022003200420052006200720082800b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302"} +,{"key":"8b899c8a89","value":"030ad2080a107461626c655f737461746973746963731814200128013a00422c0a077461626c65494410011a0c0801104018003000501460002000300068007000780080010088010098010042400a0b737461746973746963494410021a0c08011040180030005014600020002a0e756e697175655f726f7769642829300068007000780080010088010098010042290a046e616d6510031a0c08071000180030005019600020013000680070007800800100880100980100423f0a09636f6c756d6e49447310041a1d080f104018003000380150f8075a0c08011040180030005014600060002000300068007000780080010088010098010042420a0963726561746564417410051a0d080510001800300050da08600020002a116e6f7728293a3a3a54494d455354414d503000680070007800800100880100980100422d0a08726f77436f756e7410061a0c0801104018003000501460002000300068007000780080010088010098010042320a0d64697374696e6374436f756e7410071a0c08011040180030005014600020003000680070007800800100880100980100422e0a096e756c6c436f756e7410081a0c08011040180030005014600020003000680070007800800100880100980100422e0a09686973746f6772616d10091a0c0808100018003000501160002001300068007000780080010088010098010042360a0761766753697a65100a1a0c08011040180030005014600020002a08303a3a3a494e54383000680070007800800100880100980100480b52d0010a077072696d6172791001180122077461626c654944220b73746174697374696349442a046e616d652a09636f6c756d6e4944732a096372656174656441742a08726f77436f756e742a0d64697374696e6374436f756e742a096e756c6c436f756e742a09686973746f6772616d2a0761766753697a6530013002400040004a10080010001a00200028003000380040005a007003700470057006700770087009700a7a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d0010160026a250a0d0a0561646d696e10f00318f0030a0c0a04726f6f7410f00318f00312046e6f64651802800101880103980100b201e1010a5d66616d5f305f7461626c6549445f73746174697374696349445f6e616d655f636f6c756d6e4944735f6372656174656441745f726f77436f756e745f64697374696e6374436f756e745f6e756c6c436f756e745f686973746f6772616d10001a077461626c6549441a0b73746174697374696349441a046e616d651a09636f6c756d6e4944731a096372656174656441741a08726f77436f756e741a0d64697374696e6374436f756e741a096e756c6c436f756e741a09686973746f6772616d1a0761766753697a65200120022003200420052006200720082009200a2800b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302"} +,{"key":"8b899d8a89","value":"030ac1040a096c6f636174696f6e731815200128013a0042300a0b6c6f63616c6974794b657910011a0c0807100018003000501960002000300068007000780080010088010098010042320a0d6c6f63616c69747956616c756510021a0c08071000180030005019600020003000680070007800800100880100980100422e0a086c6174697475646510031a0d0803100f1812300050a40d600020003000680070007800800100880100980100422f0a096c6f6e67697475646510041a0d0803100f1812300050a40d6000200030006800700078008001008801009801004805528b010a077072696d61727910011801220b6c6f63616c6974794b6579220d6c6f63616c69747956616c75652a086c617469747564652a096c6f6e67697475646530013002400040004a10080010001a00200028003000380040005a00700370047a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d0010160026a250a0d0a0561646d696e10f00318f0030a0c0a04726f6f7410f00318f00312046e6f64651802800101880103980100b201710a3266616d5f305f6c6f63616c6974794b65795f6c6f63616c69747956616c75655f6c617469747564655f6c6f6e67697475646510001a0b6c6f63616c6974794b65791a0d6c6f63616c69747956616c75651a086c617469747564651a096c6f6e67697475646520012002200320042800b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302"} +,{"key":"8b899f8a89","value":"030a8d050a0c726f6c655f6d656d626572731817200128013a0042290a04726f6c6510011a0c08071000180030005019600020003000680070007800800100880100980100422b0a066d656d62657210021a0c08071000180030005019600020003000680070007800800100880100980100422c0a07697341646d696e10031a0c080010001800300050106000200030006800700078008001008801009801004804526f0a077072696d617279100118012204726f6c6522066d656d6265722a07697341646d696e30013002400040004a10080010001a00200028003000380040005a0070037a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d001015a680a15726f6c655f6d656d626572735f726f6c655f696478100218002204726f6c653001380240004a10080010001a00200028003000380040005a007a0408002000800100880100900103980100a20106080012001800a80100b20100ba0100c00100c80100d001005a6c0a17726f6c655f6d656d626572735f6d656d6265725f6964781003180022066d656d6265723002380140004a10080010001a00200028003000380040005a007a0408002000800100880100900103980100a20106080012001800a80100b20100ba0100c00100c80100d0010060046a250a0d0a0561646d696e10f00318f0030a0c0a04726f6f7410f00318f00312046e6f64651802800101880103980100b2011f0a077072696d61727910001a04726f6c651a066d656d626572200120022800b2011e0a0d66616d5f335f697341646d696e10031a07697341646d696e20032803b80104c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302"} +,{"key":"8b89a08a89","value":"030a8b040a08636f6d6d656e74731818200128013a0042290a047479706510011a0c08011040180030005014600020003000680070007800800100880100980100422e0a096f626a6563745f696410021a0c08011040180030005014600020003000680070007800800100880100980100422b0a067375625f696410031a0c08011040180030005014600020003000680070007800800100880100980100422c0a07636f6d6d656e7410041a0c080710001800300050196000200030006800700078008001008801009801004805527e0a077072696d6172791001180122047479706522096f626a6563745f696422067375625f69642a07636f6d6d656e743001300230034000400040004a10080010001a00200028003000380040005a0070047a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d0010160026a330a0d0a0561646d696e10f00318f0030a0c0a067075626c6963102018000a0c0a04726f6f7410f00318f00312046e6f64651802800101880103980100b2012c0a077072696d61727910001a04747970651a096f626a6563745f69641a067375625f69642001200220032800b2011e0a0d66616d5f345f636f6d6d656e7410041a07636f6d6d656e7420042804b80105c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302"} +,{"key":"8b89a18a89","value":"030a87060a1c7265706c69636174696f6e5f636f6e73747261696e745f73746174731819200128013a00422c0a077a6f6e655f696410011a0c08011040180030005014600020003000680070007800800100880100980100422f0a0a7375627a6f6e655f696410021a0c0801104018003000501460002000300068007000780080010088010098010042290a047479706510031a0c08071000180030005019600020003000680070007800800100880100980100422b0a06636f6e66696710041a0c08071000180030005019600020003000680070007800800100880100980100422e0a097265706f72745f696410051a0c0801104018003000501460002000300068007000780080010088010098010042350a0f76696f6c6174696f6e5f737461727410061a0d080910001800300050a00960002001300068007000780080010088010098010042350a1076696f6c6174696e675f72616e67657310071a0c08011040180030005014600020003000680070007800800100880100980100480852b5010a077072696d6172791001180122077a6f6e655f6964220a7375627a6f6e655f69642204747970652206636f6e6669672a097265706f72745f69642a0f76696f6c6174696f6e5f73746172742a1076696f6c6174696e675f72616e676573300130023003300440004000400040004a10080010001a00200028003000380040005a007005700670077a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d0010160026a250a0d0a0561646d696e10f00318f0030a0c0a04726f6f7410f00318f00312046e6f64651802800101880103980100b2016c0a077072696d61727910001a077a6f6e655f69641a0a7375627a6f6e655f69641a04747970651a06636f6e6669671a097265706f72745f69641a0f76696f6c6174696f6e5f73746172741a1076696f6c6174696e675f72616e67657320012002200320042005200620072800b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302"} +,{"key":"8b89a28a89","value":"030af0040a1f7265706c69636174696f6e5f637269746963616c5f6c6f63616c6974696573181a200128013a00422c0a077a6f6e655f696410011a0c08011040180030005014600020003000680070007800800100880100980100422f0a0a7375627a6f6e655f696410021a0c08011040180030005014600020003000680070007800800100880100980100422d0a086c6f63616c69747910031a0c08071000180030005019600020003000680070007800800100880100980100422e0a097265706f72745f696410041a0c0801104018003000501460002000300068007000780080010088010098010042330a0e61745f7269736b5f72616e67657310051a0c0801104018003000501460002000300068007000780080010088010098010048065298010a077072696d6172791001180122077a6f6e655f6964220a7375627a6f6e655f696422086c6f63616c6974792a097265706f72745f69642a0e61745f7269736b5f72616e6765733001300230034000400040004a10080010001a00200028003000380040005a00700470057a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d0010160026a250a0d0a0561646d696e10f00318f0030a0c0a04726f6f7410f00318f00312046e6f64651802800101880103980100b201510a077072696d61727910001a077a6f6e655f69641a0a7375627a6f6e655f69641a086c6f63616c6974791a097265706f72745f69641a0e61745f7269736b5f72616e676573200120022003200420052800b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302"} +,{"key":"8b89a38a89","value":"030ade060a117265706c69636174696f6e5f7374617473181b200128013a00422c0a077a6f6e655f696410011a0c08011040180030005014600020003000680070007800800100880100980100422f0a0a7375627a6f6e655f696410021a0c08011040180030005014600020003000680070007800800100880100980100422e0a097265706f72745f696410031a0c0801104018003000501460002000300068007000780080010088010098010042310a0c746f74616c5f72616e67657310041a0c0801104018003000501460002000300068007000780080010088010098010042370a12756e617661696c61626c655f72616e67657310051a0c08011040180030005014600020003000680070007800800100880100980100423c0a17756e6465725f7265706c6963617465645f72616e67657310061a0c08011040180030005014600020003000680070007800800100880100980100423b0a166f7665725f7265706c6963617465645f72616e67657310071a0c08011040180030005014600020003000680070007800800100880100980100480852d3010a077072696d6172791001180122077a6f6e655f6964220a7375627a6f6e655f69642a097265706f72745f69642a0c746f74616c5f72616e6765732a12756e617661696c61626c655f72616e6765732a17756e6465725f7265706c6963617465645f72616e6765732a166f7665725f7265706c6963617465645f72616e67657330013002400040004a10080010001a00200028003000380040005a00700370047005700670077a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d0010160026a250a0d0a0561646d696e10f00318f0030a0c0a04726f6f7410f00318f00312046e6f64651802800101880103980100b2018e010a077072696d61727910001a077a6f6e655f69641a0a7375627a6f6e655f69641a097265706f72745f69641a0c746f74616c5f72616e6765731a12756e617661696c61626c655f72616e6765731a17756e6465725f7265706c6963617465645f72616e6765731a166f7665725f7265706c6963617465645f72616e67657320012002200320042005200620072800b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302"} +,{"key":"8b89a48a89","value":"030add020a0c7265706f7274735f6d657461181c200128013a0042270a02696410011a0c08011040180030005014600020003000680070007800800100880100980100422f0a0967656e65726174656410021a0d080910001800300050a009600020003000680070007800800100880100980100480352630a077072696d61727910011801220269642a0967656e657261746564300140004a10080010001a00200028003000380040005a0070027a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d0010160026a250a0d0a0561646d696e10f00318f0030a0c0a04726f6f7410f00318f00312046e6f64651802800101880103980100b201200a077072696d61727910001a0269641a0967656e657261746564200120022802b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302"} +,{"key":"8b89a68a89","value":"030afc030a096e616d657370616365181e200128013a00422d0a08706172656e74494410011a0c0801104018003000501460002000300068007000780080010088010098010042330a0e706172656e74536368656d61494410021a0c0801104018003000501460002000300068007000780080010088010098010042290a046e616d6510031a0c0807100018003000501960002000300068007000780080010088010098010042270a02696410041a0c0801104018003000501460002001300068007000780080010088010098010048055280010a077072696d617279100118012208706172656e744944220e706172656e74536368656d61494422046e616d652a0269643001300230034000400040004a10080010001a00200028003000380040005a0070047a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d0010160026a210a0b0a0561646d696e103018300a0a0a04726f6f741030183012046e6f64651802800101880103980100b201330a077072696d61727910001a08706172656e7449441a0e706172656e74536368656d6149441a046e616d652001200220032800b201140a0866616d5f345f696410041a02696420042804b80105c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302"} +,{"key":"8b89a78a89","value":"030a86050a1170726f7465637465645f74735f6d657461181f200128013a0042340a0973696e676c65746f6e10011a0c08001000180030005010600020002a04747275653000680070007800800100880100980100422c0a0776657273696f6e10021a0c0801104018003000501460002000300068007000780080010088010098010042300a0b6e756d5f7265636f72647310031a0c08011040180030005014600020003000680070007800800100880100980100422e0a096e756d5f7370616e7310041a0c0801104018003000501460002000300068007000780080010088010098010042300a0b746f74616c5f627974657310051a0c0801104018003000501460002000300068007000780080010088010098010048065293010a077072696d61727910011801220973696e676c65746f6e2a0776657273696f6e2a0b6e756d5f7265636f7264732a096e756d5f7370616e732a0b746f74616c5f6279746573300140004a10080010001a00200028003000380040005a0070027003700470057a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d0010160026a210a0b0a0561646d696e103018300a0a0a04726f6f741030183012046e6f64651802800101880103980100a201260a0973696e676c65746f6e120f636865636b5f73696e676c65746f6e18002801300038004002b201500a077072696d61727910001a0973696e676c65746f6e1a0776657273696f6e1a0b6e756d5f7265636f7264731a096e756d5f7370616e731a0b746f74616c5f6279746573200120022003200420052800b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880303"} +,{"key":"8b89a88a89","value":"030aea050a1470726f7465637465645f74735f7265636f7264731820200128013a0042280a02696410011a0d080e10001800300050861760002000300068007000780080010088010098010042280a02747310021a0d080310001800300050a40d600020003000680070007800800100880100980100422e0a096d6574615f7479706510031a0c0807100018003000501960002000300068007000780080010088010098010042290a046d65746110041a0c08081000180030005011600020013000680070007800800100880100980100422e0a096e756d5f7370616e7310051a0c08011040180030005014600020003000680070007800800100880100980100422a0a057370616e7310061a0c0808100018003000501160002000300068007000780080010088010098010042340a08766572696669656410071a0c08001000180030005010600020002a0566616c73653000680070007800800100880100980100422b0a0674617267657410081a0c080810001800300050116000200130006800700078008001008801009801004809529d010a077072696d61727910011801220269642a0274732a096d6574615f747970652a046d6574612a096e756d5f7370616e732a057370616e732a0876657269666965642a06746172676574300140004a10080010001a00200028003000380040005a0070027003700470057006700770087a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d0010160026a210a0b0a0561646d696e103018300a0a0a04726f6f741030183012046e6f64651802800101880103980100b2015a0a077072696d61727910001a0269641a0274731a096d6574615f747970651a046d6574611a096e756d5f7370616e731a057370616e731a0876657269666965641a06746172676574200120022003200420052006200720082800b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302"} +,{"key":"8b89a98a89","value":"030aa5030a0c726f6c655f6f7074696f6e731821200128013a00422d0a08757365726e616d6510011a0c08071000180030005019600020003000680070007800800100880100980100422b0a066f7074696f6e10021a0c08071000180030005019600020003000680070007800800100880100980100422a0a0576616c756510031a0c08071000180030005019600020013000680070007800800100880100980100480452710a077072696d617279100118012208757365726e616d6522066f7074696f6e2a0576616c756530013002400040004a10080010001a00200028003000380040005a0070037a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d0010160026a250a0d0a0561646d696e10f00318f0030a0c0a04726f6f7410f00318f00312046e6f64651802800101880103980100b2012c0a077072696d61727910001a08757365726e616d651a066f7074696f6e1a0576616c75652001200220032803b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302"} +,{"key":"8b89aa8a89","value":"030ab8030a1773746174656d656e745f62756e646c655f6368756e6b731822200128013a0042370a02696410011a0c08011040180030005014600020002a0e756e697175655f726f7769642829300068007000780080010088010098010042300a0b6465736372697074696f6e10021a0c0807100018003000501960002001300068007000780080010088010098010042290a046461746110031a0c080810001800300050116000200030006800700078008001008801009801004804526d0a077072696d61727910011801220269642a0b6465736372697074696f6e2a0464617461300140004a10080010001a00200028003000380040005a00700270037a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d0010160026a250a0d0a0561646d696e10f00318f0030a0c0a04726f6f7410f00318f00312046e6f64651802800101880103980100b2012a0a077072696d61727910001a0269641a0b6465736372697074696f6e1a04646174612001200220032800b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302"} +,{"key":"8b89ab8a89","value":"030ab4080a1e73746174656d656e745f646961676e6f73746963735f72657175657374731823200128013a0042370a02696410011a0c08011040180030005014600020002a0e756e697175655f726f7769642829300068007000780080010088010098010042350a09636f6d706c6574656410021a0c08001000180030005010600020002a0566616c73653000680070007800800100880100980100423a0a1573746174656d656e745f66696e6765727072696e7410031a0c08071000180030005019600020003000680070007800800100880100980100423d0a1873746174656d656e745f646961676e6f73746963735f696410041a0c0801104018003000501460002001300068007000780080010088010098010042320a0c7265717565737465645f617410051a0d080910001800300050a00960002000300068007000780080010088010098010042410a156d696e5f657865637574696f6e5f6c6174656e637910061a13080610001800300050a20960006a04080010002001300068007000780080010088010098010042300a0a657870697265735f617410071a0d080910001800300050a009600020013000680070007800800100880100980100480852cf010a077072696d61727910011801220269642a09636f6d706c657465642a1573746174656d656e745f66696e6765727072696e742a1873746174656d656e745f646961676e6f73746963735f69642a0c7265717565737465645f61742a156d696e5f657865637574696f6e5f6c6174656e63792a0a657870697265735f6174300140004a10080010001a00200028003000380040005a007002700370047005700670077a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d001015aae010a10636f6d706c657465645f6964785f7632100218002209636f6d706c65746564220269642a1573746174656d656e745f66696e6765727072696e742a156d696e5f657865637574696f6e5f6c6174656e63792a0a657870697265735f617430023001400040004a10080010001a00200028003000380040005a007003700670077a0408002000800100880100900103980100a20106080012001800a80100b20100ba0100c00100c80100d0010060036a250a0d0a0561646d696e10f00318f0030a0c0a04726f6f7410f00318f00312046e6f64651802800101880103980100b2018c010a077072696d61727910001a0269641a09636f6d706c657465641a1573746174656d656e745f66696e6765727072696e741a1873746174656d656e745f646961676e6f73746963735f69641a0c7265717565737465645f61741a156d696e5f657865637574696f6e5f6c6174656e63791a0a657870697265735f617420012002200320042005200620072800b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302"} +,{"key":"8b89ac8a89","value":"030a9c060a1573746174656d656e745f646961676e6f73746963731824200128013a0042370a02696410011a0c08011040180030005014600020002a0e756e697175655f726f77696428293000680070007800800100880100980100423a0a1573746174656d656e745f66696e6765727072696e7410021a0c08071000180030005019600020003000680070007800800100880100980100422e0a0973746174656d656e7410031a0c0807100018003000501960002000300068007000780080010088010098010042320a0c636f6c6c65637465645f617410041a0d080910001800300050a009600020003000680070007800800100880100980100422b0a05747261636510051a0d081210001800300050da1d60002001300068007000780080010088010098010042430a0d62756e646c655f6368756e6b7310061a1d080f104018003000380150f8075a0c080110401800300050146000600020013000680070007800800100880100980100422a0a056572726f7210071a0c08071000180030005019600020013000680070007800800100880100980100480852af010a077072696d61727910011801220269642a1573746174656d656e745f66696e6765727072696e742a0973746174656d656e742a0c636f6c6c65637465645f61742a0574726163652a0d62756e646c655f6368756e6b732a056572726f72300140004a10080010001a00200028003000380040005a007002700370047005700670077a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d0010160026a250a0d0a0561646d696e10f00318f0030a0c0a04726f6f7410f00318f00312046e6f64651802800101880103980100b2016c0a077072696d61727910001a0269641a1573746174656d656e745f66696e6765727072696e741a0973746174656d656e741a0c636f6c6c65637465645f61741a0574726163651a0d62756e646c655f6368756e6b731a056572726f7220012002200320042005200620072800b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302"} +,{"key":"8b89ad8a89","value":"030aa4090a0e7363686564756c65645f6a6f62731825200128013a0042400a0b7363686564756c655f696410011a0c08011040180030005014600020002a0e756e697175655f726f7769642829300068007000780080010088010098010042320a0d7363686564756c655f6e616d6510021a0c0807100018003000501960002000300068007000780080010088010098010042420a076372656174656410031a0d080910001800300050a009600020002a136e6f7728293a3a3a54494d455354414d50545a3000680070007800800100880100980100422a0a056f776e657210041a0c08071000180030005019600020003000680070007800800100880100980100422e0a086e6578745f72756e10051a0d080910001800300050a00960002001300068007000780080010088010098010042330a0e7363686564756c655f737461746510061a0c0808100018003000501160002001300068007000780080010088010098010042320a0d7363686564756c655f6578707210071a0c0807100018003000501960002001300068007000780080010088010098010042350a107363686564756c655f64657461696c7310081a0c0808100018003000501160002001300068007000780080010088010098010042320a0d6578656375746f725f7479706510091a0c0807100018003000501960002000300068007000780080010088010098010042330a0e657865637574696f6e5f61726773100a1a0c08081000180030005011600020003000680070007800800100880100980100480b52ea010a077072696d61727910011801220b7363686564756c655f69642a0d7363686564756c655f6e616d652a07637265617465642a056f776e65722a086e6578745f72756e2a0e7363686564756c655f73746174652a0d7363686564756c655f657870722a107363686564756c655f64657461696c732a0d6578656375746f725f747970652a0e657865637574696f6e5f61726773300140004a10080010001a00200028003000380040005a0070027003700470057006700770087009700a7a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d001015a630a0c6e6578745f72756e5f6964781002180022086e6578745f72756e3005380140004a10080010001a00200028003000380040005a007a0408002000800100880100900103980100a20106080012001800a80100b20100ba0100c00100c80100d0010060036a250a0d0a0561646d696e10f00318f0030a0c0a04726f6f7410f00318f00312046e6f64651802800101880103980100b201380a05736368656410001a0b7363686564756c655f69641a086e6578745f72756e1a0e7363686564756c655f73746174652001200520062800b201780a056f7468657210011a0d7363686564756c655f6e616d651a07637265617465641a056f776e65721a0d7363686564756c655f657870721a107363686564756c655f64657461696c731a0d6578656375746f725f747970651a0e657865637574696f6e5f61726773200220032004200720082009200a2800b80102c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302"} +,{"key":"8b89af8a89","value":"030a8a030a0b73716c6c6976656e6573731827200128013a00422f0a0a73657373696f6e5f696410011a0c0808100018003000501160002000300068007000780080010088010098010042300a0a65787069726174696f6e10021a0d080310001800300050a40d6000200030006800700078008001008801009801004803526c0a077072696d61727910011801220a73657373696f6e5f69642a0a65787069726174696f6e300140004a10080010001a00200028003000380040005a0070027a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d0010160026a250a0d0a0561646d696e10f00318f0030a0c0a04726f6f7410f00318f00312046e6f64651802800101880103980100b2013c0a1a66616d305f73657373696f6e5f69645f65787069726174696f6e10001a0a73657373696f6e5f69641a0a65787069726174696f6e200120022802b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302"} +,{"key":"8b89b08a89","value":"030ab7040a0a6d6967726174696f6e731828200128013a00422a0a056d616a6f7210011a0c08011040180030005014600020003000680070007800800100880100980100422a0a056d696e6f7210021a0c08011040180030005014600020003000680070007800800100880100980100422a0a05706174636810031a0c08011040180030005014600020003000680070007800800100880100980100422d0a08696e7465726e616c10041a0c0801104018003000501460002000300068007000780080010088010098010042320a0c636f6d706c657465645f617410051a0d080910001800300050a0096000200030006800700078008001008801009801004806528d010a077072696d6172791001180122056d616a6f7222056d696e6f72220570617463682208696e7465726e616c2a0c636f6d706c657465645f6174300130023003300440004000400040004a10080010001a00200028003000380040005a0070057a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d0010160026a250a0d0a0561646d696e10f00318f0030a0c0a04726f6f7410f00318f00312046e6f64651802800101880103980100b201440a077072696d61727910001a056d616a6f721a056d696e6f721a0570617463681a08696e7465726e616c1a0c636f6d706c657465645f6174200120022003200420052805b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302"} +,{"key":"8b89b18a89","value":"030aa1030a0b6a6f696e5f746f6b656e731829200128013a0042280a02696410011a0d080e100018003000508617600020003000680070007800800100880100980100422b0a0673656372657410021a0c0808100018003000501160002000300068007000780080010088010098010042300a0a65787069726174696f6e10031a0d080910001800300050a0096000200030006800700078008001008801009801004804526e0a077072696d61727910011801220269642a067365637265742a0a65787069726174696f6e300140004a10080010001a00200028003000380040005a00700270037a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d0010160026a250a0d0a0561646d696e10f00318f0030a0c0a04726f6f7410f00318f00312046e6f64651802800101880103980100b2012b0a077072696d61727910001a0269641a067365637265741a0a65787069726174696f6e2001200220032800b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302"} +,{"key":"8b89b28a89","value":"030ab0110a1473746174656d656e745f73746174697374696373182a200128013a0042330a0d616767726567617465645f747310011a0d080910001800300050a00960002000300068007000780080010088010098010042330a0e66696e6765727072696e745f696410021a0c08081000180030005011600020003000680070007800800100880100980100423f0a1a7472616e73616374696f6e5f66696e6765727072696e745f696410031a0c08081000180030005011600020003000680070007800800100880100980100422e0a09706c616e5f6861736810041a0c08081000180030005011600020003000680070007800800100880100980100422d0a086170705f6e616d6510051a0c08071000180030005019600020003000680070007800800100880100980100422c0a076e6f64655f696410061a0c0801104018003000501460002000300068007000780080010088010098010042380a0c6167675f696e74657276616c10071a13080610001800300050a20960006a040800100020003000680070007800800100880100980100422e0a086d6574616461746110081a0d081210001800300050da1d60002000300068007000780080010088010098010042300a0a7374617469737469637310091a0d081210001800300050da1d600020003000680070007800800100880100980100422a0a04706c616e100a1a0d081210001800300050da1d600020003000680070007800800100880100980100429c020a68637264625f696e7465726e616c5f616767726567617465645f74735f6170705f6e616d655f66696e6765727072696e745f69645f6e6f64655f69645f706c616e5f686173685f7472616e73616374696f6e5f66696e6765727072696e745f69645f73686172645f38100b1a0c080110201800300050176000200030015a8c016d6f6428666e76333228637264625f696e7465726e616c2e646174756d735f746f5f627974657328616767726567617465645f74732c206170705f6e616d652c2066696e6765727072696e745f69642c206e6f64655f69642c20706c616e5f686173682c207472616e73616374696f6e5f66696e6765727072696e745f696429292c20383a3a3a494e543829680070007800800100880100980100480c52a1040a077072696d617279100118012268637264625f696e7465726e616c5f616767726567617465645f74735f6170705f6e616d655f66696e6765727072696e745f69645f6e6f64655f69645f706c616e5f686173685f7472616e73616374696f6e5f66696e6765727072696e745f69645f73686172645f38220d616767726567617465645f7473220e66696e6765727072696e745f6964221a7472616e73616374696f6e5f66696e6765727072696e745f69642209706c616e5f6861736822086170705f6e616d6522076e6f64655f69642a0c6167675f696e74657276616c2a086d657461646174612a0a737461746973746963732a04706c616e300b30013002300330043005300640004000400040004000400040004a10080010001a00200028003000380040005a00700770087009700a7a0408002000800100880100900104980101a201c70108011268637264625f696e7465726e616c5f616767726567617465645f74735f6170705f6e616d655f66696e6765727072696e745f69645f6e6f64655f69645f706c616e5f686173685f7472616e73616374696f6e5f66696e6765727072696e745f69645f73686172645f381808220d616767726567617465645f747322086170705f6e616d65220e66696e6765727072696e745f696422076e6f64655f69642209706c616e5f68617368221a7472616e73616374696f6e5f66696e6765727072696e745f6964a80100b20100ba0100c00100c80100d001015a9a010a1566696e6765727072696e745f73746174735f69647810021800220e66696e6765727072696e745f6964221a7472616e73616374696f6e5f66696e6765727072696e745f696430023003380b3801380438053806400040004a10080010001a00200028003000380040005a007a0408002000800100880100900103980100a20106080012001800a80100b20100ba0100c00100c80100d0010060036a210a0b0a0561646d696e103018300a0a0a04726f6f741030183012046e6f64651802800101880103980100a201b9020abc01637264625f696e7465726e616c5f616767726567617465645f74735f6170705f6e616d655f66696e6765727072696e745f69645f6e6f64655f69645f706c616e5f686173685f7472616e73616374696f6e5f66696e6765727072696e745f69645f73686172645f3820494e2028303a3a3a494e54382c20313a3a3a494e54382c20323a3a3a494e54382c20333a3a3a494e54382c20343a3a3a494e54382c20353a3a3a494e54382c20363a3a3a494e54382c20373a3a3a494e543829126e636865636b5f637264625f696e7465726e616c5f616767726567617465645f74735f6170705f6e616d655f66696e6765727072696e745f69645f6e6f64655f69645f706c616e5f686173685f7472616e73616374696f6e5f66696e6765727072696e745f69645f73686172645f381800280b300038014002b20190020a077072696d61727910001a68637264625f696e7465726e616c5f616767726567617465645f74735f6170705f6e616d655f66696e6765727072696e745f69645f6e6f64655f69645f706c616e5f686173685f7472616e73616374696f6e5f66696e6765727072696e745f69645f73686172645f381a0d616767726567617465645f74731a0e66696e6765727072696e745f69641a1a7472616e73616374696f6e5f66696e6765727072696e745f69641a09706c616e5f686173681a086170705f6e616d651a076e6f64655f69641a0c6167675f696e74657276616c1a086d657461646174611a0a737461746973746963731a04706c616e200b200120022003200420052006200720082009200a2800b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880303"} +,{"key":"8b89b38a89","value":"030ada0c0a167472616e73616374696f6e5f73746174697374696373182b200128013a0042330a0d616767726567617465645f747310011a0d080910001800300050a00960002000300068007000780080010088010098010042330a0e66696e6765727072696e745f696410021a0c08081000180030005011600020003000680070007800800100880100980100422d0a086170705f6e616d6510031a0c08071000180030005019600020003000680070007800800100880100980100422c0a076e6f64655f696410041a0c0801104018003000501460002000300068007000780080010088010098010042380a0c6167675f696e74657276616c10051a13080610001800300050a20960006a040800100020003000680070007800800100880100980100422e0a086d6574616461746110061a0d081210001800300050da1d60002000300068007000780080010088010098010042300a0a7374617469737469637310071a0d081210001800300050da1d60002000300068007000780080010088010098010042cf010a43637264625f696e7465726e616c5f616767726567617465645f74735f6170705f6e616d655f66696e6765727072696e745f69645f6e6f64655f69645f73686172645f3810081a0c080110201800300050176000200030015a656d6f6428666e76333228637264625f696e7465726e616c2e646174756d735f746f5f627974657328616767726567617465645f74732c206170705f6e616d652c2066696e6765727072696e745f69642c206e6f64655f696429292c20383a3a3a494e543829680070007800800100880100980100480952f8020a077072696d617279100118012243637264625f696e7465726e616c5f616767726567617465645f74735f6170705f6e616d655f66696e6765727072696e745f69645f6e6f64655f69645f73686172645f38220d616767726567617465645f7473220e66696e6765727072696e745f696422086170705f6e616d6522076e6f64655f69642a0c6167675f696e74657276616c2a086d657461646174612a0a7374617469737469637330083001300230033004400040004000400040004a10080010001a00200028003000380040005a007005700670077a0408002000800100880100900104980101a2017b08011243637264625f696e7465726e616c5f616767726567617465645f74735f6170705f6e616d655f66696e6765727072696e745f69645f6e6f64655f69645f73686172645f381808220d616767726567617465645f747322086170705f6e616d65220e66696e6765727072696e745f696422076e6f64655f6964a80100b20100ba0100c00100c80100d001015a780a1566696e6765727072696e745f73746174735f69647810021800220e66696e6765727072696e745f69643002380838013803380440004a10080010001a00200028003000380040005a007a0408002000800100880100900103980100a20106080012001800a80100b20100ba0100c00100c80100d0010060036a210a0b0a0561646d696e103018300a0a0a04726f6f741030183012046e6f64651802800101880103980100a201ef010a9701637264625f696e7465726e616c5f616767726567617465645f74735f6170705f6e616d655f66696e6765727072696e745f69645f6e6f64655f69645f73686172645f3820494e2028303a3a3a494e54382c20313a3a3a494e54382c20323a3a3a494e54382c20333a3a3a494e54382c20343a3a3a494e54382c20353a3a3a494e54382c20363a3a3a494e54382c20373a3a3a494e5438291249636865636b5f637264625f696e7465726e616c5f616767726567617465645f74735f6170705f6e616d655f66696e6765727072696e745f69645f6e6f64655f69645f73686172645f3818002808300038014002b201b8010a077072696d61727910001a43637264625f696e7465726e616c5f616767726567617465645f74735f6170705f6e616d655f66696e6765727072696e745f69645f6e6f64655f69645f73686172645f381a0d616767726567617465645f74731a0e66696e6765727072696e745f69641a086170705f6e616d651a076e6f64655f69641a0c6167675f696e74657276616c1a086d657461646174611a0a73746174697374696373200820012002200320042005200620072800b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880303"} +,{"key":"8b89b48a89","value":"030adb030a1664617461626173655f726f6c655f73657474696e6773182c200128013a0042300a0b64617461626173655f696410011a0c080c100018003000501a600020003000680070007800800100880100980100422e0a09726f6c655f6e616d6510021a0c08071000180030005019600020003000680070007800800100880100980100423e0a0873657474696e677310031a1d080f100018003000380750f1075a0c0807100018003000501960006000200030006800700078008001008801009801004804527a0a077072696d61727910011801220b64617461626173655f69642209726f6c655f6e616d652a0873657474696e677330013002400040004a10080010001a00200028003000380040005a0070037a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d0010160026a250a0d0a0561646d696e10f00318f0030a0c0a04726f6f7410f00318f00312046e6f64651802800101880103980100b201350a077072696d61727910001a0b64617461626173655f69641a09726f6c655f6e616d651a0873657474696e67732001200220032803b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302"} +,{"key":"8b89b68a89","value":"030a9b030a0d73716c5f696e7374616e636573182e200128013a0042270a02696410011a0c0801104018003000501460002000300068007000780080010088010098010042290a046164647210021a0c08071000180030005019600020013000680070007800800100880100980100422f0a0a73657373696f6e5f696410031a0c080810001800300050116000200130006800700078008001008801009801004804526c0a077072696d61727910011801220269642a04616464722a0a73657373696f6e5f6964300140004a10080010001a00200028003000380040005a00700270037a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d0010160026a250a0d0a0561646d696e10f00318f0030a0c0a04726f6f7410f00318f00312046e6f64651802800101880103980100b201290a077072696d61727910001a0269641a04616464721a0a73657373696f6e5f69642001200220032800b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302"} +,{"key":"8b89ba8a89","value":"030a9c030a0a7370616e5f636f756e741832200128013a0042340a0973696e676c65746f6e10011a0c08001000180030005010600020002a04747275653000680070007800800100880100980100422f0a0a7370616e5f636f756e7410021a0c080110401800300050146000200030006800700078008001008801009801004803526b0a077072696d61727910011801220973696e676c65746f6e2a0a7370616e5f636f756e74300140004a10080010001a00200028003000380040005a0070027a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d0010160026a250a0d0a0561646d696e10f00318f0030a0c0a04726f6f7410f00318f00312046e6f64651802800101880103980100a201210a0973696e676c65746f6e120a73696e676c655f726f7718002801300038004002b201280a077072696d61727910001a0973696e676c65746f6e1a0a7370616e5f636f756e74200120022802b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880303"} +,{"key":"8d89888a89","value":"03108080804018808080800222040890bf052803500058007801"} +,{"key":"8f898888","value":"01c801"} +,{"key":"a68988881273797374656d00018c89","value":"0102"} +,{"key":"a6898988127075626c696300018c89","value":"013a"} +,{"key":"a68989a512636f6d6d656e747300018c89","value":"0130"} +,{"key":"a68989a51264617461626173655f726f6c655f73657474696e677300018c89","value":"0158"} +,{"key":"a68989a51264657363726970746f7200018c89","value":"0106"} +,{"key":"a68989a51264657363726970746f725f69645f73657100018c89","value":"010e"} +,{"key":"a68989a5126576656e746c6f6700018c89","value":"0118"} +,{"key":"a68989a5126a6f627300018c89","value":"011e"} +,{"key":"a68989a5126a6f696e5f746f6b656e7300018c89","value":"0152"} +,{"key":"a68989a5126c6561736500018c89","value":"0116"} +,{"key":"a68989a5126c6f636174696f6e7300018c89","value":"012a"} +,{"key":"a68989a5126d6967726174696f6e7300018c89","value":"0150"} +,{"key":"a68989a5126e616d65737061636500018c89","value":"013c"} +,{"key":"a68989a51270726f7465637465645f74735f6d65746100018c89","value":"013e"} +,{"key":"a68989a51270726f7465637465645f74735f7265636f72647300018c89","value":"0140"} +,{"key":"a68989a51272616e67656c6f6700018c89","value":"011a"} +,{"key":"a68989a5127265706c69636174696f6e5f636f6e73747261696e745f737461747300018c89","value":"0132"} +,{"key":"a68989a5127265706c69636174696f6e5f637269746963616c5f6c6f63616c697469657300018c89","value":"0134"} +,{"key":"a68989a5127265706c69636174696f6e5f737461747300018c89","value":"0136"} +,{"key":"a68989a5127265706f7274735f6d65746100018c89","value":"0138"} +,{"key":"a68989a512726f6c655f6d656d6265727300018c89","value":"012e"} +,{"key":"a68989a512726f6c655f6f7074696f6e7300018c89","value":"0142"} +,{"key":"a68989a5127363686564756c65645f6a6f627300018c89","value":"014a"} +,{"key":"a68989a51273657474696e677300018c89","value":"010c"} +,{"key":"a68989a5127370616e5f636f756e7400018c89","value":"0164"} +,{"key":"a68989a51273716c5f696e7374616e63657300018c89","value":"015c"} +,{"key":"a68989a51273716c6c6976656e65737300018c89","value":"014e"} +,{"key":"a68989a51273746174656d656e745f62756e646c655f6368756e6b7300018c89","value":"0144"} +,{"key":"a68989a51273746174656d656e745f646961676e6f737469637300018c89","value":"0148"} +,{"key":"a68989a51273746174656d656e745f646961676e6f73746963735f726571756573747300018c89","value":"0146"} +,{"key":"a68989a51273746174656d656e745f7374617469737469637300018c89","value":"0154"} +,{"key":"a68989a5127461626c655f7374617469737469637300018c89","value":"0128"} +,{"key":"a68989a5127472616e73616374696f6e5f7374617469737469637300018c89","value":"0156"} +,{"key":"a68989a512756900018c89","value":"011c"} +,{"key":"a68989a512757365727300018c89","value":"0108"} +,{"key":"a68989a5127765625f73657373696f6e7300018c89","value":"0126"} +,{"key":"a68989a5127a6f6e657300018c89","value":"010a"} +]` + // nonSystem221SHA256 is the SHA-256 hash of the above constant. + nonSystem221SHA256 = `8a283ad4be5a77aef2012e5c133dcc06408342c89e8f96864cfe236644f097c6` +) diff --git a/pkg/sql/tenant.go b/pkg/sql/tenant.go index c9f86b1d17fc..af22467cd332 100644 --- a/pkg/sql/tenant.go +++ b/pkg/sql/tenant.go @@ -247,13 +247,36 @@ func (p *planner) CreateTenant(ctx context.Context, tenID uint64) error { } // Initialize the tenant's keyspace. + var tenantVersion clusterversion.ClusterVersion codec := keys.MakeSQLCodec(roachpb.MakeTenantID(tenID)) - schema := bootstrap.MakeMetadataSchema( - codec, - initialTenantZoneConfig, /* defaultZoneConfig */ - initialTenantZoneConfig, /* defaultSystemZoneConfig */ - ) - kvs, splits := schema.GetInitialValues() + var kvs []roachpb.KeyValue + var splits []roachpb.RKey + if p.EvalContext().Settings.Version.IsActive(ctx, clusterversion.V22_2) { + // The cluster is running the latest version. + // Use this version to create the tenant and bootstrap it using the host + // cluster's bootstrapping logic. + tenantVersion.Version = clusterversion.ByKey(clusterversion.V22_2) + schema := bootstrap.MakeMetadataSchema( + codec, + initialTenantZoneConfig, /* defaultZoneConfig */ + initialTenantZoneConfig, /* defaultSystemZoneConfig */ + ) + kvs, splits = schema.GetInitialValues() + } else { + // The cluster is not running the latest version. + // Use the previous major version to create the tenant and bootstrap it + // just like the previous major version binary would, using hardcoded + // initial values. + tenantVersion.Version = clusterversion.ByKey(clusterversion.V22_1) + kvs, splits, err = bootstrap.InitialValuesForTenantV221( + codec, + initialTenantZoneConfig, /* defaultZoneConfig */ + initialTenantZoneConfig, /* defaultSystemZoneConfig */ + ) + if err != nil { + return err + } + } { // Populate the version setting for the tenant. This will allow the tenant @@ -263,8 +286,7 @@ func (p *planner) CreateTenant(ctx context.Context, tenID uint64) error { // using code which may be too new. The expectation is that the tenant // clusters will be updated to a version only after the system tenant has // been upgraded. - v := p.EvalContext().Settings.Version.ActiveVersion(ctx) - tenantSettingKV, err := generateTenantClusterSettingKV(codec, v) + tenantSettingKV, err := generateTenantClusterSettingKV(codec, tenantVersion) if err != nil { return err } diff --git a/pkg/sql/tenant_test.go b/pkg/sql/tenant_test.go index eec557509c0c..8852b60469d7 100644 --- a/pkg/sql/tenant_test.go +++ b/pkg/sql/tenant_test.go @@ -12,13 +12,18 @@ package sql_test import ( "context" + gosql "database/sql" "testing" "github.com/cockroachdb/cockroach/pkg/base" + "github.com/cockroachdb/cockroach/pkg/clusterversion" "github.com/cockroachdb/cockroach/pkg/keys" + "github.com/cockroachdb/cockroach/pkg/kv" "github.com/cockroachdb/cockroach/pkg/roachpb" + "github.com/cockroachdb/cockroach/pkg/server" "github.com/cockroachdb/cockroach/pkg/testutils/serverutils" "github.com/cockroachdb/cockroach/pkg/testutils/sqlutils" + "github.com/cockroachdb/cockroach/pkg/testutils/testcluster" "github.com/cockroachdb/cockroach/pkg/util/leaktest" "github.com/cockroachdb/cockroach/pkg/util/log" "github.com/stretchr/testify/require" @@ -29,12 +34,38 @@ import ( func TestDestroyTenantSynchronous(t *testing.T) { defer leaktest.AfterTest(t)() defer log.Scope(t).Close(t) - ctx := context.Background() - s, sqlDB, kvDB := serverutils.StartServer(t, base.TestServerArgs{}) - defer s.Stopper().Stop(ctx) + t.Run("latest version", func(t *testing.T) { + s, sqlDB, kvDB := serverutils.StartServer(t, base.TestServerArgs{}) + defer s.Stopper().Stop(ctx) + testDestroyTenantSynchronous(ctx, t, sqlDB, kvDB) + }) + + t.Run("mixed version", func(t *testing.T) { + clusterArgs := base.TestClusterArgs{ + ServerArgs: base.TestServerArgs{ + Knobs: base.TestingKnobs{ + Server: &server.TestingKnobs{ + DisableAutomaticVersionUpgrade: make(chan struct{}), + BinaryVersionOverride: clusterversion.ByKey(clusterversion.V22_1), + }, + }, + }, + } + var ( + tc = testcluster.StartTestCluster(t, 1, clusterArgs) + s = tc.Server(0) + sqlDB = tc.ServerConn(0) + ) + defer tc.Stopper().Stop(ctx) + testDestroyTenantSynchronous(ctx, t, sqlDB, s.DB()) + }) +} + +func testDestroyTenantSynchronous(ctx context.Context, t *testing.T, sqlDB *gosql.DB, kvDB *kv.DB) { tenantID := roachpb.MakeTenantID(10) + codec := keys.MakeSQLCodec(tenantID) const tenantStateQuery = ` SELECT id, active FROM system.tenants WHERE id = 10 diff --git a/pkg/startupmigrations/BUILD.bazel b/pkg/startupmigrations/BUILD.bazel index 554666e4cacb..8061fda09f73 100644 --- a/pkg/startupmigrations/BUILD.bazel +++ b/pkg/startupmigrations/BUILD.bazel @@ -21,6 +21,8 @@ go_library( "//pkg/sql", "//pkg/sql/catalog/catalogkeys", "//pkg/sql/catalog/descpb", + "//pkg/sql/pgwire/pgcode", + "//pkg/sql/pgwire/pgerror", "//pkg/sql/sem/tree", "//pkg/sql/sessiondata", "//pkg/startupmigrations/leasemanager", diff --git a/pkg/startupmigrations/migrations.go b/pkg/startupmigrations/migrations.go index 52e634e958fe..769724b0c09c 100644 --- a/pkg/startupmigrations/migrations.go +++ b/pkg/startupmigrations/migrations.go @@ -26,6 +26,8 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql" "github.com/cockroachdb/cockroach/pkg/sql/catalog/catalogkeys" "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb" + "github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgcode" + "github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgerror" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sessiondata" "github.com/cockroachdb/cockroach/pkg/startupmigrations/leasemanager" @@ -394,7 +396,7 @@ func (r runner) execAsRootWithRetry( // arbitrarily long time. var err error for retry := retry.Start(retry.Options{MaxRetries: 5}); retry.Next(); { - err := r.execAsRoot(ctx, opName, stmt, qargs...) + err = r.execAsRoot(ctx, opName, stmt, qargs...) if err == nil { break } @@ -782,7 +784,18 @@ func addRootUser(ctx context.Context, r runner) error { const upsertRootStmt = ` UPSERT INTO system.users (username, "hashedPassword", "isRole", "user_id") VALUES ($1, '', false, 1) ` - return r.execAsRootWithRetry(ctx, "addRootUser", upsertRootStmt, username.RootUser) + err := r.execAsRootWithRetry(ctx, "addRootUser", upsertRootStmt, username.RootUser) + if pgerror.GetPGCode(err) == pgcode.UndefinedColumn { + // It's legitimately possible for this UPSERT to fail in tenant clusters + // whose system schema was bootstrapped using values from V22.2. In that + // schema, the user_id column doesn't exist yet and version gates are + // useless at this juncture. + const upsertRootStmtV221 = ` + UPSERT INTO system.users (username, "hashedPassword", "isRole") VALUES ($1, '', false) + ` + return r.execAsRootWithRetry(ctx, "addRootUser", upsertRootStmtV221, username.RootUser) + } + return err } func addAdminRole(ctx context.Context, r runner) error { @@ -790,7 +803,18 @@ func addAdminRole(ctx context.Context, r runner) error { const upsertAdminStmt = ` UPSERT INTO system.users (username, "hashedPassword", "isRole", "user_id") VALUES ($1, '', true, 2) ` - return r.execAsRootWithRetry(ctx, "addAdminRole", upsertAdminStmt, username.AdminRole) + err := r.execAsRootWithRetry(ctx, "addAdminRole", upsertAdminStmt, username.AdminRole) + if pgerror.GetPGCode(err) == pgcode.UndefinedColumn { + // It's legitimately possible for this UPSERT to fail in tenant clusters + // whose system schema was bootstrapped using values from V22.2. In that + // schema, the user_id column doesn't exist yet and version gates are + // useless at this juncture. + const upsertAdminStmtV221 = ` + UPSERT INTO system.users (username, "hashedPassword", "isRole") VALUES ($1, '', false) + ` + return r.execAsRootWithRetry(ctx, "addAdminRole", upsertAdminStmtV221, username.AdminRole) + } + return err } func addRootToAdminRole(ctx context.Context, r runner) error {