Commit 5d97c43
committed
Use one commit for the dimensions upsert
Flush+commit (1 transaction) instead of two commits (2 transactions) to
make this atomic.
If two identical dimensions update jobs are picked up by two different
workers, there could a potential concurrency issue. The first upsert has
postgres row locks with on_conflict_do_update and should be fine, but
the FK table update added in #70 was a second transaction without row
lock. In the previous CRUD, there was a window between the first and
second transactions where another concurrent identical job could see the
first transaction (parent row with updated counts) but see that the
child tables would be empty and re-calculate the scaffolds and samples.
This was not a breaking concurrency issue (no data corruption), but an
inefficient one that could cause redundant work.1 parent 183f4f9 commit 5d97c43
1 file changed
Lines changed: 7 additions & 1 deletion
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
137 | 141 | | |
138 | 142 | | |
139 | 143 | | |
140 | 144 | | |
141 | 145 | | |
142 | 146 | | |
| 147 | + | |
| 148 | + | |
143 | 149 | | |
144 | 150 | | |
145 | 151 | | |
| |||
0 commit comments