Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
35749: sql: fix error being swallowed by the sql row writer r=vivekmenezes a=vivekmenezes

This fixes data inconsistencies when value encoding fails for
some reason.

Release note: None

Co-authored-by: Vivek Menezes <[email protected]>
  • Loading branch information
craig[bot] and vivekmenezes committed Mar 15, 2019
2 parents 02a7d96 + adc4823 commit f3a6c85
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pkg/sql/row/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ func (ru *Updater) UpdateRow(
ru.marshaled, ru.UpdateColIDtoRowIndex,
&ru.key, &ru.value, ru.valueBuf, insertPutFn, true /* overwrite */, traceKV)
if err != nil {
return ru.newValues, nil
return nil, err
}

// Update secondary indexes.
Expand Down Expand Up @@ -808,11 +808,10 @@ func (ru *Updater) UpdateRow(
if err := ru.Fks.addIndexChecks(ctx, oldValues, ru.newValues, traceKV); err != nil {
return nil, err
}
if !ru.Fks.hasFKs() {
return ru.newValues, nil
}
if err := ru.Fks.checker.runCheck(ctx, oldValues, ru.newValues); err != nil {
return nil, err
if ru.Fks.hasFKs() {
if err := ru.Fks.checker.runCheck(ctx, oldValues, ru.newValues); err != nil {
return nil, err
}
}
}

Expand Down

0 comments on commit f3a6c85

Please sign in to comment.