From 7f6f492b343376b237babd66ca9b6aa196ff19de Mon Sep 17 00:00:00 2001 From: Theodore Tsirpanis Date: Thu, 13 Feb 2025 14:42:09 +0200 Subject: [PATCH] Do not use read-ahead cache in array/group directory. In all cases where we read files from the VFS there, we get the file's size beforehand and read the entirety of it. This makes the read-ahead cache not actually required. Fixes failures when reading empty `.vac` files. --- tiledb/sm/array/array_directory.cc | 6 +++--- tiledb/sm/group/group_directory.cc | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tiledb/sm/array/array_directory.cc b/tiledb/sm/array/array_directory.cc index 444036d9f2e..ff9daed8cb8 100644 --- a/tiledb/sm/array/array_directory.cc +++ b/tiledb/sm/array/array_directory.cc @@ -726,7 +726,7 @@ ArrayDirectory::load_consolidated_commit_uris( std::string names; names.resize(size); RETURN_NOT_OK_TUPLE( - resources_.get().vfs().read(uri, 0, &names[0], size), + resources_.get().vfs().read(uri, 0, &names[0], size, false), nullopt, nullopt); std::stringstream ss(names); @@ -752,7 +752,7 @@ ArrayDirectory::load_consolidated_commit_uris( auto& names = meta_files.back().second; names.resize(size); RETURN_NOT_OK_TUPLE( - resources_.get().vfs().read(uri, 0, &names[0], size), + resources_.get().vfs().read(uri, 0, &names[0], size, false), nullopt, nullopt); std::stringstream ss(names); @@ -1082,7 +1082,7 @@ ArrayDirectory::compute_uris_to_vacuum( throw_if_not_ok(vfs.file_size(vac_files[i], &size)); std::string names; names.resize(size); - throw_if_not_ok(vfs.read(vac_files[i], 0, &names[0], size)); + throw_if_not_ok(vfs.read(vac_files[i], 0, &names[0], size, false)); std::stringstream ss(names); bool vacuum_vac_file = true; for (std::string uri_str; std::getline(ss, uri_str);) { diff --git a/tiledb/sm/group/group_directory.cc b/tiledb/sm/group/group_directory.cc index 3881c68c32f..92aeacbb73c 100644 --- a/tiledb/sm/group/group_directory.cc +++ b/tiledb/sm/group/group_directory.cc @@ -273,7 +273,7 @@ GroupDirectory::compute_uris_to_vacuum(const std::vector& uris) const { throw_if_not_ok(vfs_.file_size(vac_files[i], &size)); std::string names; names.resize(size); - throw_if_not_ok(vfs_.read(vac_files[i], 0, &names[0], size)); + throw_if_not_ok(vfs_.read(vac_files[i], 0, &names[0], size, false)); std::stringstream ss(names); bool vacuum_vac_file = true; for (std::string uri_str; std::getline(ss, uri_str);) {