-
Notifications
You must be signed in to change notification settings - Fork 318
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### What problem does this PR solve? 1. Add: use buffer manager cache version file. 2. Fix scheduler task number decrease bug. 3. Fix: mem hnsw bug when using MemIndexInserterIter 4. Test: mem hnsw insert test. 5. Fix: add delta op which is already in full checkpoint. Issue link:#1042 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) - [x] Test cases
- Loading branch information
1 parent
2587ce0
commit e7d7a3b
Showing
40 changed files
with
617 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// Copyright(C) 2023 InfiniFlow, Inc. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
module; | ||
|
||
module version_file_worker; | ||
|
||
import stl; | ||
import file_worker; | ||
import block_version; | ||
import infinity_exception; | ||
|
||
namespace infinity { | ||
|
||
VersionFileWorker::VersionFileWorker(SharedPtr<String> file_dir, SharedPtr<String> file_name, SizeT capacity) | ||
: FileWorker(std::move(file_dir), std::move(file_name)), capacity_(capacity) {} | ||
|
||
VersionFileWorker::~VersionFileWorker() { | ||
if (data_ != nullptr) { | ||
FreeInMemory(); | ||
data_ = nullptr; | ||
} | ||
} | ||
|
||
void VersionFileWorker::AllocateInMemory() { | ||
if (data_ != nullptr) { | ||
UnrecoverableError("Data is already allocated."); | ||
} | ||
if (capacity_ == 0) { | ||
UnrecoverableError("Capacity is 0."); | ||
} | ||
auto *data = new BlockVersion(capacity_); | ||
data_ = static_cast<void *>(data); | ||
} | ||
|
||
void VersionFileWorker::FreeInMemory() { | ||
if (data_ == nullptr) { | ||
UnrecoverableError("Data is already freed."); | ||
} | ||
auto *data = static_cast<BlockVersion *>(data_); | ||
delete data; | ||
data_ = nullptr; | ||
} | ||
|
||
// FIXME | ||
SizeT VersionFileWorker::GetMemoryCost() const { return capacity_ * sizeof(TxnTimeStamp); } | ||
|
||
void VersionFileWorker::WriteToFileImpl(bool to_spill, bool &prepare_success) { | ||
if (data_ == nullptr) { | ||
UnrecoverableError("Data is not allocated."); | ||
} | ||
auto *data = static_cast<BlockVersion *>(data_); | ||
if (to_spill) { | ||
data->SpillToFile(*file_handler_); | ||
} else { | ||
data->SaveToFile(checkpoint_ts_, *file_handler_); | ||
} | ||
} | ||
|
||
void VersionFileWorker::ReadFromFileImpl() { | ||
if (data_ != nullptr) { | ||
UnrecoverableError("Data is already allocated."); | ||
} | ||
auto *data = BlockVersion::LoadFromFile(*file_handler_).release(); | ||
data_ = static_cast<void *>(data); | ||
} | ||
|
||
} // namespace infinity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright(C) 2023 InfiniFlow, Inc. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
module; | ||
|
||
export module version_file_worker; | ||
|
||
import stl; | ||
import file_worker; | ||
|
||
namespace infinity { | ||
|
||
export class VersionFileWorker : public FileWorker { | ||
public: | ||
explicit VersionFileWorker(SharedPtr<String> file_dir, SharedPtr<String> file_name, SizeT capacity); | ||
|
||
virtual ~VersionFileWorker() override; | ||
|
||
public: | ||
void AllocateInMemory() override; | ||
|
||
void FreeInMemory() override; | ||
|
||
SizeT GetMemoryCost() const override; | ||
|
||
void SetCheckpointTS(TxnTimeStamp ts) { checkpoint_ts_ = ts; } | ||
|
||
protected: | ||
void WriteToFileImpl(bool to_spill, bool &prepare_success) override; | ||
|
||
void ReadFromFileImpl() override; | ||
|
||
private: | ||
SizeT capacity_{}; | ||
TxnTimeStamp checkpoint_ts_{}; | ||
}; | ||
|
||
} // namespace infinity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.