File tree Expand file tree Collapse file tree 4 files changed +13
-3
lines changed
main/java/com/scalar/db/storage/objectstorage
test/java/com/scalar/db/storage/objectstorage Expand file tree Collapse file tree 4 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 2626
2727@ ThreadSafe
2828public 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 ;
Original file line number Diff line number Diff line change 3535
3636@ ThreadSafe
3737public 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 ) {
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments