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

Revert "session: add physical table placement_policy in mysql schema" #27250

Merged
merged 5 commits into from
Aug 17, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 3 additions & 3 deletions executor/infoschema_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ func (s *testInfoschemaClusterTableSuite) TestTableStorageStats(c *C) {
tk.MustQuery("select TABLE_SCHEMA, sum(TABLE_SIZE) from information_schema.TABLE_STORAGE_STATS where TABLE_SCHEMA = 'test' group by TABLE_SCHEMA;").Check(testkit.Rows(
"test 2",
))
c.Assert(len(tk.MustQuery("select TABLE_NAME from information_schema.TABLE_STORAGE_STATS where TABLE_SCHEMA = 'mysql';").Rows()), Equals, 25)
c.Assert(len(tk.MustQuery("select TABLE_NAME from information_schema.TABLE_STORAGE_STATS where TABLE_SCHEMA = 'mysql';").Rows()), Equals, 24)

// More tests about the privileges.
tk.MustExec("create user 'testuser'@'localhost'")
Expand All @@ -942,14 +942,14 @@ func (s *testInfoschemaClusterTableSuite) TestTableStorageStats(c *C) {
Hostname: "localhost",
}, nil, nil), Equals, true)

tk.MustQuery("select count(1) from information_schema.TABLE_STORAGE_STATS where TABLE_SCHEMA = 'mysql'").Check(testkit.Rows("25"))
tk.MustQuery("select count(1) from information_schema.TABLE_STORAGE_STATS where TABLE_SCHEMA = 'mysql'").Check(testkit.Rows("24"))

c.Assert(tk.Se.Auth(&auth.UserIdentity{
Username: "testuser3",
Hostname: "localhost",
}, nil, nil), Equals, true)

tk.MustQuery("select count(1) from information_schema.TABLE_STORAGE_STATS where TABLE_SCHEMA = 'mysql'").Check(testkit.Rows("25"))
tk.MustQuery("select count(1) from information_schema.TABLE_STORAGE_STATS where TABLE_SCHEMA = 'mysql'").Check(testkit.Rows("24"))
}

func (s *testInfoschemaTableSuite) TestSequences(c *C) {
Expand Down
30 changes: 1 addition & 29 deletions session/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,22 +340,6 @@ const (
WITH_GRANT_OPTION enum('N','Y') NOT NULL DEFAULT 'N',
PRIMARY KEY (USER,HOST,PRIV)
);`

// CreatePlacementPolicyTable store the placement policys.
CreatePlacementPolicyTable = `CREATE TABLE IF NOT EXISTS mysql.placement_policy (
NAME varchar(64) NOT NULL,
PRIMARY_REGION varchar(255) DEFAULT NULL,
REGIONS varchar(255) DEFAULT NULL,
LEADERS BIGINT UNSIGNED DEFAULT NULL,
FOLLOWERS BIGINT UNSIGNED DEFAULT NULL,
VOTERS BIGINT UNSIGNED DEFAULT NULL,
SCHEDULE varchar(255) DEFAULT NULL,
CONSTRAINTS varchar(255) DEFAULT NULL,
LEADER_CONSTRAINTS varchar(255) DEFAULT NULL,
FOLLOWER_CONSTRAINTS varchar(255) DEFAULT NULL,
VOTER_CONSTRAINTS varchar(255) DEFAULT NULL,
PRIMARY KEY (NAME)
);`
)

// bootstrap initiates system DB for a store.
Expand Down Expand Up @@ -515,13 +499,11 @@ const (
version71 = 71
// version72 adds snapshot column for mysql.stats_meta
version72 = 72
// version73 adds the placement policy for mysql.placement_meta
version73 = 73
)

// 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 = version73
var currentBootstrapVersion int64 = version72

var (
bootstrapVersion = []func(Session, int64){
Expand Down Expand Up @@ -597,7 +579,6 @@ var (
upgradeToVer70,
upgradeToVer71,
upgradeToVer72,
upgradeToVer73,
}
)

Expand Down Expand Up @@ -1547,13 +1528,6 @@ func upgradeToVer72(s Session, ver int64) {
doReentrantDDL(s, "ALTER TABLE mysql.stats_meta ADD COLUMN snapshot BIGINT(64) UNSIGNED NOT NULL DEFAULT 0", infoschema.ErrColumnExists)
}

func upgradeToVer73(s Session, ver int64) {
if ver >= version73 {
return
}
doReentrantDDL(s, CreatePlacementPolicyTable)
}

func writeOOMAction(s Session) {
comment := "oom-action is `log` by default in v3.0.x, `cancel` by default in v4.0.11+"
mustExecute(s, `INSERT HIGH_PRIORITY INTO %n.%n VALUES (%?, %?, %?) ON DUPLICATE KEY UPDATE VARIABLE_VALUE= %?`,
Expand Down Expand Up @@ -1632,8 +1606,6 @@ func doDDLWorks(s Session) {
mustExecute(s, CreateStatsFMSketchTable)
// Create global_grants
mustExecute(s, CreateGlobalGrantsTable)
// Create placement_policy
mustExecute(s, CreatePlacementPolicyTable)
}

// doDMLWorks executes DML statements in bootstrap stage.
Expand Down