diff --git a/rxlib/src/main/java/org/rx/io/WALFileStream.java b/rxlib/src/main/java/org/rx/io/WALFileStream.java index fd024c7d..518398a8 100644 --- a/rxlib/src/main/java/org/rx/io/WALFileStream.java +++ b/rxlib/src/main/java/org/rx/io/WALFileStream.java @@ -346,17 +346,17 @@ public void write(ByteBuf src, int length) { } private void ensureWrite(BiAction action) { - long logPosition = meta.logPos; + long logPos = meta.logPos; lock.writeInvoke(() -> { - if (logPosition != meta.logPos) { - throw new InvalidException("Concurrent error"); -// log.warn("Fallback lock"); -// lock.writeInvoke(() -> innerWrite(meta.getLogPosition(), action)); -// return; + if (logPos != meta.logPos) { +// throw new InvalidException("Concurrent error"); + log.warn("Fallback to global lock <- pos:{}", logPos); + lock.writeInvoke(() -> innerWrite(meta.logPos, action)); + return; } - innerWrite(logPosition, action); - }, logPosition); + innerWrite(logPos, action); + }, logPos); } void innerWrite(long logPosition, BiAction action) {