Decrement reference even if IndexShard#postRecovery barfs
This can cause a reference leak if we call `IndexShard#postRecovery` on an already closed shard.
This commit is contained in:
parent
bba1528fa4
commit
470e875445
|
@ -188,12 +188,15 @@ public class RecoveryStatus extends AbstractRefCounted {
|
|||
public void markAsDone() {
|
||||
if (finished.compareAndSet(false, true)) {
|
||||
assert tempFileNames.isEmpty() : "not all temporary files are renamed";
|
||||
try {
|
||||
indexShard.postRecovery("peer recovery done");
|
||||
} finally {
|
||||
// release the initial reference. recovery files will be cleaned as soon as ref count goes to zero, potentially now
|
||||
decRef();
|
||||
listener.onRecoveryDone(state());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Get a temporary name for the provided file name. */
|
||||
public String getTempNameForFile(String origFile) {
|
||||
|
|
Loading…
Reference in New Issue