File tree 1 file changed +16
-3
lines changed
server/src/main/java/org/elasticsearch/index/engine
1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -2567,10 +2567,23 @@ public final long getMinRetainedSeqNo() {
2567
2567
public Closeable acquireRetentionLock () {
2568
2568
if (softDeleteEnabled ) {
2569
2569
final Closeable softDeletesRetentionLock = softDeletesPolicy .acquireRetentionLock ();
2570
- final Closeable translogRetentionLock = translog .acquireRetentionLock ();
2570
+ final Closeable translogRetentionLock ;
2571
+ try {
2572
+ translogRetentionLock = translog .acquireRetentionLock ();
2573
+ } catch (Exception e ) {
2574
+ try {
2575
+ softDeletesRetentionLock .close ();
2576
+ } catch (IOException ioexception ) {
2577
+ e .addSuppressed (ioexception );
2578
+ }
2579
+ throw e ;
2580
+ }
2571
2581
return () -> {
2572
- softDeletesRetentionLock .close ();
2573
- translogRetentionLock .close ();
2582
+ try {
2583
+ translogRetentionLock .close ();
2584
+ } finally {
2585
+ softDeletesRetentionLock .close ();
2586
+ }
2574
2587
};
2575
2588
} else {
2576
2589
return translog .acquireRetentionLock ();
You can’t perform that action at this time.
0 commit comments