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

vttablet: do not notify vtgate about internal tables #13897

Merged
merged 2 commits into from
Aug 31, 2023
Merged
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
18 changes: 18 additions & 0 deletions go/vt/vttablet/endtoend/healthstream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,35 +34,48 @@ func TestSchemaChange(t *testing.T) {
tName string
expectedChange string
ddl string
expectTimeout bool
}{
{
"create table 1",
"vitess_sc1",
"create table vitess_sc1(id bigint primary key)",
false,
}, {
"create table 2",
"vitess_sc2",
"create table vitess_sc2(id bigint primary key)",
false,
}, {
"create internal table",
"_vt_HOLD_6ace8bcef73211ea87e9f875a4d24e90_20200915120410",
"create table _vt_HOLD_6ace8bcef73211ea87e9f875a4d24e90_20200915120410(id bigint primary key)",
true,
}, {
"add column 1",
"vitess_sc1",
"alter table vitess_sc1 add column newCol varchar(50)",
false,
}, {
"add column 2",
"vitess_sc2",
"alter table vitess_sc2 add column newCol varchar(50)",
false,
}, {
"remove column",
"vitess_sc1",
"alter table vitess_sc1 drop column newCol",
false,
}, {
"drop table 2",
"vitess_sc2",
"drop table vitess_sc2",
false,
}, {
"drop table 1",
"vitess_sc1",
"drop table vitess_sc1",
false,
},
}

Expand All @@ -85,9 +98,14 @@ func TestSchemaChange(t *testing.T) {
select {
case res := <-ch: // get the schema notification
if slices.Contains(res, tc.expectedChange) {
assert.False(t, tc.expectTimeout)
return
}
case <-timeout:
if tc.expectTimeout {
// This is what we wanted!
return
}
t.Errorf("timed out waiting for a schema notification")
return
}
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vttablet/endtoend/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ var tableACLConfig = `{
},
{
"name": "vitess_healthstream",
"table_names_or_prefixes": ["vitess_sc1", "vitess_sc2"],
"table_names_or_prefixes": ["vitess_sc1", "vitess_sc2", "_vt_HOLD_6ace8bcef73211ea87e9f875a4d24e90_20200915120410"],
"readers": ["dev"],
"writers": ["dev"],
"admins": ["dev"]
Expand Down
4 changes: 4 additions & 0 deletions go/vt/vttablet/tabletserver/health_streamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (

"vitess.io/vitess/go/constants/sidecar"

vtschema "vitess.io/vitess/go/vt/schema"
"vitess.io/vitess/go/vt/vttablet/tabletserver/schema"

"vitess.io/vitess/go/vt/servenv"
Expand Down Expand Up @@ -365,6 +366,9 @@ func (hs *healthStreamer) reload(full map[string]*schema.Table, created, altered
// Range over the tables that are created/altered and split them up based on their type.
for _, table := range append(append(dropped, created...), altered...) {
tableName := table.Name.String()
if vtschema.IsInternalOperationTableName(tableName) {
continue
}
if table.Type == schema.View && hs.viewsEnabled {
views = append(views, tableName)
} else {
Expand Down