Skip to content

Commit

Permalink
Merge pull request #111296 from cockroachdb/blathers/backport-release…
Browse files Browse the repository at this point in the history
…-22.2-102081

release-22.2: workload/tpcc: move tpcc error checks before length checks
  • Loading branch information
DrewKimball authored Sep 27, 2023
2 parents ad4e261 + 2905629 commit e090fac
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions pkg/workload/tpcc/checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,27 @@ ORDER BY
i, order, newOrder, district-1)
}
}
if err := districtRows.Err(); err != nil {
retErr = errors.CombineErrors(retErr, errors.Wrap(err, "on district"))
}
if err := newOrderRows.Err(); err != nil {
retErr = errors.CombineErrors(retErr, errors.Wrap(err, "on new_order"))
}
if err := orderRows.Err(); err != nil {
retErr = errors.CombineErrors(retErr, errors.Wrap(err, "on order"))
}
// Return the error before performing the remaining checks, because they are
// expected to fail if something else has already gone wrong.
if retErr != nil {
return retErr
}
if districtRows.Next() || newOrderRows.Next() || orderRows.Next() {
return errors.New("length mismatch between rows")
}
if i == 0 {
return errors.Errorf("zero rows")
}
retErr = errors.CombineErrors(retErr, districtRows.Err())
retErr = errors.CombineErrors(retErr, newOrderRows.Err())
return errors.CombineErrors(retErr, orderRows.Err())
return nil
}

func check3323(db *gosql.DB, asOfSystemTime string) error {
Expand Down Expand Up @@ -243,18 +255,18 @@ ORDER BY
return errors.Errorf("order.sum(o_ol_cnt): %d != order_line.count(*): %d", left, right)
}
}
if leftRows.Next() || rightRows.Next() {
return errors.Errorf("at %s: length of order.sum(o_ol_cnt) != order_line.count(*)", ts)
}
if i == 0 {
return errors.Errorf("0 rows returned")
}
if err := leftRows.Err(); err != nil {
return errors.Wrap(err, "on `order`")
}
if err := rightRows.Err(); err != nil {
return errors.Wrap(err, "on `order_line`")
}
if leftRows.Next() || rightRows.Next() {
return errors.Errorf("at %s: length of order.sum(o_ol_cnt) != order_line.count(*)", ts)
}
if i == 0 {
return errors.Errorf("0 rows returned")
}
return nil
}

Expand Down

0 comments on commit e090fac

Please sign in to comment.