Skip to content

Commit cf19553

Browse files
committed
vendor: Update vendored sources to duckdb/duckdb@745b850
Return invalid `BufferHandle` upon loading a destroyed `BlockHandle` (duckdb/duckdb#17249)
1 parent f32828a commit cf19553

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

src/duckdb/src/function/table/version/pragma_version.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#ifndef DUCKDB_PATCH_VERSION
2-
#define DUCKDB_PATCH_VERSION "0-dev2790"
2+
#define DUCKDB_PATCH_VERSION "0-dev2793"
33
#endif
44
#ifndef DUCKDB_MINOR_VERSION
55
#define DUCKDB_MINOR_VERSION 3
@@ -8,10 +8,10 @@
88
#define DUCKDB_MAJOR_VERSION 1
99
#endif
1010
#ifndef DUCKDB_VERSION
11-
#define DUCKDB_VERSION "v1.3.0-dev2790"
11+
#define DUCKDB_VERSION "v1.3.0-dev2793"
1212
#endif
1313
#ifndef DUCKDB_SOURCE_ID
14-
#define DUCKDB_SOURCE_ID "9aa45ebd94"
14+
#define DUCKDB_SOURCE_ID "745b850a56"
1515
#endif
1616
#include "duckdb/function/table/system_functions.hpp"
1717
#include "duckdb/main/database.hpp"

src/duckdb/src/storage/caching_file_system.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,9 @@ BufferHandle CachingFileHandle::TryReadFromCache(data_ptr_t &buffer, idx_t nr_by
245245
if (result.IsValid()) {
246246
return result;
247247
}
248-
continue;
248+
break;
249+
default:
250+
throw InternalException("Unknown CachedFileRangeOverlap");
249251
}
250252
++it;
251253
}
@@ -257,9 +259,6 @@ BufferHandle CachingFileHandle::TryReadFromFileRange(const unique_ptr<StorageLoc
257259
CachedFileRange &file_range, data_ptr_t &buffer, idx_t nr_bytes,
258260
idx_t location) {
259261
D_ASSERT(file_range.GetOverlap(nr_bytes, location) == CachedFileRangeOverlap::FULL);
260-
if (file_range.block_handle->IsUnloaded()) {
261-
return BufferHandle(); // Purely in-memory (for now)
262-
}
263262
auto result = external_file_cache.GetBufferManager().Pin(file_range.block_handle);
264263
if (result.IsValid()) {
265264
buffer = result.Ptr() + (location - file_range.location);
@@ -297,6 +296,8 @@ BufferHandle CachingFileHandle::TryInsertFileRange(BufferHandle &pin, data_ptr_t
297296
// Since we have the write lock here, we can do some cleanup
298297
it = ranges.erase(it);
299298
continue;
299+
default:
300+
throw InternalException("Unknown CachedFileRangeOverlap");
300301
}
301302
if (break_loop) {
302303
break;

src/duckdb/src/storage/standard_buffer_manager.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,10 @@ BufferHandle StandardBufferManager::Pin(shared_ptr<BlockHandle> &handle) {
366366
// now we can actually load the current block
367367
D_ASSERT(handle->Readers() == 0);
368368
buf = handle->Load(std::move(reusable_buffer));
369+
if (!buf.IsValid()) {
370+
reservation.Resize(0);
371+
return buf; // Buffer was destroyed (e.g., due to DestroyBufferUpon::Eviction)
372+
}
369373
auto &memory_charge = handle->GetMemoryCharge(lock);
370374
memory_charge = std::move(reservation);
371375
// in the case of a variable sized block, the buffer may be smaller than a full block.

0 commit comments

Comments
 (0)