diff options
author | Matt Joiner <anacrolix@gmail.com> | 2019-11-07 09:49:47 +1100 |
---|---|---|
committer | Matt Joiner <anacrolix@gmail.com> | 2019-11-07 09:49:47 +1100 |
commit | ba3d23992bd41606eae36fe2f1858d336f3d6699 (patch) | |
tree | 4ef6bb4857ff9c2a3767715eebd022ac7d029030 /funcs.go | |
parent | Add Tx.String (diff) | |
download | stm-ba3d23992bd41606eae36fe2f1858d336f3d6699.tar.gz stm-ba3d23992bd41606eae36fe2f1858d336f3d6699.tar.xz |
Throw away writes in failed Select operations
Note there's no test for this yet, afaik, and clearly it's not optimized. It also wasn't the cause of the issue I thought i was seeing, but is more correct.
Diffstat (limited to 'funcs.go')
-rw-r--r-- | funcs.go | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -105,8 +105,14 @@ func Select(fns ...Operation) Operation { case 1: return fns[0](tx) default: + oldWrites := tx.writes + tx.writes = make(map[*Var]interface{}, len(oldWrites)) + for k, v := range oldWrites { + tx.writes[k] = v + } ret, retry := catchRetry(fns[0], tx) if retry { + tx.writes = oldWrites return Select(fns[1:]...)(tx) } else { return ret |