Commit 045403d
authored
Scope replication-failure read-only to repo/project, not the whole server (#1305)
Motivation:
Central Dogma is a multi-tenant store: a single replica hosts many
projects and repositories belonging to unrelated tenants. When a
follower fails to replay a single log (state divergence, lock
acquisition timeout, or transient I/O error), the existing failure path
puts the whole server into read-only mode. A problem in one repository
then propagates to every other tenant on that replica: writes stop
everywhere until an operator investigates and lifts the server-wide
read-only state.
The goal of this change is to shrink that blast radius. A replay failure
flips only the smallest enclosing scope (repository, project, or server)
to read-only, and the executor keeps replicating unrelated logs for
everyone else. The read-only state is persisted so it survives restarts
— in `dogma/dogma` for repo/project scope, and in a properties file for
server scope. The existing administrative API can lift it once the
operator has investigated.
Modifications:
- Add `UpdateProjectStatusCommand` and `UpdateRepositoryStatusCommand`,
routed through the same replication pipeline as ordinary commands so
scope changes converge across the cluster. Their effect lands in
`dogma/dogma/status/{project}/{repo}.json` — the same storage as
ordinary commands, intentionally: a replay failure of the status update
itself is then treated as a `dogma/dogma` failure and escalates to
server scope.
- Carry `commandType`, `projectName`, and `repoName` on every `LogMeta`.
- Add `ReplicationLogContext` attached to `ReplicationException` so
`ZooKeeperCommandExecutor.handleReplicationFailure()` can pick the
read-only scope:
- null project name (root commands or `dogma/dogma`) → server
- non-null project name with null repo (or the dogma metadata repo) →
project
- otherwise → repository
- Add `RepoStatusManager` to manage the read-only status of projects and
repositories; remove `MetadataService.updateRepositoryStatus()` and
migrate callers.
- On a replay error, skip past the failing log (so subsequent unrelated
logs keep replaying) and issue the scope-appropriate
`Update(Project|Repository)StatusCommand`. Fall back to a server-wide
read-only state only if recovery itself fails.
- Wire `StandaloneCommandExecutor` to consult `RepoStatusManager` on
every push, so a per-repo / per-project read-only state rejects writes
with `ReadOnlyException` before reaching the storage layer.
- Rename `DefaultCrud*` → `ReplicatingCrud*` and introduce
`StandaloneCrud*` to bypass replication when the standalone executor
applies state updates directly.
- Move `ServerStatusManager` to the internal package.
- Add `ReplicationStatus` to describe the status of projects and
repositories, and migrate `RepositoryStatus` in `RepositoryDto` to
`ReplicationStatus`.
Result:
- A replication failure no longer puts the whole server into read-only
mode; only the affected project or repository becomes read-only.1 parent b0011fd commit 045403d
52 files changed
Lines changed: 2683 additions & 645 deletions
File tree
- common/src/main/java/com/linecorp/centraldogma
- common
- jsonpatch
- internal/api/v1
- server/src
- main/java/com/linecorp/centraldogma/server
- command
- internal
- api
- sysadmin
- variable
- management
- mirror
- replication
- storage/repository/crud
- management
- metadata
- test/java/com/linecorp/centraldogma/server
- internal
- api
- auth
- management
- replication
- storage/repository/git
- management
- metadata
- testing-internal/src/main/java/com/linecorp/centraldogma/testing/internal
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
144 | 147 | | |
145 | 148 | | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
Lines changed: 36 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
| 23 | + | |
| 24 | + | |
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
232 | 235 | | |
233 | 236 | | |
234 | 237 | | |
| |||
240 | 243 | | |
241 | 244 | | |
242 | 245 | | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
243 | 249 | | |
244 | 250 | | |
245 | 251 | | |
| |||
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
| 126 | + | |
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| |||
Lines changed: 29 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
| 168 | + | |
| 169 | + | |
168 | 170 | | |
169 | 171 | | |
170 | 172 | | |
171 | 173 | | |
172 | 174 | | |
173 | 175 | | |
174 | 176 | | |
175 | | - | |
176 | | - | |
| 177 | + | |
| 178 | + | |
177 | 179 | | |
178 | | - | |
179 | 180 | | |
180 | 181 | | |
181 | 182 | | |
| |||
304 | 305 | | |
305 | 306 | | |
306 | 307 | | |
| 308 | + | |
| 309 | + | |
307 | 310 | | |
308 | 311 | | |
309 | 312 | | |
| |||
620 | 623 | | |
621 | 624 | | |
622 | 625 | | |
| 626 | + | |
623 | 627 | | |
624 | 628 | | |
625 | 629 | | |
626 | 630 | | |
627 | 631 | | |
628 | | - | |
| 632 | + | |
| 633 | + | |
629 | 634 | | |
630 | 635 | | |
631 | 636 | | |
632 | 637 | | |
633 | 638 | | |
634 | 639 | | |
635 | | - | |
636 | | - | |
| 640 | + | |
| 641 | + | |
637 | 642 | | |
638 | 643 | | |
639 | 644 | | |
| |||
647 | 652 | | |
648 | 653 | | |
649 | 654 | | |
| 655 | + | |
650 | 656 | | |
651 | 657 | | |
652 | 658 | | |
| |||
669 | 675 | | |
670 | 676 | | |
671 | 677 | | |
| 678 | + | |
672 | 679 | | |
673 | 680 | | |
674 | 681 | | |
| 682 | + | |
675 | 683 | | |
676 | 684 | | |
677 | 685 | | |
678 | 686 | | |
679 | 687 | | |
680 | 688 | | |
681 | 689 | | |
682 | | - | |
683 | | - | |
684 | | - | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
685 | 693 | | |
686 | 694 | | |
687 | 695 | | |
| |||
924 | 932 | | |
925 | 933 | | |
926 | 934 | | |
| 935 | + | |
927 | 936 | | |
928 | 937 | | |
929 | 938 | | |
| |||
945 | 954 | | |
946 | 955 | | |
947 | 956 | | |
948 | | - | |
949 | | - | |
| 957 | + | |
| 958 | + | |
950 | 959 | | |
951 | 960 | | |
952 | 961 | | |
| |||
1008 | 1017 | | |
1009 | 1018 | | |
1010 | 1019 | | |
1011 | | - | |
| 1020 | + | |
1012 | 1021 | | |
1013 | 1022 | | |
1014 | 1023 | | |
1015 | 1024 | | |
1016 | | - | |
| 1025 | + | |
| 1026 | + | |
1017 | 1027 | | |
1018 | 1028 | | |
1019 | 1029 | | |
| |||
1241 | 1251 | | |
1242 | 1252 | | |
1243 | 1253 | | |
| 1254 | + | |
1244 | 1255 | | |
1245 | 1256 | | |
1246 | 1257 | | |
| |||
1249 | 1260 | | |
1250 | 1261 | | |
1251 | 1262 | | |
| 1263 | + | |
1252 | 1264 | | |
1253 | 1265 | | |
1254 | 1266 | | |
1255 | 1267 | | |
1256 | 1268 | | |
1257 | 1269 | | |
1258 | 1270 | | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
1259 | 1275 | | |
1260 | 1276 | | |
1261 | 1277 | | |
| |||
Lines changed: 33 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| 68 | + | |
| 69 | + | |
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
| |||
331 | 334 | | |
332 | 335 | | |
333 | 336 | | |
334 | | - | |
335 | | - | |
| 337 | + | |
| 338 | + | |
336 | 339 | | |
337 | 340 | | |
338 | 341 | | |
| |||
478 | 481 | | |
479 | 482 | | |
480 | 483 | | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
481 | 512 | | |
482 | 513 | | |
483 | 514 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | | - | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
| |||
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
43 | 46 | | |
44 | 47 | | |
45 | 48 | | |
| |||
0 commit comments