Skip to content

Commit b883374

Browse files
committed
Apply suggestions
1 parent fa5b667 commit b883374

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

core/src/main/java/com/scalar/db/storage/objectstorage/cloudstorage/CloudStorageWrapper.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626

2727
@ThreadSafe
2828
public class CloudStorageWrapper implements ObjectStorageWrapper {
29+
// Batch API has a limit of 100 operations per request
2930
public static final int BATCH_DELETE_SIZE_LIMIT = 100;
31+
3032
private final Storage storage;
3133
private final String bucket;
3234
private final Integer parallelUploadBlockSizeInBytes;

core/src/main/java/com/scalar/db/storage/objectstorage/s3/S3Wrapper.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535

3636
@ThreadSafe
3737
public class S3Wrapper implements ObjectStorageWrapper {
38+
// DeleteObjects API has a limit of 1000 objects per request
3839
public static final int BATCH_DELETE_SIZE_LIMIT = 1000;
40+
3941
private final S3AsyncClient client;
4042
private final String bucket;
4143

@@ -281,8 +283,12 @@ public void deleteByPrefix(String prefix) throws ObjectStorageWrapperException {
281283
}
282284

283285
@Override
284-
public void close() {
285-
client.close();
286+
public void close() throws ObjectStorageWrapperException {
287+
try {
288+
client.close();
289+
} catch (Exception e) {
290+
throw new ObjectStorageWrapperException("Failed to close the storage wrapper", e);
291+
}
286292
}
287293

288294
private Optional<S3Exception> findS3Exception(Throwable throwable) {

core/src/test/java/com/scalar/db/storage/objectstorage/cloudstorage/CloudStorageWrapperTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,8 @@ public void deleteByPrefix_StorageExceptionThrown_ShouldThrowObjectStorageWrappe
424424

425425
@Test
426426
public void close_ShouldCloseTheStorage() throws Exception {
427+
// Arrange
428+
427429
// Act
428430
wrapper.close();
429431

core/src/test/java/com/scalar/db/storage/objectstorage/s3/S3WrapperTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ public void deleteByPrefix_S3ExceptionThrown_ShouldThrowObjectStorageWrapperExce
552552
}
553553

554554
@Test
555-
public void close_ShouldCloseTheClient() {
555+
public void close_ShouldCloseTheClient() throws Exception {
556556
// Arrange
557557

558558
// Act

0 commit comments

Comments
 (0)