From a000339b34d9ebec1a47272b67361dc6cc928ff4 Mon Sep 17 00:00:00 2001 From: Yannick Welsch Date: Thu, 7 Feb 2019 19:10:06 +0100 Subject: [PATCH] add assert --- .../org/elasticsearch/xpack/ccr/repository/CcrRepository.java | 1 + 1 file changed, 1 insertion(+) diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/repository/CcrRepository.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/repository/CcrRepository.java index b8b37a52324a5..0db51493b2721 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/repository/CcrRepository.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/repository/CcrRepository.java @@ -456,6 +456,7 @@ protected void doRun() throws Exception { final long nanosPaused = ccrSettings.getRateLimiter().maybePause(actualChunkSize); throttleListener.accept(nanosPaused); final long newOffset = r.getOffset() + actualChunkSize; + assert newOffset <= fileToRecover.length(); final boolean lastChunk = newOffset >= fileToRecover.length(); multiFileWriter.writeFileChunk(fileToRecover.metadata(), r.getOffset(), r.getChunk(), lastChunk);