This repository was archived by the owner on Feb 6, 2026. It is now read-only.
Repository navigation
Commit 109cf9f
Zachary Hamm
feat(*): Apply to head happens in rebaser
Currently we handle applies to head by calculating the set of updates
in the current change set with respect to HEAD on the client side (e.g.,
in the rebaser or luminork) and then write a change set batch of those
updates and send it to the rebaser. This is the wrong way to do it:
with concurrent users, the set of updates calculated could easily be out
of date by the time they reach the rebaser. Both HEAD and the change set
we are updating could have moved forward, making our update set
incomplete or incorrect. Further, we move the change set's status to
applied on the client side as well, opening up further possibilities for
races in a multiplayer setting.
To fix this, we have moved the apply to head into the rebaser in a two
phase commit approach:
1. First, on the request stream for the change set being applied,
we send a request to prepare the change set for apply. This
first locks all schemas and funcs that may have been in an editing
state, writes the updated workspace snapshot, and then marks
the change set with the "ApplyStarted" status. This prevents
further updates from happening on the the change set since it is
no longer "open".
2. Next, on the request stream for head, we request an apply to head.
This calculates the update batch for an apply and performs the
rebase, then moves the change set status to "Applied" if
successful. If unsuccessful, the change set status will be
reset to what it was when the prepare request was issued above, so
that change sets are not left in "ApplyStarted" after an apply has
failed.
This ensures that updates to the change set, or to head, cannot race an
"apply", and that updates that land to a change set *after* an apply
has started will be rejected (since they are no longer up to date).
Also added here are request handlers for change set status changes and
change set creation. The requests for these have not yet been integrated
into the rebaser client, but they will similarly ensure that change set
creation and status updates are handled in the correct order in
multiplayer scenarios.1 parent d4c1bbf commit 109cf9f
28 files changed
Lines changed: 1684 additions & 412 deletions
File tree
- lib
- acceptable-macros/src
- dal-test/src/helpers
- dal
- src
- change_set
- workspace_snapshot
- tests/integration_test
- node_weight
- luminork-server/src/service/v1/change_sets
- rebaser-client/src
- rebaser-core/src/api_types
- enqueue_updates_request
- enqueue_updates_response
- rebaser-server/src
- sdf-core/src/dal_wrapper
- sdf-server/src/service/v2/change_set
- sdf-test/src
- si-events-rs/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
31 | | - | |
32 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
33 | 36 | | |
34 | 37 | | |
35 | 38 | | |
| |||
64 | 67 | | |
65 | 68 | | |
66 | 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 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | 14 | | |
18 | 15 | | |
19 | 16 | | |
20 | 17 | | |
21 | 18 | | |
22 | 19 | | |
23 | 20 | | |
24 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
77 | | - | |
| 76 | + | |
78 | 77 | | |
79 | 78 | | |
80 | 79 | | |
81 | 80 | | |
82 | 81 | | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
86 | 86 | | |
87 | | - | |
88 | | - | |
89 | 87 | | |
90 | 88 | | |
91 | 89 | | |
| |||
122 | 120 | | |
123 | 121 | | |
124 | 122 | | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | 123 | | |
133 | 124 | | |
134 | 125 | | |
| |||
196 | 187 | | |
197 | 188 | | |
198 | 189 | | |
199 | | - | |
200 | | - | |
201 | | - | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
202 | 194 | | |
203 | 195 | | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
| 196 | + | |
| 197 | + | |
212 | 198 | | |
213 | 199 | | |
214 | | - | |
215 | | - | |
| 200 | + | |
216 | 201 | | |
217 | 202 | | |
218 | 203 | | |
| |||
233 | 218 | | |
234 | 219 | | |
235 | 220 | | |
236 | | - | |
237 | | - | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
238 | 228 | | |
239 | 229 | | |
240 | 230 | | |
241 | 231 | | |
242 | 232 | | |
243 | 233 | | |
244 | 234 | | |
245 | | - | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
246 | 259 | | |
247 | 260 | | |
248 | 261 | | |
| |||
282 | 295 | | |
283 | 296 | | |
284 | 297 | | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | 298 | | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
| 299 | + | |
| 300 | + | |
314 | 301 | | |
315 | 302 | | |
316 | 303 | | |
| |||
0 commit comments