File tree Expand file tree Collapse file tree
server/src/main/java/org/elasticsearch/index/engine Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2567,10 +2567,23 @@ public final long getMinRetainedSeqNo() {
25672567 public Closeable acquireRetentionLock () {
25682568 if (softDeleteEnabled ) {
25692569 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+ }
25712581 return () -> {
2572- softDeletesRetentionLock .close ();
2573- translogRetentionLock .close ();
2582+ try {
2583+ translogRetentionLock .close ();
2584+ } finally {
2585+ softDeletesRetentionLock .close ();
2586+ }
25742587 };
25752588 } else {
25762589 return translog .acquireRetentionLock ();
You can’t perform that action at this time.
0 commit comments