[ENGINE] sync translog before closing engine
If the translog is buffered we must make sure everything is synced to disk before we rollback the writer otherwise we open a window for potential dataloss due to stupid errors preventing the translog from being closed.
This commit is contained in:
parent
6df978e76e
commit
f687377e2f
|
@ -902,6 +902,11 @@ public class InternalEngine extends Engine {
|
|||
if (isClosed.compareAndSet(false, true)) {
|
||||
assert rwl.isWriteLockedByCurrentThread() || failEngineLock.isHeldByCurrentThread() : "Either the write lock must be held or the engine must be currently be failing itself";
|
||||
try {
|
||||
try {
|
||||
translog.sync();
|
||||
} catch (IOException ex) {
|
||||
logger.warn("failed to sync translog");
|
||||
}
|
||||
this.versionMap.clear();
|
||||
logger.trace("close searcherManager");
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue