Skip to content

Commit

Permalink
PR review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Bukhtawar Khan <bukhtawa@amazon.com>
  • Loading branch information
Bukhtawar committed Nov 19, 2022
1 parent 0bc8a30 commit 8a5da20
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public void uploadBlob(final TransferFileSnapshot fileSnapshot, Iterable<String>
try (InputStream inputStream = fileSnapshot.inputStream()) {
blobStore.blobContainer(blobPath).writeBlobAtomic(fileSnapshot.getName(), inputStream, fileSnapshot.getContentLength(), true);
} catch (Exception ex) {
logger.error(() -> new ParameterizedMessage("Failed to upload blob {}", fileSnapshot.getName()), ex);
throw ex;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ public class FileSnapshot implements Closeable {
@Nullable
private byte[] content;

public FileSnapshot(Path path) throws IOException {
private FileSnapshot(Path path) throws IOException {
Objects.requireNonNull(path);
this.name = path.getFileName().toString();
this.path = path;
this.fileChannel = FileChannel.open(path, StandardOpenOption.READ);
}

public FileSnapshot(String name, byte[] content) throws IOException {
private FileSnapshot(String name, byte[] content) {
Objects.requireNonNull(name);
this.name = name;
this.content = content;
Expand Down Expand Up @@ -148,7 +148,7 @@ public boolean equals(Object o) {
*
* @opensearch.internal
*/
public static class TranslogFileSnapshot extends TransferFileSnapshot {
public static final class TranslogFileSnapshot extends TransferFileSnapshot {

private final long generation;

Expand Down Expand Up @@ -183,7 +183,7 @@ public boolean equals(Object o) {
*
* @opensearch.internal
*/
public static class CheckpointFileSnapshot extends TransferFileSnapshot {
public static final class CheckpointFileSnapshot extends TransferFileSnapshot {

private final long generation;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ public FileTransferException(TransferFileSnapshot fileSnapshot, Throwable cause)
this.fileSnapshot = fileSnapshot;
}

public FileTransferException(TransferFileSnapshot fileSnapshot, String message, Throwable cause) {
super(message, cause);
this.fileSnapshot = fileSnapshot;
}

public TransferFileSnapshot getFileSnapshot() {
return fileSnapshot;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ public boolean transferSnapshot(TransferSnapshot transferSnapshot, TranslogTrans
}
} catch (InterruptedException ex) {
exceptionList.forEach(ex::addSuppressed);
logger.error(() -> new ParameterizedMessage("Time failed for snapshot {}", transferSnapshot), ex);
Thread.currentThread().interrupt();
throw ex;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ public void onFailure(Exception e) {
throw new AssertionError("Failed to perform uploadBlobAsync", e);
}
}, latch));
latch.await(1000, TimeUnit.MILLISECONDS);
assertEquals(true, succeeded.get());
assertTrue(latch.await(1000, TimeUnit.MILLISECONDS));
assertTrue(succeeded.get());
}

@Override
Expand Down

0 comments on commit 8a5da20

Please sign in to comment.