Skip to content

Commit

Permalink
Merge pull request #88 from Mytherin/attachparallel
Browse files Browse the repository at this point in the history
Fix #87 - actually disable buffering when RequireParallelAccess is set
  • Loading branch information
samansmink authored Oct 28, 2024
2 parents f4b876f + e11f950 commit 8d70765
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/azure_filesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,9 @@ AzureFileHandle::AzureFileHandle(AzureStorageFileSystem &fs, string path, FileOp
buffer_available(0), buffer_idx(0), file_offset(0), buffer_start(0), buffer_end(0),
// Options
read_options(read_options) {
if (flags.OpenForReading()) {
if (!flags.RequireParallelAccess() && !flags.DirectIO()) {
read_buffer = duckdb::unique_ptr<data_t[]>(new data_t[read_options.buffer_size]);
}
if (flags.RequireParallelAccess()) {
// use direct i/o if parallel access is required
flags |= FileOpenFlags(FileOpenFlags::FILE_FLAGS_DIRECT_IO);
}
}

bool AzureFileHandle::PostConstruct() {
Expand Down Expand Up @@ -102,7 +98,10 @@ void AzureStorageFileSystem::Read(FileHandle &handle, void *buffer, int64_t nr_b
idx_t buffer_offset = 0;

// Don't buffer when DirectIO is set.
if (hfh.flags.DirectIO() && to_read > 0) {
if (hfh.flags.DirectIO() || hfh.flags.RequireParallelAccess()) {
if (to_read == 0) {
return;
}
ReadRange(hfh, location, (char *)buffer, to_read);
hfh.buffer_available = 0;
hfh.buffer_idx = 0;
Expand Down

0 comments on commit 8d70765

Please sign in to comment.