Skip to content

Commit 83dbe90

Browse files
committed
fix(storage): explicit NULL check for headerPage (review)
KU_ASSERT is no-op in release builds; add runtime check and throw RuntimeException so release handles failed optimistic read.
1 parent b1c4fc5 commit 83dbe90

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/storage/disk_array_collection.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include <memory>
44

5+
#include "common/exception/runtime.h"
56
#include "common/system_config.h"
67
#include "common/types/types.h"
78
#include "storage/file_handle.h"
@@ -35,7 +36,9 @@ DiskArrayCollection::DiskArrayCollection(FileHandle& fileHandle, ShadowFile& sha
3536
headerPage = std::make_unique<HeaderPage>(*page);
3637
nextHeaderPageIdx = page->nextHeaderPage;
3738
});
38-
KU_ASSERT(headerPage);
39+
if (!headerPage) {
40+
throw RuntimeException("Failed to read header page from disk.");
41+
}
3942
numHeaders += headerPage->numHeaders;
4043
headersForReadTrx.push_back(std::make_unique<HeaderPage>(*headerPage));
4144
headersForWriteTrx.push_back(std::move(headerPage));

0 commit comments

Comments
 (0)