Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
[hotfix] Revert delete by destination owned vindexes
Browse files Browse the repository at this point in the history
Cherrypick keep deletevindexentries for scatter queries: vitessio#6542
  • Loading branch information
brirams authored Aug 6, 2020
2 parents 8fa68d5 + aa719a4 commit aa70055
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion go/vt/vtgate/engine/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (del *Delete) Execute(vcursor VCursor, bindVars map[string]*querypb.BindVar
case In:
return del.execDeleteIn(vcursor, bindVars)
case Scatter:
return del.execDeleteByDestination(vcursor, bindVars, key.DestinationAllShards{})
return del.execDeleteScatter(vcursor, bindVars, key.DestinationAllShards{})
case ByDestination:
return del.execDeleteByDestination(vcursor, bindVars, del.TargetDestination)
default:
Expand Down Expand Up @@ -153,6 +153,26 @@ func (del *Delete) execDeleteByDestination(vcursor VCursor, bindVars map[string]
return nil, vterrors.Wrap(err, "execDeleteScatter")
}

queries := make([]*querypb.BoundQuery, len(rss))
for i := range rss {
queries[i] = &querypb.BoundQuery{
Sql: del.Query,
BindVariables: bindVars,
}
}
// TODO @rafael: Add supports for owned vindexes here.
// At the moment this will leave orphaned rows in the owned vindex.
// However when using this functionality we are assuming the user
// is intending to bypass V3 functionality.
return execMultiShard(vcursor, rss, queries, del.MultiShardAutocommit)
}

func (del *Delete) execDeleteScatter(vcursor VCursor, bindVars map[string]*querypb.BindVariable, dest key.Destination) (*sqltypes.Result, error) {
rss, _, err := vcursor.ResolveDestinations(del.Keyspace.Name, nil, []key.Destination{dest})
if err != nil {
return nil, vterrors.Wrap(err, "execDeleteScatter")
}

queries := make([]*querypb.BoundQuery, len(rss))
for i := range rss {
queries[i] = &querypb.BoundQuery{
Expand Down

0 comments on commit aa70055

Please sign in to comment.