Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
systay committed Oct 28, 2022
1 parent 74808ac commit c4d0d22
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 5 deletions.
112 changes: 112 additions & 0 deletions doc/releasenotes/10_0_0_release_notes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,115 @@
## system tables that will exist on all shards:
- mysql
- sys
- information_schema
- performance_schema

This first RFC will try to produce a useful view of the INFORMATION_SCHEMA views first.
We can come back to the other system tables later.

These are tables that will be well-handled:
| COLUMNS |
| TABLES |
| VIEWS |

```
+---------------------------------------+
| TABLE_NAME |
+---------------------------------------+
| ADMINISTRABLE_ROLE_AUTHORIZATIONS |
| APPLICABLE_ROLES |
| CHARACTER_SETS |
| CHECK_CONSTRAINTS |
| COLLATION_CHARACTER_SET_APPLICABILITY |
| COLLATIONS |
| COLUMN_PRIVILEGES |
| COLUMN_STATISTICS |
| COLUMNS_EXTENSIONS |
| ENABLED_ROLES |
| ENGINES |
| EVENTS |
| FILES |
| INNODB_BUFFER_PAGE |
| INNODB_BUFFER_PAGE_LRU |
| INNODB_BUFFER_POOL_STATS |
| INNODB_CACHED_INDEXES |
| INNODB_CMP |
| INNODB_CMP_PER_INDEX |
| INNODB_CMP_PER_INDEX_RESET |
| INNODB_CMP_RESET |
| INNODB_CMPMEM |
| INNODB_CMPMEM_RESET |
| INNODB_COLUMNS |
| INNODB_DATAFILES |
| INNODB_FIELDS |
| INNODB_FOREIGN |
| INNODB_FOREIGN_COLS |
| INNODB_FT_BEING_DELETED |
| INNODB_FT_CONFIG |
| INNODB_FT_DEFAULT_STOPWORD |
| INNODB_FT_DELETED |
| INNODB_FT_INDEX_CACHE |
| INNODB_FT_INDEX_TABLE |
| INNODB_INDEXES |
| INNODB_METRICS |
| INNODB_SESSION_TEMP_TABLESPACES |
| INNODB_TABLES |
| INNODB_TABLESPACES |
| INNODB_TABLESPACES_BRIEF |
| INNODB_TABLESTATS |
| INNODB_TEMP_TABLE_INFO |
| INNODB_TRX |
| INNODB_VIRTUAL |
| KEY_COLUMN_USAGE |
| KEYWORDS |
| OPTIMIZER_TRACE |
| PARAMETERS |
| PARTITIONS |
| PLUGINS |
| PROCESSLIST |
| PROFILING |
| REFERENTIAL_CONSTRAINTS |
| RESOURCE_GROUPS |
| ROLE_COLUMN_GRANTS |
| ROLE_ROUTINE_GRANTS |
| ROLE_TABLE_GRANTS |
| ROUTINES |
| SCHEMA_PRIVILEGES |
| SCHEMATA |
| SCHEMATA_EXTENSIONS |
| ST_GEOMETRY_COLUMNS |
| ST_SPATIAL_REFERENCE_SYSTEMS |
| ST_UNITS_OF_MEASURE |
| STATISTICS |
| TABLE_CONSTRAINTS |
| TABLE_CONSTRAINTS_EXTENSIONS |
| TABLE_PRIVILEGES |
| TABLES |
| TABLES_EXTENSIONS |
| TABLESPACES |
| TABLESPACES_EXTENSIONS |
| TRIGGERS |
| USER_ATTRIBUTES |
| USER_PRIVILEGES |
| VIEW_ROUTINE_USAGE |
| VIEW_TABLE_USAGE |
| VIEWS |
+---------------------------------------+
```














This release complies with VEP-3 which removes the upgrade order requirement. Components can be upgraded in any order. It is recommended that the upgrade order should still be followed if possible, except to canary test the new version of VTGate before upgrading the rest of the components.

## Known Issues
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ func TestInformationSchemaWithSubquery(t *testing.T) {
mcmp.AssertIsEmpty("SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = (SELECT SCHEMA()) AND TABLE_NAME = 'not_exists'")
}

func TestInformationSchemaTablesQuery(t *testing.T) {
mcmp, closer := start(t)
defer closer()

mcmp.AssertIsEmpty("SELECT TABLE_NAME, TABLE_SCHEMA FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_SCHEMA NOT IN ('sys', 'mysql', 'information_schema', 'performance_schema')")
}

func TestInformationSchemaQueryGetsRoutedToTheRightTableAndKeyspace(t *testing.T) {
t.Skip("flaky. skipping for now")
mcmp, closer := start(t)
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/planbuilder/operators/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ func (r *Route) planIsExpr(ctx *plancontext.PlanningContext, node *sqlparser.IsE
return r.haveMatchingVindex(ctx, node, vdValue, column, val, opcodeF, justTheVindex)
}

func createRoute(ctx *plancontext.PlanningContext, table *QueryTable, solves semantics.TableSet) (*Route, error) {
func createRoute(ctx *plancontext.PlanningContext, table *QueryTable, solves semantics.TableSet) (Operator, error) {
if table.IsInfSchema {
return createInfSchemaRoute(ctx, table)
}
Expand Down
15 changes: 12 additions & 3 deletions go/vt/vtgate/planbuilder/operators/route_planning.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ func seedOperatorList(ctx *plancontext.PlanningContext, qg *QueryGraph) ([]Opera
return nil, err
}
if qg.NoDeps != nil {
plan.Source, err = PushPredicate(ctx, qg.NoDeps, plan.Source)
plan, err = PushPredicate(ctx, qg.NoDeps, plan)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -333,7 +333,7 @@ func tryRewriteOrToIn(expr sqlparser.Expr) sqlparser.Expr {
return nil
}

func createInfSchemaRoute(ctx *plancontext.PlanningContext, table *QueryTable) (*Route, error) {
func createInfSchemaRoute(ctx *plancontext.PlanningContext, table *QueryTable) (Operator, error) {
ks, err := ctx.VSchema.AnyKeyspace()
if err != nil {
return nil, err
Expand Down Expand Up @@ -369,7 +369,16 @@ func createInfSchemaRoute(ctx *plancontext.PlanningContext, table *QueryTable) (
r.SysTableTableName[bvName] = out
}
}
return r, nil
name, err := table.Alias.TableName()
col := &sqlparser.ColName{Qualifier: name, Name: sqlparser.NewIdentifierCI("TABLE_SCHEMA")}
lit := sqlparser.NewStrLiteral("_vt")
cmp := &sqlparser.ComparisonExpr{
Operator: sqlparser.NotEqualOp,
Left: col,
Right: lit,
}

return PushPredicate(ctx, cmp, r)
}

func mergeRoutes(ctx *plancontext.PlanningContext, qg *QueryGraph, physicalOps []Operator, planCache opCacheMap, crossJoinsOK bool) (Operator, error) {
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/planbuilder/testdata/onecase.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{
"comment": "Add your test case here for debugging and run go test -run=One.",
"query": "",
"query": "SELECT TABLE_NAME, TABLE_SCHEMA FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_SCHEMA NOT IN ('sys', 'mysql', 'information_schema', 'performance_schema')",
"plan": {

}
Expand Down

0 comments on commit c4d0d22

Please sign in to comment.