Commit f3b3297
authored
Sets the new engine before closing the previous one in IndexShard.resetEngine (#122255)
Current code closes the previous engine instance, creates the new engine and then updates the currentEngineReference:
IOUtils.close(currentEngine);
var newEngine = createEngine(engineConfig);
currentEngineReference.set(newEngine);
This leaves more room for callers of getEngineOrNull() to pick a closed instance. Instead we can create the new engine first and atomically update the reference to the new instance.1 parent 49eccbe commit f3b3297
File tree
2 files changed
+6
-10
lines changed- server/src
- main/java/org/elasticsearch/index/shard
- test/java/org/elasticsearch/index/shard
2 files changed
+6
-10
lines changedLines changed: 4 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4313 | 4313 | | |
4314 | 4314 | | |
4315 | 4315 | | |
4316 | | - | |
4317 | | - | |
4318 | | - | |
4319 | 4316 | | |
4320 | | - | |
4321 | | - | |
4322 | | - | |
| 4317 | + | |
| 4318 | + | |
| 4319 | + | |
4323 | 4320 | | |
4324 | 4321 | | |
4325 | 4322 | | |
4326 | 4323 | | |
| 4324 | + | |
4327 | 4325 | | |
4328 | 4326 | | |
4329 | 4327 | | |
| |||
Lines changed: 2 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4563 | 4563 | | |
4564 | 4564 | | |
4565 | 4565 | | |
4566 | | - | |
| 4566 | + | |
4567 | 4567 | | |
4568 | | - | |
4569 | | - | |
4570 | | - | |
| 4568 | + | |
4571 | 4569 | | |
4572 | 4570 | | |
4573 | 4571 | | |
| |||
0 commit comments