Skip to content

Commit

Permalink
reduce NOWAIT usage to tables with unique keys for foreign key plans (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
harshit-gangal authored Dec 20, 2023
1 parent ed5e67f commit c4b275c
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 93 deletions.
6 changes: 3 additions & 3 deletions go/vt/vtgate/planbuilder/operators/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func createOperatorFromDelete(ctx *plancontext.PlanningContext, deleteStmt *sqlp
panic(vterrors.VT12001("foreign keys management at vitess with limit"))
}

return createFkCascadeOpForDelete(ctx, delOp, delClone, childFks)
return createFkCascadeOpForDelete(ctx, delOp, delClone, childFks, vindexTable)

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Region Sharding example using etcd on ubuntu-22.04

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl_stress_suite)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl_stress)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (21)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_partial_movetables_sequences)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / End-to-End Test (Race)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (tabletmanager_tablegc)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl_stress_suite) mysql57

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / End-to-End Test

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (backup_pitr) mysql57

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (topo_connection_cache)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Analyze (javascript)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (mysql80)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_partial_movetables_basic)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (backup_pitr_xtrabackup) mysql57

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Local example using etcd on ubuntu-22.04

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run Upgrade Downgrade Test - Reparent Old Vtctl

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_tablet_healthcheck_cache)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Analyze (python)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (schemadiff_vrepl)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Local example using consul on ubuntu-22.04

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl_stress) mysql57

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtbackup)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_scheduler)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vstream_failover)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (22)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Analyze (go)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (13)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (xb_backup) mysql57

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_foreignkey_stress)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_schema)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run Upgrade Downgrade Test - Backups - E2E

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (xb_backup)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_migrate_vdiff2_convert_tz)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_godriver)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_general_heavy)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vstream_stoponreshard_false)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_concurrentdml)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_vschema)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_multicell)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_revert)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_readafterwrite)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_topo_etcd)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vstream_stoponreshard_true)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (12)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_ghost)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_transaction)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_vindex_heavy)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_reservedconn)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_unsharded)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_foreign_key_stress)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (mysql_server_vault)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_gen4)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl) mysql57

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (backup_pitr_xtrabackup)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_queries)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_partial_keyspace)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vstream_with_keyspaces_to_watch)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_revert) mysql57

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_basic)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtorc)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_cellalias)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (ers_prs_newfeatures_heavy)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_topo)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (18)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl_suite) mysql57

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Unit Test (mysql57)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_v2)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_ghost) mysql57

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Unit Test (Race)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (xb_recovery)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_topo_consul)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (tabletmanager_consul)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Unit Test (mysql80)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Static Code Checks Etc

undefined: vindexTable) (typecheck)

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Static Code Checks Etc

undefined: vindexTable (typecheck)

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Static Code Checks Etc

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl_suite)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_schema_tracker)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (xb_recovery) mysql57

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (tabletmanager_throttler_topo)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtctlbackup_sharded_clustertest_heavy)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (backup_pitr)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (tabletmanager_tablegc) mysql57

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_scheduler) mysql57

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run Upgrade Downgrade Test - Query Serving (Schema)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run Upgrade Downgrade Test - Query Serving (Queries)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtorc) mysql57

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Docker Test Cluster 10

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Docker Test Cluster 10

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vttablet_prscomplex)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run Upgrade Downgrade Test - Reparent Old VTTablet

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (schemadiff_vrepl) mysql57

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_across_db_versions)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (15)

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Docker Test Cluster 25

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Docker Test Cluster 25

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Docker Test Cluster 25

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Docker Test Cluster 25

undefined: vindexTable

Check failure on line 113 in go/vt/vtgate/planbuilder/operators/delete.go

View workflow job for this annotation

GitHub Actions / Run Upgrade Downgrade Test - Backups - Manual

undefined: vindexTable
}

func createDeleteOperator(ctx *plancontext.PlanningContext, del *sqlparser.Delete) Operator {
Expand Down Expand Up @@ -193,7 +193,7 @@ func updateQueryGraphWithSource(ctx *plancontext.PlanningContext, input Operator
return vTbl
}

func createFkCascadeOpForDelete(ctx *plancontext.PlanningContext, parentOp Operator, delStmt *sqlparser.Delete, childFks []vindexes.ChildFKInfo) Operator {
func createFkCascadeOpForDelete(ctx *plancontext.PlanningContext, parentOp Operator, delStmt *sqlparser.Delete, childFks []vindexes.ChildFKInfo, deletedTbl *vindexes.Table) Operator {
var fkChildren []*FkChild
var selectExprs []sqlparser.SelectExpr
for _, fk := range childFks {
Expand All @@ -210,7 +210,7 @@ func createFkCascadeOpForDelete(ctx *plancontext.PlanningContext, parentOp Opera
fkChildren = append(fkChildren,
createFkChildForDelete(ctx, fk, offsets))
}
selectionOp := createSelectionOp(ctx, selectExprs, delStmt.TableExprs, delStmt.Where, nil, nil, sqlparser.ForUpdateLockNoWait)
selectionOp := createSelectionOp(ctx, selectExprs, delStmt.TableExprs, delStmt.Where, nil, nil, getUpdateLock(deletedTbl))

return &FkCascade{
Selection: selectionOp,
Expand Down
20 changes: 17 additions & 3 deletions go/vt/vtgate/planbuilder/operators/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ func createFKCascadeOp(ctx *plancontext.PlanningContext, parentOp Operator, updS
fkChildren = append(fkChildren, fkChild)
}

selectionOp := createSelectionOp(ctx, selectExprs, updStmt.TableExprs, updStmt.Where, updStmt.OrderBy, nil, sqlparser.ForUpdateLockNoWait)
selectionOp := createSelectionOp(ctx, selectExprs, updStmt.TableExprs, updStmt.Where, updStmt.OrderBy, nil, getUpdateLock(updatedTable))

return &FkCascade{
Selection: selectionOp,
Expand Down Expand Up @@ -658,7 +658,21 @@ func createFkVerifyOpForParentFKForUpdate(ctx *plancontext.PlanningContext, upda
sqlparser.NewWhere(sqlparser.WhereClause, whereCond),
nil,
sqlparser.NewLimitWithoutOffset(1),
sqlparser.ForShareLockNoWait)
getVerifyLock(updatedTable))
}

func getVerifyLock(vTbl *vindexes.Table) sqlparser.Lock {
if len(vTbl.UniqueKeys) > 0 {
return sqlparser.ForShareLockNoWait
}
return sqlparser.ForShareLock
}

func getUpdateLock(vTbl *vindexes.Table) sqlparser.Lock {
if len(vTbl.UniqueKeys) > 0 {
return sqlparser.ForUpdateLockNoWait
}
return sqlparser.ForUpdateLock
}

// Each child foreign key constraint is verified by a join query of the form:
Expand Down Expand Up @@ -728,7 +742,7 @@ func createFkVerifyOpForChildFKForUpdate(ctx *plancontext.PlanningContext, updat
sqlparser.NewWhere(sqlparser.WhereClause, whereCond),
nil,
sqlparser.NewLimitWithoutOffset(1),
sqlparser.ForShareLockNoWait)
getVerifyLock(updatedTable))
}

// nullSafeNotInComparison is used to compare the child columns in the foreign key constraint aren't the same as the updateExpressions exactly.
Expand Down
Loading

0 comments on commit c4b275c

Please sign in to comment.