Skip to content

Commit

Permalink
[release-18.0] VReplication TableStreamer: Only stream tables in tabl…
Browse files Browse the repository at this point in the history
…estreamer (ignore views) (#14646) (#14649)

Signed-off-by: Rohit Nayak <[email protected]>
Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com>
Co-authored-by: Rohit Nayak <[email protected]>
  • Loading branch information
vitess-bot[bot] and rohit-nayak-ps authored Nov 30, 2023
1 parent f004f79 commit e2b37f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions go/test/endtoend/vreplication/fk_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ var (
initialFKSchema = `
create table parent(id int, name varchar(128), primary key(id)) engine=innodb;
create table child(id int, parent_id int, name varchar(128), primary key(id), foreign key(parent_id) references parent(id) on delete cascade) engine=innodb;
create view vparent as select * from parent;
`
initialFKData = `
insert into parent values(1, 'parent1'), (2, 'parent2');
Expand Down
7 changes: 6 additions & 1 deletion go/vt/vttablet/tabletserver/vstreamer/tablestreamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"vitess.io/vitess/go/sqltypes"
"vitess.io/vitess/go/vt/dbconfigs"
"vitess.io/vitess/go/vt/log"
"vitess.io/vitess/go/vt/mysqlctl/tmutils"
"vitess.io/vitess/go/vt/vttablet/tabletserver/schema"

binlogdatapb "vitess.io/vitess/go/vt/proto/binlogdata"
Expand Down Expand Up @@ -109,12 +110,16 @@ func (ts *tableStreamer) Stream() error {
return err
}

rs, err := conn.ExecuteFetch("show tables", -1, true)
rs, err := conn.ExecuteFetch("show full tables", -1, true)
if err != nil {
return err
}
for _, row := range rs.Rows {
tableName := row[0].ToString()
tableType := row[1].ToString()
if tableType != tmutils.TableBaseTable {
continue
}
if schema2.IsInternalOperationTableName(tableName) {
log.Infof("Skipping internal table %s", tableName)
continue
Expand Down

0 comments on commit e2b37f6

Please sign in to comment.