Commit 85f7fa9
authored
ILM: Force merge on zero-replica cloned index before snapshot (#133954)
When performing a searchable snapshot action with force merge enabled,
if the source index has one or more replicas, ILM now clones the index
with zero replicas and performs the force merge on the clone. The
snapshot is then taken from the force-merged clone instead of the source
index, ensuring only primary shards are force-merged. The cloned index
is deleted after the snapshot is mounted, and all references and step
logic have been updated accordingly. Test coverage was added for the new
flow, including handling retries and cleanup of failed clones.
Key changes:
- Execution state: Track the force-merged clone index in ILM state and
propagate through relevant APIs.
- SearchableSnapshotAction: Add conditional steps to clone the index
with 0 replicas, force-merge, and delete the clone as needed.
- Steps: Update ForceMerge, SegmentCount, Snapshot, and Delete steps to
operate on the correct index (source or clone).
- Tests/QA: Add and enhance tests to verify force-merge and snapshot
behavior with and without replicas, including retry/cleanup paths and
configuration for stable force-merges.
Resolves #754781 parent 3e6cf2d commit 85f7fa9
File tree
18 files changed
+641
-132
lines changed- docs/changelog
- server/src/main/java/org/elasticsearch/cluster/metadata
- test/framework/src/main/java/org/elasticsearch/test/rest
- x-pack/plugin
- core/src
- main/java/org/elasticsearch/xpack/core/ilm
- test/java/org/elasticsearch/xpack/core/ilm
- ilm
- qa/multi-node
- src/javaRestTest/java/org/elasticsearch/xpack
- ilm/actions
- src/main/java/org/elasticsearch/xpack/ilm/action
18 files changed
+641
-132
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
Lines changed: 20 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| 68 | + | |
67 | 69 | | |
68 | 70 | | |
69 | 71 | | |
| |||
89 | 91 | | |
90 | 92 | | |
91 | 93 | | |
92 | | - | |
| 94 | + | |
| 95 | + | |
93 | 96 | | |
94 | 97 | | |
95 | 98 | | |
| |||
202 | 205 | | |
203 | 206 | | |
204 | 207 | | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
205 | 212 | | |
206 | 213 | | |
207 | 214 | | |
| |||
274 | 281 | | |
275 | 282 | | |
276 | 283 | | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
277 | 287 | | |
278 | 288 | | |
279 | 289 | | |
| |||
307 | 317 | | |
308 | 318 | | |
309 | 319 | | |
| 320 | + | |
310 | 321 | | |
311 | 322 | | |
312 | 323 | | |
| |||
398 | 409 | | |
399 | 410 | | |
400 | 411 | | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
401 | 417 | | |
402 | 418 | | |
403 | 419 | | |
| |||
417 | 433 | | |
418 | 434 | | |
419 | 435 | | |
420 | | - | |
| 436 | + | |
| 437 | + | |
421 | 438 | | |
422 | 439 | | |
423 | 440 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2087 | 2087 | | |
2088 | 2088 | | |
2089 | 2089 | | |
| 2090 | + | |
| 2091 | + | |
| 2092 | + | |
| 2093 | + | |
2090 | 2094 | | |
2091 | 2095 | | |
2092 | 2096 | | |
| |||
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
104 | 107 | | |
105 | | - | |
| 108 | + | |
106 | 109 | | |
107 | 110 | | |
108 | 111 | | |
| |||
112 | 115 | | |
113 | 116 | | |
114 | 117 | | |
115 | | - | |
| 118 | + | |
116 | 119 | | |
117 | 120 | | |
118 | 121 | | |
| |||
128 | 131 | | |
129 | 132 | | |
130 | 133 | | |
131 | | - | |
| 134 | + | |
132 | 135 | | |
133 | 136 | | |
134 | 137 | | |
| |||
Lines changed: 32 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| 25 | + | |
| 26 | + | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
27 | 30 | | |
| 31 | + | |
28 | 32 | | |
29 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
30 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
31 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
32 | 60 | | |
| 61 | + | |
| 62 | + | |
33 | 63 | | |
34 | 64 | | |
35 | 65 | | |
36 | 66 | | |
37 | 67 | | |
38 | | - | |
| 68 | + | |
39 | 69 | | |
40 | 70 | | |
41 | 71 | | |
| |||
88 | 118 | | |
89 | 119 | | |
90 | 120 | | |
91 | | - | |
| 121 | + | |
92 | 122 | | |
93 | 123 | | |
94 | 124 | | |
| |||
Lines changed: 26 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| |||
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
31 | 37 | | |
| 38 | + | |
32 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
33 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
34 | 57 | | |
35 | 58 | | |
| 59 | + | |
36 | 60 | | |
37 | 61 | | |
38 | 62 | | |
| |||
51 | 75 | | |
52 | 76 | | |
53 | 77 | | |
54 | | - | |
| 78 | + | |
| 79 | + | |
55 | 80 | | |
56 | 81 | | |
57 | 82 | | |
| |||
Lines changed: 13 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
38 | | - | |
39 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
40 | 47 | | |
41 | 48 | | |
| 49 | + | |
42 | 50 | | |
43 | 51 | | |
44 | 52 | | |
| |||
72 | 80 | | |
73 | 81 | | |
74 | 82 | | |
| 83 | + | |
| 84 | + | |
75 | 85 | | |
76 | 86 | | |
77 | | - | |
| 87 | + | |
78 | 88 | | |
79 | 89 | | |
80 | 90 | | |
| |||
0 commit comments