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 drop node property bug #1356

Merged
merged 1 commit into from
Mar 8, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/include/common/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct BufferPoolConstants {
struct StorageConstants {
// The default amount of memory pre-allocated to both the default and large pages buffer pool.
static constexpr uint64_t DEFAULT_BUFFER_POOL_SIZE = 1ull << 30; // (1GB)
static constexpr uint64_t DEFAULT_BUFFER_POOL_SIZE_FOR_TESTING = 1ull << 26; // (64MB)
static constexpr uint64_t DEFAULT_BUFFER_POOL_SIZE_FOR_TESTING = 1ull << 27; // (128MB)
// The default ratio of system memory allocated to buffer pools (including default and large).
static constexpr double DEFAULT_BUFFER_POOL_RATIO = 0.8;
// The default ratio of buffer allocated to default and large pages.
Expand Down
4 changes: 2 additions & 2 deletions src/storage/buffer_manager/buffer_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ BufferPool::BufferPool(uint64_t pageSize, uint64_t maxSize)
numFrames((page_idx_t)(ceil((double)maxSize / (double)pageSize))) {
assert(pageSize == BufferPoolConstants::DEFAULT_PAGE_SIZE ||
pageSize == BufferPoolConstants::LARGE_PAGE_SIZE);
auto mmapRegion = (u_int8_t*)mmap(
auto mmapRegion = (uint8_t*)mmap(
NULL, (numFrames * pageSize), PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
for (auto i = 0u; i < numFrames; ++i) {
auto buffer = mmapRegion + (i * pageSize);
Expand All @@ -75,7 +75,7 @@ void BufferPool::resize(uint64_t newSize) {
auto newNumFrames = (page_idx_t)(ceil((double)newSize / (double)pageSize));
assert(newNumFrames < UINT32_MAX);
auto mmapRegion =
(u_int8_t*)mmap(NULL, newSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
(uint8_t*)mmap(NULL, newSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
for (auto i = 0u; i < newNumFrames - numFrames; ++i) {
auto buffer = mmapRegion + (i * pageSize);
bufferCache.emplace_back(std::make_unique<Frame>(pageSize, buffer));
Expand Down
6 changes: 3 additions & 3 deletions src/storage/wal_replayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,18 +353,18 @@ void WALReplayer::replayWALRecord(WALRecord& walRecord) {
auto propertyID = walRecord.dropPropertyRecord.propertyID;
if (!isRecovering) {
if (catalog->getReadOnlyVersion()->containNodeTable(tableID)) {
storageManager->getNodesStore().getNodeTable(tableID)->removeProperty(
propertyID);
WALReplayerUtils::removeDBFilesForNodeProperty(
wal->getDirectory(), tableID, propertyID);
storageManager->getNodesStore().getNodeTable(tableID)->removeProperty(
propertyID);
} else {
WALReplayerUtils::removeDBFilesForRelProperty(wal->getDirectory(),
catalog->getReadOnlyVersion()->getRelTableSchema(tableID), propertyID);
storageManager->getRelsStore().getRelTable(tableID)->removeProperty(
propertyID, *catalog->getReadOnlyVersion()->getRelTableSchema(tableID));
}
} else {
auto catalogForRecovery = getCatalogForRecovery(DBFileType::ORIGINAL);
auto catalogForRecovery = getCatalogForRecovery(DBFileType::WAL_VERSION);
if (catalogForRecovery->getReadOnlyVersion()->containNodeTable(tableID)) {
WALReplayerUtils::removeDBFilesForNodeProperty(
wal->getDirectory(), tableID, propertyID);
Expand Down