Skip to content
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

bootstrap: disallow upgrade from below 6.2 to current master #56659

Closed
Closed
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
2 changes: 1 addition & 1 deletion br/pkg/restore/snap_client/systable_restore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,5 @@ func TestCheckSysTableCompatibility(t *testing.T) {
//
// The above variables are in the file br/pkg/restore/systable_restore.go
func TestMonitorTheSystemTableIncremental(t *testing.T) {
require.Equal(t, int64(216), session.CurrentBootstrapVersion)
require.Equal(t, int64(217), session.CurrentBootstrapVersion)
}
18 changes: 17 additions & 1 deletion pkg/session/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -1183,11 +1183,16 @@ const (
// version 216
// changes variable `tidb_scatter_region` value from ON to "table" and OFF to "".
version216 = 216

// version 217
// in this version, we disable upgrade from below v6.2.0, there are no system
// table changes related to it.
version217 = 217
)

// currentBootstrapVersion is defined as a variable, so we can modify its value for testing.
// please make sure this is the largest version
var currentBootstrapVersion int64 = version216
var currentBootstrapVersion int64 = version217

// DDL owner key's expired time is ManagerSessionTTL seconds, we should wait the time and give more time to have a chance to finish it.
var internalSQLTimeout = owner.ManagerSessionTTL + 15
Expand Down Expand Up @@ -1359,6 +1364,7 @@ var (
upgradeToVer214,
upgradeToVer215,
upgradeToVer216,
upgradeToVer217,
}
)

Expand Down Expand Up @@ -3268,6 +3274,16 @@ func upgradeToVer216(s sessiontypes.Session, ver int64) {
mustExecute(s, "UPDATE mysql.global_variables SET VARIABLE_VALUE='table' WHERE VARIABLE_NAME = 'tidb_scatter_region' AND VARIABLE_VALUE = 'ON'")
}

func upgradeToVer217(_ sessiontypes.Session, ver int64) {
if ver >= version217 {
return
}
// add this function to pass linter.
// we disable upgrade from below v6.2.0 in this version, so we can have a version
// to check with if it's needed later, there are no system table changes related
// to it.
}

// initGlobalVariableIfNotExists initialize a global variable with specific val if it does not exist.
func initGlobalVariableIfNotExists(s sessiontypes.Session, name string, val any) {
ctx := kv.WithInternalSourceType(context.Background(), kv.InternalTxnBootstrap)
Expand Down
Loading