satellite/satellitedb: only reject orders if row not found

any database error doesn't mean the order wasn't found. for example
in cockroach it may say that the transaction is aborted. then what?
maybe we get big old row level deadlocks like we've observed? so
instead explicitly check for ErrNoRows to reject the order and bail
out otherwise. the surrounding logic will give it a retry.

Change-Id: I6e1f8f6e6a6def3e45b44f5088cbdc158e1098e4
This commit is contained in:
Jeff Wendling 2020-01-10 19:05:53 -07:00
parent 5a1b2f49f4
commit 4aef0e3823

View File

@ -251,9 +251,11 @@ func (db *ordersDB) processOrdersInTx(requests []*orders.ProcessOrderRequest, st
var serialNumberID int64 var serialNumberID int64
var bucketID []byte var bucketID []byte
if err := row.Scan(&serialNumberID, &bucketID); err != nil { if err := row.Scan(&serialNumberID, &bucketID); err == sql.ErrNoRows {
rejected[request.OrderLimit.SerialNumber] = true rejected[request.OrderLimit.SerialNumber] = true
continue continue
} else if err != nil {
return nil, Error.Wrap(err)
} }
var result sql.Result var result sql.Result