Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #87 - actually disable buffering when RequireParallelAccess is set #88

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading