Skip to content

Commit

Permalink
Address more review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Rohit Nayak <[email protected]>
  • Loading branch information
rohit-nayak-ps committed Nov 26, 2023
1 parent 89ec701 commit d525b8e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions go/test/endtoend/vreplication/fk_ext_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,9 @@ func TestFKExt(t *testing.T) {
})

t.Run("MoveTables from unsharded to sharded keyspace", func(t *testing.T) {
// Migrate data from target1Keyspace to the sharded target2Keyspace. Streams only from primaries
// for one shard and replica for the other shard. Constraints have been dropped from this replica.
// Migrate data from target1Keyspace to the sharded target2Keyspace. Drops constraints from
// replica to simulate a replica that is not doing cascades in innodb to test vtgate's fkmanaged mode.
// The replica with dropped constraints is used as source for the next workflow called in materializeTables().
moveKeyspace(t)
})

Expand Down Expand Up @@ -415,15 +416,15 @@ func importIntoVitess(t *testing.T) {
const getConstraintsQuery = `
SELECT CONSTRAINT_NAME, TABLE_NAME
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
WHERE TABLE_SCHEMA = ` + "'%s'" + ` AND REFERENCED_TABLE_NAME IS NOT NULL;
WHERE TABLE_SCHEMA = '%s' AND REFERENCED_TABLE_NAME IS NOT NULL;
`

// dropReplicaConstraints drops all foreign key constraints on replica tables for a given keyspace/shard.
// We do this so that we can replay binlogs from a replica which is not doing cascades but just replaying
// the binlogs created by the primary. This will confirm that vtgate is doing the cascades correctly.
func dropReplicaConstraints(t *testing.T, keyspaceName string, tablet *cluster.VttabletProcess) {
var dropConstraints []string

require.Equal(t, "replica", strings.ToLower(tablet.TabletType))
dbName := "vt_" + keyspaceName
qr, err := tablet.QueryTablet(fmt.Sprintf(getConstraintsQuery, dbName), keyspaceName, true)
if err != nil {
Expand Down

0 comments on commit d525b8e

Please sign in to comment.