apply more update till root

This commit is contained in:
2024-04-30 06:21:41 +00:00
parent a75b5d8ed5
commit 27ed3f9a55
3 changed files with 17 additions and 2 deletions

View File

@ -512,6 +512,11 @@ class BPlusTreeIndexer {
prev_page_guard.template As<PageType>()
->data.p_data[prev_page_guard.template As<PageType>()->data.key_count - 1]
.first;
if (need_update) {
// now we need to check if we have to update the right bound till the root
pos.path.pop_back();
TryUpdateTillRoot(pos);
}
return;
}
}
@ -546,6 +551,9 @@ class BPlusTreeIndexer {
.second;
}
}
// now we need to check if we have to update the right bound till the root
pos.path.pop_back();
TryUpdateTillRoot(pos);
return;
}
}

View File

@ -40,13 +40,17 @@ int main() {
{
BPlusTreeIndexer<ValType, std::less<ValType>> bpt(buffer_pool_manager);
int n;
// freopen("/workspaces/BH-TicketSystem/build/pro.in", "r", stdin);
// freopen("/workspaces/BH-TicketSystem/build/pro.out", "w", stdout);
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cout.tie(nullptr);
std::string op, index;
int val;
std::cin >> n;
int opt_cnt = 0;
while (n-- > 0) {
++opt_cnt;
std::cin >> op;
if (op[0] == 'i') {
std::cin >> index >> val;
@ -73,6 +77,9 @@ int main() {
std::cout << '\n';
} else
throw std::runtime_error("Invalid operation");
// if (opt_cnt >= 133768) {
// bpt.CheckIndex();
// }
}
}
delete buffer_pool_manager;

View File

@ -21,8 +21,8 @@ int main(int argc, char *argv[]) {
fprintf(fout, "Seed = %u\n", RndSeed);
fclose(fout);
// ======================================
int n = 100000;
int total_keys = 30000;
int n = 300000;
int total_keys = 100000;
set<string> keys_set;
for (int i = 0; i < total_keys; i++) {
string key = "#" + to_string(rnd_less(1000000)) + "#";