Skip to content

Commit

Permalink
Fix Failing TranslogTests.testRecoveryFromFailureOnTrimming (#82148) (#…
Browse files Browse the repository at this point in the history
…82150)

In #77674 the assertion that is moved here was added.
The problem with it is that when running tests that do
random IO exceptions on the `channel.position()` call,
the assertion actual has a side effect.
If the exception it triggers as a side effect is not caught and
the translog failed as a result, tests around the safety of handling
IOExceptions in this code fail. Unfortunately, the assertion still
has a side effect after this change but its side effect is handled
like an expected IOException.
  • Loading branch information
original-brownbear committed Dec 30, 2021
1 parent 2781adf commit 2445752
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -478,11 +478,11 @@ final boolean syncUpTo(long offset) throws IOException {
try {
// Write ops will release operations.
writeAndReleaseOps(toWrite);
assert channel.position() == checkpointToSync.offset;
} catch (final Exception ex) {
closeWithTragicEvent(ex);
throw ex;
}
assert channel.position() == checkpointToSync.offset;
}
// now do the actual fsync outside of the synchronized block such that
// we can continue writing to the buffer etc.
Expand Down

0 comments on commit 2445752

Please sign in to comment.