Skip to content

Commit

Permalink
VReplication TableStreamer: Only stream tables in tablestreamer (igno…
Browse files Browse the repository at this point in the history
…re views) (#14646)

Signed-off-by: Rohit Nayak <[email protected]>
  • Loading branch information
rohit-nayak-ps authored Nov 30, 2023
1 parent e818ca5 commit b28197b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
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
10 changes: 7 additions & 3 deletions go/vt/vttablet/tabletserver/vstreamer/tablestreamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ import (
"strings"
"sync/atomic"

"vitess.io/vitess/go/vt/vttablet"

"vitess.io/vitess/go/sqlescape"
"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"
"vitess.io/vitess/go/vt/vttablet/tabletserver/schema"

binlogdatapb "vitess.io/vitess/go/vt/proto/binlogdata"
Expand Down Expand Up @@ -117,12 +117,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 b28197b

Please sign in to comment.