-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[BUG]索引扫描删除记录不能完全删除 #272
Comments
Thanks. |
To minimize code structure modifications as much as possible, my current solution is to add a boolean property called If you think this approach is feasible, I can submit a pull request (PR), or you can provide me with some suggestions. |
Thanks for your suggestion. It looks not a perfect solution.
Do you know the method that some real-database uses, such as mysql, postgresql? |
Do you mean that, similar to using |
std::iterator cannot deal with erase or insert correctly. |
Is it possible to fix this bug? The test samples in the competition involve this issue, and it won't pass the test if it's not fixed. |
Describe the bug
走索引扫描删除记录时删除不能全部删除
Environment
Fast Reproduce Steps(Required)
Steps to reproduce the behavior:
miniob> create table t (id int,age int);
SUCCESS
miniob> create index t_id_idx on t (id);
SUCCESS
miniob> insert into t values (1,10);
SUCCESS
miniob > insert into t values (1,11);
SUCCESS
miniob > insert into t values (1,12);
SUCCESS
miniob > select from t;
id|age
1|10
1|11
1|12
miniob > delete from t where id 1;
SUCCESS
Expected behavior
记录应该全部被删除
miniob > select from t;
id|age
Actual Behavior
What is the result? picture is allowed
中间的记录被跳过没有被删除
miniob > select from t;
id|age
1|11
Additional context
RC BplusTreeScanner::next_entry(RID& rid, bool idx_need_increase)
这个函数中查找下一个entry时,会把iter_index_++
,但删除一条记录会将其对应的索引向前覆盖memmove(__item_at(index), __item_at(index + 1), (size() - index - 1) * item_size())
,iter_index_++
就直接跳过了下一条要获取的记录了。The text was updated successfully, but these errors were encountered: