Commit 233e0e4
* Don’t swallow the cause of a TX termination.
There are a couple of scenarions in which a transaction gets terminated. The cause will be propagated by the pull handler and the transaction will be marked accordingly. There might be a chance that a degration from a leader to a follower on the server side happens in between to calls to a run method on that transaction: The transaction is still open, but cannot run queries any longer. Outside a transactional function this leads correctly to a ClientException. Inside a transactional function, this must not happen.
The retry logic must be able to find the cause of the termination and if there’s any, it should judge on the cause if it retries or not.
This PR changes the following:
- Add a StateHolder to the UnmangedTransaction
- The holder is necessary to keep the single field volatie
- The holder holds the state and a possible cause of termination
- The holder is able to determine whether a session is still open or not.
- It removes markTerminated from InternalAsyncTransaction as it was used only for tests.
* Polishing.
This removes the circular dependency between holder and state. I had introduced it cause I wanted to avoid object allocation. This solution here is better: It also creates only 3 different holders for non terminated states, but without the circular dependency.
Co-authored-by: Gregory Woods <gregory.woods@neo4j.com>
Co-authored-by: Michael Simons <michael.simons@neo4j.com>
1 parent b4ee589 commit 233e0e4
File tree
17 files changed
+514
-116
lines changed- driver/src
- main/java/org/neo4j/driver/internal
- async
- handlers
- reactive
- retry
- test
- java/org/neo4j/driver
- integration
- internal
- async
- handlers
- pulln
- reactive
- retry
- resources
17 files changed
+514
-116
lines changedLines changed: 0 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | 53 | | |
59 | 54 | | |
60 | 55 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
| 141 | + | |
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| |||
Lines changed: 71 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
61 | 115 | | |
62 | 116 | | |
63 | 117 | | |
64 | 118 | | |
65 | 119 | | |
66 | 120 | | |
67 | | - | |
| 121 | + | |
68 | 122 | | |
69 | 123 | | |
70 | 124 | | |
| |||
104 | 158 | | |
105 | 159 | | |
106 | 160 | | |
107 | | - | |
| 161 | + | |
108 | 162 | | |
109 | 163 | | |
110 | 164 | | |
111 | | - | |
| 165 | + | |
112 | 166 | | |
113 | 167 | | |
114 | 168 | | |
| |||
122 | 176 | | |
123 | 177 | | |
124 | 178 | | |
125 | | - | |
| 179 | + | |
126 | 180 | | |
127 | 181 | | |
128 | 182 | | |
129 | | - | |
| 183 | + | |
130 | 184 | | |
131 | 185 | | |
132 | 186 | | |
| |||
158 | 212 | | |
159 | 213 | | |
160 | 214 | | |
161 | | - | |
| 215 | + | |
162 | 216 | | |
163 | 217 | | |
164 | | - | |
| 218 | + | |
165 | 219 | | |
166 | | - | |
| 220 | + | |
167 | 221 | | |
168 | 222 | | |
169 | 223 | | |
| |||
173 | 227 | | |
174 | 228 | | |
175 | 229 | | |
176 | | - | |
| 230 | + | |
177 | 231 | | |
178 | 232 | | |
179 | 233 | | |
180 | | - | |
| 234 | + | |
181 | 235 | | |
182 | 236 | | |
183 | 237 | | |
184 | | - | |
| 238 | + | |
185 | 239 | | |
186 | 240 | | |
187 | | - | |
| 241 | + | |
188 | 242 | | |
189 | 243 | | |
190 | 244 | | |
191 | 245 | | |
192 | 246 | | |
193 | | - | |
| 247 | + | |
194 | 248 | | |
195 | 249 | | |
196 | | - | |
| 250 | + | |
197 | 251 | | |
198 | 252 | | |
199 | 253 | | |
200 | 254 | | |
201 | 255 | | |
202 | 256 | | |
203 | | - | |
| 257 | + | |
204 | 258 | | |
205 | 259 | | |
206 | 260 | | |
| |||
224 | 278 | | |
225 | 279 | | |
226 | 280 | | |
227 | | - | |
| 281 | + | |
228 | 282 | | |
229 | 283 | | |
230 | 284 | | |
231 | | - | |
| 285 | + | |
232 | 286 | | |
233 | 287 | | |
234 | 288 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| |||
Lines changed: 57 additions & 39 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
100 | 101 | | |
101 | 102 | | |
102 | 103 | | |
103 | | - | |
| 104 | + | |
104 | 105 | | |
| 106 | + | |
105 | 107 | | |
106 | 108 | | |
107 | 109 | | |
| |||
122 | 124 | | |
123 | 125 | | |
124 | 126 | | |
125 | | - | |
126 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
127 | 131 | | |
128 | 132 | | |
129 | 133 | | |
| |||
144 | 148 | | |
145 | 149 | | |
146 | 150 | | |
147 | | - | |
148 | | - | |
149 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
150 | 169 | | |
151 | 170 | | |
152 | 171 | | |
153 | 172 | | |
154 | | - | |
155 | | - | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
156 | 179 | | |
157 | 180 | | |
158 | 181 | | |
159 | 182 | | |
160 | | - | |
| 183 | + | |
161 | 184 | | |
162 | 185 | | |
163 | | - | |
| 186 | + | |
164 | 187 | | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
174 | 193 | | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
180 | 199 | | |
181 | | - | |
182 | | - | |
| 200 | + | |
| 201 | + | |
183 | 202 | | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
188 | 208 | | |
189 | | - | |
190 | | - | |
191 | | - | |
| 209 | + | |
192 | 210 | | |
193 | | - | |
194 | | - | |
| 211 | + | |
195 | 212 | | |
196 | 213 | | |
197 | 214 | | |
| |||
249 | 266 | | |
250 | 267 | | |
251 | 268 | | |
252 | | - | |
253 | | - | |
| 269 | + | |
| 270 | + | |
254 | 271 | | |
| 272 | + | |
255 | 273 | | |
256 | 274 | | |
257 | 275 | | |
| |||
269 | 287 | | |
270 | 288 | | |
271 | 289 | | |
272 | | - | |
273 | | - | |
| 290 | + | |
| 291 | + | |
274 | 292 | | |
275 | 293 | | |
276 | 294 | | |
| |||
0 commit comments