@@ -1651,14 +1651,6 @@ func TestSemiSyncRequiredWithTwoPC(t *testing.T) {
1651
1651
1652
1652
out , err := clusterInstance .VtctldClientProcess .ExecuteCommandWithOutput ("SetKeyspaceDurabilityPolicy" , keyspaceName , "--durability-policy=none" )
1653
1653
require .NoError (t , err , out )
1654
- defer func () {
1655
- _ , err = clusterInstance .VtctldClientProcess .ExecuteCommandWithOutput ("SetKeyspaceDurabilityPolicy" , keyspaceName , "--durability-policy=semi_sync" )
1656
- require .NoError (t , err )
1657
- for _ , shard := range clusterInstance .Keyspaces [0 ].Shards {
1658
- err = clusterInstance .VtctldClientProcess .PlannedReparentShard (keyspaceName , shard .Name , shard .Vttablets [0 ].Alias )
1659
- require .NoError (t , err )
1660
- }
1661
- }()
1662
1654
1663
1655
// After changing the durability policy for the given keyspace to none, we run PRS.
1664
1656
shard := clusterInstance .Keyspaces [0 ].Shards [2 ]
@@ -1677,4 +1669,18 @@ func TestSemiSyncRequiredWithTwoPC(t *testing.T) {
1677
1669
_ , err = utils .ExecAllowError (t , conn , "commit" )
1678
1670
require .Error (t , err )
1679
1671
require .ErrorContains (t , err , "two-pc is enabled, but semi-sync is not" )
1672
+
1673
+ _ , err = clusterInstance .VtctldClientProcess .ExecuteCommandWithOutput ("SetKeyspaceDurabilityPolicy" , keyspaceName , "--durability-policy=semi_sync" )
1674
+ require .NoError (t , err )
1675
+ for _ , shard := range clusterInstance .Keyspaces [0 ].Shards {
1676
+ err = clusterInstance .VtctldClientProcess .PlannedReparentShard (keyspaceName , shard .Name , shard .Vttablets [0 ].Alias )
1677
+ require .NoError (t , err )
1678
+ }
1679
+
1680
+ utils .Exec (t , conn , "begin" )
1681
+ utils .Exec (t , conn , "insert into twopc_t1(id, col) values(4, 4)" )
1682
+ utils .Exec (t , conn , "insert into twopc_t1(id, col) values(6, 4)" )
1683
+ utils .Exec (t , conn , "insert into twopc_t1(id, col) values(9, 4)" )
1684
+ _ , err = utils .ExecAllowError (t , conn , "commit" )
1685
+ require .NoError (t , err )
1680
1686
}
0 commit comments