Skip to content

Commit

Permalink
Minor changes from self review
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <[email protected]>
  • Loading branch information
mattlord committed Feb 1, 2025
1 parent 6616100 commit 157497f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion go/test/endtoend/vreplication/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ import (
// default collation as it has to work across versions and the 8.0 default does not exist in 5.7.
var (
// All standard user tables should have a primary key and at least one secondary key.
customerTypes = []string{"'individual'", "'soho'", "'enterprise'"}
customerTypes = []string{"'individual'", "'soho'", "'enterprise'"}
// We use utf8mb4_general_ci so that we can test with 5.7 and 8.0+.
customerTableTemplate = `create table customer(cid int auto_increment, name varchar(128) collate utf8mb4_general_ci, meta json default null,
industryCategory varchar(100) generated always as (json_extract(meta, _utf8mb4'$.industry')) virtual, typ enum(%s),
sport set('football','cricket','baseball'), ts timestamp not null default current_timestamp, bits bit(2) default b'11', date1 datetime not null default '0000-00-00 00:00:00',
Expand Down
5 changes: 2 additions & 3 deletions go/vt/vttablet/tabletserver/vstreamer/rowstreamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ func (rs *rowStreamer) buildSelect(st *binlogdatapb.MinimalTable) (string, error
indexHint = fmt.Sprintf(" force index (%s)", escapedPKIndexName)
}
buf.Myprintf(" from %v%s", sqlparser.NewIdentifierCS(rs.plan.Table.Name), indexHint)
if len(rs.lastpk) != 0 { // We're in the copy phase and need to resume
if len(rs.lastpk) != 0 { // We're in Nth copy phase cycle and need to resume
if len(rs.lastpk) != len(rs.pkColumns) {
return "", fmt.Errorf("cannot build a row streamer plan for the %s table as a lastpk value was provided and the number of primary key values within it (%v) does not match the number of primary key columns in the table (%d)",
st.Name, rs.lastpk, rs.pkColumns)
Expand All @@ -310,14 +310,13 @@ func (rs *rowStreamer) buildSelect(st *binlogdatapb.MinimalTable) (string, error
for i, pk := range rs.pkColumns[:lastcol] {
buf.Myprintf("%v = ", sqlparser.NewIdentifierCI(rs.plan.Table.Fields[pk].Name))
rs.lastpk[i].EncodeSQL(buf)
// Only AND expressions are supported.
buf.Myprintf(" and ")
}
buf.Myprintf("%v > ", sqlparser.NewIdentifierCI(rs.plan.Table.Fields[rs.pkColumns[lastcol]].Name))
rs.lastpk[lastcol].EncodeSQL(buf)
buf.Myprintf(")")
}
} else if len(rs.plan.whereExprsToPushDown) > 0 { // We're in the running/replicating phase
} else if len(rs.plan.whereExprsToPushDown) > 0 { // We're in the first copy phase cycle
buf.Myprintf(" where ")
addPushdownExpressions()
}
Expand Down

0 comments on commit 157497f

Please sign in to comment.