Skip to content

Commit

Permalink
fix(p2): rid inconsistency in b plus tree printer (#766)
Browse files Browse the repository at this point in the history
  • Loading branch information
unw9527 authored Oct 24, 2024
1 parent 613c0f5 commit 6fd1846
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/include/storage/index/b_plus_tree_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,12 @@ void BPLUSTREE_TYPE::BatchOpsFromFile(const std::filesystem::path &file_name) {
int64_t key;
char instruction;
std::ifstream input(file_name);
while (input) {
input >> instruction >> key;
RID rid(key);
if (!input.is_open()) {
std::cerr << "Failed to open file: " << file_name << std::endl;
return;
}
while (input >> instruction >> key) {
RID rid(static_cast<int32_t>(key >> 32), static_cast<int>(key & 0xFFFFFFFF));
KeyType index_key;
index_key.SetFromInteger(key);
switch (instruction) {
Expand All @@ -243,9 +246,14 @@ void BPLUSTREE_TYPE::BatchOpsFromFile(const std::filesystem::path &file_name) {
Remove(index_key);
break;
default:
std::cerr << "Unknown instruction: " << instruction << std::endl;
break;
}
}
if (input.bad()) {
std::cerr << "Error reading file: " << file_name << std::endl;
}
input.close();
}

INDEX_TEMPLATE_ARGUMENTS
Expand Down

0 comments on commit 6fd1846

Please sign in to comment.