Commit fe31825
committed
refactor(consensuscommit): make CoordinatorCommitHandler context-independent
Decouple the Coordinator-side commit handler from TransactionContext and
WriteSetEncoder. CoordinatorCommitHandler now operates on a transaction id
plus a pre-encoded WriteSet, so the orchestrator (CommitHandler) owns the
WriteSetEncoder and supplies the encoded write set and committedAt.
For group commit, the Emittable value becomes a (fullId, WriteSet) carrier
(CoordinatorGroupCommitValue) so the Emitter is encoder-free: it derives each
child id from the carried full id and stamps the pre-encoded write set. The
WriteSetEncoder therefore lives only in the orchestrator layer, and
WriteSetEncoder#encodeMultiGroupWriteSet and its key-manipulator dependency
are dropped. The group-commit entry point is named groupCommitState (distinct
from the base commitState, whose signature differs) so a caller cannot
silently bind to the base direct-putState overload, and slot cancellation is
id-based (cancelGroupCommit).
Tests are reworked to the id-based signatures, with commitState delegation
routed through protected hooks so the group-commit subclass asserts the
2-arg groupCommitState (committedAt determined at emit time) while the base
asserts the 3-arg orchestrator-provided variant.1 parent 2ebe241 commit fe31825
12 files changed
Lines changed: 552 additions & 610 deletions
File tree
- core/src
- main/java/com/scalar/db/transaction/consensuscommit
- test/java/com/scalar/db/transaction/consensuscommit
Lines changed: 27 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| 55 | + | |
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
| |||
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
68 | | - | |
69 | | - | |
| 70 | + | |
| 71 | + | |
70 | 72 | | |
71 | 73 | | |
72 | 74 | | |
| |||
83 | 85 | | |
84 | 86 | | |
85 | 87 | | |
| 88 | + | |
86 | 89 | | |
87 | 90 | | |
88 | 91 | | |
| 92 | + | |
89 | 93 | | |
90 | 94 | | |
91 | 95 | | |
| |||
292 | 296 | | |
293 | 297 | | |
294 | 298 | | |
295 | | - | |
| 299 | + | |
| 300 | + | |
296 | 301 | | |
297 | 302 | | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
298 | 310 | | |
299 | 311 | | |
300 | | - | |
| 312 | + | |
301 | 313 | | |
302 | 314 | | |
303 | 315 | | |
304 | 316 | | |
305 | | - | |
| 317 | + | |
| 318 | + | |
306 | 319 | | |
307 | 320 | | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
308 | 324 | | |
309 | 325 | | |
310 | | - | |
| 326 | + | |
311 | 327 | | |
312 | 328 | | |
313 | 329 | | |
| |||
Lines changed: 47 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
59 | | - | |
60 | | - | |
| 60 | + | |
| 61 | + | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| |||
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| 70 | + | |
69 | 71 | | |
70 | 72 | | |
71 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
72 | 78 | | |
73 | 79 | | |
74 | 80 | | |
| |||
81 | 87 | | |
82 | 88 | | |
83 | 89 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
95 | 93 | | |
96 | 94 | | |
97 | 95 | | |
98 | 96 | | |
99 | 97 | | |
100 | | - | |
| 98 | + | |
101 | 99 | | |
102 | 100 | | |
103 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
104 | 124 | | |
105 | 125 | | |
106 | 126 | | |
107 | 127 | | |
108 | 128 | | |
109 | | - | |
| 129 | + | |
110 | 130 | | |
111 | 131 | | |
112 | 132 | | |
113 | 133 | | |
114 | 134 | | |
115 | 135 | | |
116 | 136 | | |
117 | | - | |
| 137 | + | |
118 | 138 | | |
119 | 139 | | |
120 | 140 | | |
121 | 141 | | |
122 | 142 | | |
123 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
124 | 153 | | |
125 | 154 | | |
Lines changed: 25 additions & 51 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | | - | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | 37 | | |
52 | 38 | | |
53 | 39 | | |
54 | | - | |
| 40 | + | |
| 41 | + | |
55 | 42 | | |
56 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
57 | 47 | | |
58 | | - | |
| 48 | + | |
59 | 49 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | 50 | | |
67 | 51 | | |
68 | 52 | | |
| |||
71 | 55 | | |
72 | 56 | | |
73 | 57 | | |
74 | | - | |
| 58 | + | |
75 | 59 | | |
76 | 60 | | |
77 | 61 | | |
| |||
82 | 66 | | |
83 | 67 | | |
84 | 68 | | |
85 | | - | |
86 | | - | |
| 69 | + | |
| 70 | + | |
87 | 71 | | |
88 | | - | |
| 72 | + | |
89 | 73 | | |
90 | 74 | | |
91 | | - | |
| 75 | + | |
92 | 76 | | |
93 | 77 | | |
94 | 78 | | |
95 | 79 | | |
96 | 80 | | |
97 | 81 | | |
98 | 82 | | |
99 | | - | |
| 83 | + | |
100 | 84 | | |
101 | 85 | | |
102 | 86 | | |
| |||
150 | 134 | | |
151 | 135 | | |
152 | 136 | | |
153 | | - | |
| 137 | + | |
154 | 138 | | |
155 | 139 | | |
156 | 140 | | |
157 | 141 | | |
158 | 142 | | |
159 | | - | |
| 143 | + | |
160 | 144 | | |
161 | 145 | | |
162 | 146 | | |
163 | 147 | | |
164 | | - | |
165 | | - | |
| 148 | + | |
| 149 | + | |
166 | 150 | | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
| 151 | + | |
178 | 152 | | |
179 | 153 | | |
180 | 154 | | |
| |||
0 commit comments