Skip to content

Commit ac6483e

Browse files
authored
Minor GCS fix for 0-byte reads. (#5673)
Integration tests of copy exposed an edge case in which `google::cloud::storage::ReadRange` returns an error if `offset + nbytes == 0`. The function is expected to return `0` bytes-read in this case. --- TYPE: BUG DESC: 0-byte read `GCS` bug fix. --- Fixes CORE-413
1 parent 5e4f50f commit ac6483e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tiledb/sm/filesystem/gcs.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,6 +1339,10 @@ Status GCS::flush_object_direct(const URI& uri) {
13391339

13401340
uint64_t GCS::read(
13411341
const URI& uri, uint64_t offset, void* buffer, uint64_t nbytes) {
1342+
// ReadRange will return an error on 0-byte reads. Instead, just return here.
1343+
if (offset + nbytes == 0) {
1344+
return 0;
1345+
}
13421346
throw_if_not_ok(init_client());
13431347

13441348
if (!uri.is_gcs()) {

0 commit comments

Comments
 (0)