Commit 4f3d3aa
authored
REP-5324 Normalize error handling. (#59)
In certain cases migration-verifier would log on fatal errors rather than propagating them back up the call stack. This has led to failures to compare documents that were effectively ignored save for being noted in the log. This changeset fixes that so that such exceptional cases will halt the verification.
Broadly speaking, this changeset:
a) brings idiomatic Context propagation in places where context.Background() was used
b) converts Error() logs and “failed” task statuses to returned errors
As of this changeset, any task in “failed” indicates a mismatch rather than a failure to complete the check.
A separate changeset will introduce a retryer to FetchAndCompareDocuments.
Other, specific changes:
- CheckWorker() is rewritten to use an errgroup, which automatically cancels context if a thread fails.
- CheckDriver() now returns errors rather than Error() logging them.
- A few places’ direct checks for ctx.Done() are removed. (They’re superfluous.)
- TestGenerationalRechecking and TestPartitionWithFilter no longer use constant DB names.
- RunForUUIDErrorOnly() now takes a context. (NB: This method is currently unused.)
- Most uses of context.Background() in tests are now suite.Context().
- The unused RecheckTasks is removed from VerificationStatus.1 parent d077573 commit 4f3d3aa
File tree
11 files changed
+457
-313
lines changed- internal
- retry
- verifier
11 files changed
+457
-313
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
| 95 | + | |
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
| 133 | + | |
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
| |||
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
283 | | - | |
| 283 | + | |
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
151 | | - | |
| 150 | + | |
152 | 151 | | |
153 | 152 | | |
154 | 153 | | |
| |||
167 | 166 | | |
168 | 167 | | |
169 | 168 | | |
170 | | - | |
171 | | - | |
| 169 | + | |
172 | 170 | | |
173 | 171 | | |
174 | 172 | | |
| |||
220 | 218 | | |
221 | 219 | | |
222 | 220 | | |
223 | | - | |
224 | | - | |
| 221 | + | |
225 | 222 | | |
226 | 223 | | |
227 | 224 | | |
| |||
0 commit comments