Commit b11327e
authored
Tighten up
Today there are various mechanisms to prevent writes to readonly
repositories, but they are scattered across the snapshot codebase and do
not obviously prevent writes in all possible circumstances; it'd be easy
to add a new operation on a repository that does not check the readonly
flag in quite the right way.
This commit adds much tighter checks which cannot be circumvented:
- Do not allow to start an update of the root `index-N` blob if the
repository is marked as readonly in the cluster state.
- Conversely, do not allow the readonly flag to be set if an update of
the root `index-N` blob is in progress.
- Establish the invariant that we never create a
`SnapshotsInProgress$Entry`, `SnapshotDeletionsInProgress$Entry`, or
`RepositoryCleanupInProgress$Entry` if the repository is marked as
readonly in the cluster state.
Closes elastic#93575readonly invariants on repositories (elastic#127964)1 parent 989032b commit b11327e
File tree
6 files changed
+267
-4
lines changed- server/src
- main/java/org/elasticsearch
- action/admin/cluster/repositories/cleanup
- repositories
- blobstore
- snapshots
- test/java/org/elasticsearch/repositories
- blobstore
6 files changed
+267
-4
lines changedLines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
174 | 175 | | |
175 | 176 | | |
176 | 177 | | |
| |||
Lines changed: 48 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| |||
289 | 290 | | |
290 | 291 | | |
291 | 292 | | |
| 293 | + | |
292 | 294 | | |
293 | 295 | | |
294 | 296 | | |
| |||
601 | 603 | | |
602 | 604 | | |
603 | 605 | | |
| 606 | + | |
604 | 607 | | |
605 | 608 | | |
606 | 609 | | |
| |||
885 | 888 | | |
886 | 889 | | |
887 | 890 | | |
888 | | - | |
| 891 | + | |
889 | 892 | | |
890 | 893 | | |
891 | 894 | | |
| |||
899 | 902 | | |
900 | 903 | | |
901 | 904 | | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
902 | 909 | | |
903 | 910 | | |
904 | 911 | | |
905 | 912 | | |
906 | 913 | | |
907 | 914 | | |
908 | 915 | | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
909 | 956 | | |
910 | 957 | | |
911 | 958 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2737 | 2737 | | |
2738 | 2738 | | |
2739 | 2739 | | |
| 2740 | + | |
| 2741 | + | |
| 2742 | + | |
| 2743 | + | |
| 2744 | + | |
| 2745 | + | |
| 2746 | + | |
| 2747 | + | |
2740 | 2748 | | |
2741 | 2749 | | |
2742 | 2750 | | |
| |||
Lines changed: 16 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
338 | 338 | | |
339 | 339 | | |
340 | 340 | | |
| 341 | + | |
341 | 342 | | |
342 | 343 | | |
343 | 344 | | |
| |||
433 | 434 | | |
434 | 435 | | |
435 | 436 | | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
436 | 444 | | |
437 | 445 | | |
438 | 446 | | |
| |||
2166 | 2174 | | |
2167 | 2175 | | |
2168 | 2176 | | |
| 2177 | + | |
| 2178 | + | |
2169 | 2179 | | |
2170 | 2180 | | |
2171 | 2181 | | |
| |||
4075 | 4085 | | |
4076 | 4086 | | |
4077 | 4087 | | |
| 4088 | + | |
| 4089 | + | |
| 4090 | + | |
| 4091 | + | |
| 4092 | + | |
| 4093 | + | |
4078 | 4094 | | |
4079 | 4095 | | |
4080 | 4096 | | |
4081 | 4097 | | |
4082 | | - | |
4083 | 4098 | | |
4084 | 4099 | | |
4085 | 4100 | | |
| |||
Lines changed: 105 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| 31 | + | |
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
| |||
42 | 45 | | |
43 | 46 | | |
44 | 47 | | |
| 48 | + | |
45 | 49 | | |
46 | 50 | | |
47 | 51 | | |
| |||
377 | 381 | | |
378 | 382 | | |
379 | 383 | | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
380 | 481 | | |
381 | 482 | | |
382 | 483 | | |
| |||
406 | 507 | | |
407 | 508 | | |
408 | 509 | | |
409 | | - | |
| 510 | + | |
410 | 511 | | |
411 | 512 | | |
412 | 513 | | |
| |||
514 | 615 | | |
515 | 616 | | |
516 | 617 | | |
517 | | - | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
518 | 621 | | |
519 | 622 | | |
520 | 623 | | |
| |||
0 commit comments