wait before closing the shard if a snapshot is still in progress
This commit is contained in:
parent
4b2ff13833
commit
50249f4e52
|
@ -161,19 +161,25 @@ public class IndexShardGatewayService extends AbstractIndexShardComponent implem
|
||||||
});
|
});
|
||||||
} catch (IllegalIndexShardStateException e) {
|
} catch (IllegalIndexShardStateException e) {
|
||||||
// ignore, that's fine
|
// ignore, that's fine
|
||||||
|
} catch (IndexShardGatewaySnapshotFailedException e) {
|
||||||
|
throw e;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.warn("Failed to snapshot on close", e);
|
throw new IndexShardGatewaySnapshotFailedException(shardId, "Failed to snapshot", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close(boolean delete) {
|
public synchronized void close(boolean delete) {
|
||||||
if (snapshotScheduleFuture != null) {
|
if (snapshotScheduleFuture != null) {
|
||||||
snapshotScheduleFuture.cancel(true);
|
snapshotScheduleFuture.cancel(true);
|
||||||
snapshotScheduleFuture = null;
|
snapshotScheduleFuture = null;
|
||||||
}
|
}
|
||||||
if (!delete && snapshotOnClose) {
|
if (!delete && snapshotOnClose) {
|
||||||
logger.debug("Snapshotting on close ...");
|
logger.debug("Snapshotting on close ...");
|
||||||
|
try {
|
||||||
snapshot();
|
snapshot();
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.warn("Failed to snapshot on close", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// don't really delete the shard gateway if we are *not* primary,
|
// don't really delete the shard gateway if we are *not* primary,
|
||||||
// the primary will close it
|
// the primary will close it
|
||||||
|
@ -213,7 +219,7 @@ public class IndexShardGatewayService extends AbstractIndexShardComponent implem
|
||||||
try {
|
try {
|
||||||
snapshot();
|
snapshot();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.warn("Failed to snapshot", e);
|
logger.warn("Failed to snapshot (scheduled)", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue