Skip to content

Commit

Permalink
Sync before closeIntoReader in Translog.rollGeneration.
Browse files Browse the repository at this point in the history
Backport of elastic/elasticsearch#45765

Make sure we move most of the data to disk outside of the writeLock
in order to reduce the time the lock is held since its blocking
all thread.
  • Loading branch information
kovrus committed Aug 29, 2019
1 parent 77f45c2 commit 7667959
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1610,6 +1610,9 @@ public TranslogGeneration getMinGenerationForSeqNo(final long seqNo) {
* @throws IOException if an I/O exception occurred during any file operations
*/
public void rollGeneration() throws IOException {
// make sure we move most of the data to disk outside of the writeLock
// in order to reduce the time the lock is held since it's blocking all threads
sync();
try (Releasable ignored = writeLock.acquire()) {
try {
final TranslogReader reader = current.closeIntoReader();
Expand Down

0 comments on commit 7667959

Please sign in to comment.