Skip to content

Commit

Permalink
making downloadOnce private
Browse files Browse the repository at this point in the history
Signed-off-by: Gaurav Bafna <gbbafna@amazon.com>
  • Loading branch information
gbbafna committed Sep 5, 2023
1 parent e407f6c commit 93357ce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ static void download(TranslogTransferManager translogTransferManager, Path locat
throw ex;
}

static void downloadOnce(TranslogTransferManager translogTransferManager, Path location, Logger logger) throws IOException {
static private void downloadOnce(TranslogTransferManager translogTransferManager, Path location, Logger logger) throws IOException {
logger.trace("Downloading translog files from remote");
RemoteTranslogTransferTracker statsTracker = translogTransferManager.getRemoteTranslogTransferTracker();
long prevDownloadBytesSucceeded = statsTracker.getDownloadBytesSucceeded();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@

import java.io.Closeable;
import java.io.EOFException;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
Expand Down Expand Up @@ -1491,7 +1492,9 @@ public void testDownloadWithRetries() throws IOException {

// File not found in first attempt . File found in second attempt.
mockTransfer = mock(TranslogTransferManager.class);
when(mockTransfer.downloadTranslog(any(), any(), any())).thenThrow(new NoSuchFileException("File not found")).thenReturn(true);
String msg = "File not found";
Exception toThrow = randomBoolean() ? new NoSuchFileException(msg) : new FileNotFoundException(msg);
when(mockTransfer.downloadTranslog(any(), any(), any())).thenThrow(toThrow).thenReturn(true);

AtomicLong downloadCounter = new AtomicLong();
doAnswer(invocation -> {
Expand Down

0 comments on commit 93357ce

Please sign in to comment.