Commit 955f92e
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 #93575
Backport of #127964 to `8.19`readonly invariants on repositories (#128296)1 parent 01650e9 commit 955f92e
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 | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| |||
288 | 289 | | |
289 | 290 | | |
290 | 291 | | |
| 292 | + | |
291 | 293 | | |
292 | 294 | | |
293 | 295 | | |
| |||
600 | 602 | | |
601 | 603 | | |
602 | 604 | | |
| 605 | + | |
603 | 606 | | |
604 | 607 | | |
605 | 608 | | |
| |||
884 | 887 | | |
885 | 888 | | |
886 | 889 | | |
887 | | - | |
| 890 | + | |
888 | 891 | | |
889 | 892 | | |
890 | 893 | | |
| |||
898 | 901 | | |
899 | 902 | | |
900 | 903 | | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
901 | 908 | | |
902 | 909 | | |
903 | 910 | | |
904 | 911 | | |
905 | 912 | | |
906 | 913 | | |
907 | 914 | | |
| 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 | + | |
908 | 955 | | |
909 | 956 | | |
910 | 957 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2732 | 2732 | | |
2733 | 2733 | | |
2734 | 2734 | | |
| 2735 | + | |
| 2736 | + | |
| 2737 | + | |
| 2738 | + | |
| 2739 | + | |
| 2740 | + | |
| 2741 | + | |
| 2742 | + | |
2735 | 2743 | | |
2736 | 2744 | | |
2737 | 2745 | | |
| |||
Lines changed: 16 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
| 340 | + | |
340 | 341 | | |
341 | 342 | | |
342 | 343 | | |
| |||
432 | 433 | | |
433 | 434 | | |
434 | 435 | | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
435 | 443 | | |
436 | 444 | | |
437 | 445 | | |
| |||
2152 | 2160 | | |
2153 | 2161 | | |
2154 | 2162 | | |
| 2163 | + | |
| 2164 | + | |
2155 | 2165 | | |
2156 | 2166 | | |
2157 | 2167 | | |
| |||
3991 | 4001 | | |
3992 | 4002 | | |
3993 | 4003 | | |
3994 | | - | |
3995 | 4004 | | |
| 4005 | + | |
| 4006 | + | |
| 4007 | + | |
| 4008 | + | |
| 4009 | + | |
| 4010 | + | |
3996 | 4011 | | |
3997 | 4012 | | |
3998 | 4013 | | |
| |||
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 | | |
| |||
41 | 44 | | |
42 | 45 | | |
43 | 46 | | |
| 47 | + | |
44 | 48 | | |
45 | 49 | | |
46 | 50 | | |
| |||
376 | 380 | | |
377 | 381 | | |
378 | 382 | | |
| 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 | + | |
379 | 480 | | |
380 | 481 | | |
381 | 482 | | |
| |||
405 | 506 | | |
406 | 507 | | |
407 | 508 | | |
408 | | - | |
| 509 | + | |
409 | 510 | | |
410 | 511 | | |
411 | 512 | | |
| |||
513 | 614 | | |
514 | 615 | | |
515 | 616 | | |
516 | | - | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
517 | 620 | | |
518 | 621 | | |
519 | 622 | | |
| |||
0 commit comments