Skip to content

Commit

Permalink
Change PageSize from UInt32 to UInt64 (#301)
Browse files Browse the repository at this point in the history
JaySon-Huang authored Oct 31, 2019
1 parent a883ff9 commit e81d73a
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dbms/src/Storages/Page/Page.h
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ struct PageCache
// if file_id == 0, means it is invalid
PageFileId file_id = 0;
UInt32 level = 0;
UInt32 size = 0;
PageSize size = 0;
UInt64 offset = 0;
UInt64 tag = 0;
UInt64 checksum = 0;
2 changes: 2 additions & 0 deletions dbms/src/Storages/Page/PageDefines.h
Original file line number Diff line number Diff line change
@@ -29,6 +29,8 @@ using PageFileId = UInt64;
using PageFileIdAndLevel = std::pair<PageFileId, UInt32>;
using PageFileIdAndLevels = std::vector<PageFileIdAndLevel>;

using PageSize = UInt64;

struct ByteBuffer
{
using Pos = char *;
2 changes: 1 addition & 1 deletion dbms/src/Storages/Page/PageFile.cpp
Original file line number Diff line number Diff line change
@@ -233,10 +233,10 @@ namespace PageMetaFormat
{
using WBSize = UInt32;
using PageFileVersion = PageFile::Version;
// TODO we should align these alias with type in PageCache
using PageTag = UInt64;
using IsPut = UInt8;
using PageOffset = UInt64;
using PageSize = UInt32;
using Checksum = UInt64;

static const size_t PAGE_META_SIZE = sizeof(PageId) + sizeof(PageTag) + sizeof(PageOffset) + sizeof(PageSize) + sizeof(Checksum);
4 changes: 2 additions & 2 deletions dbms/src/Storages/Page/WriteBatch.h
Original file line number Diff line number Diff line change
@@ -17,12 +17,12 @@ class WriteBatch
PageId page_id;
UInt64 tag;
ReadBufferPtr read_buffer;
UInt32 size;
PageSize size;
};
using Writes = std::vector<Write>;

public:
void putPage(PageId page_id, UInt64 tag, const ReadBufferPtr & read_buffer, UInt32 size)
void putPage(PageId page_id, UInt64 tag, const ReadBufferPtr & read_buffer, PageSize size)
{
Write w = {true, page_id, tag, read_buffer, size};
writes.push_back(w);

0 comments on commit e81d73a

Please sign in to comment.