-
Notifications
You must be signed in to change notification settings - Fork 123
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
[CBRD-23866] Fix not to reuse heap when creating a table with REUSE_OID #2584
Conversation
The code changed is based on the previous things and to make it consistent with 9.X version. 9.3.9
|
@byungwook-kim Hi, this fix makes a sql test failed. You can check the ci/cicleci: test_sql to see the test, which prints query plans. This patch makes only DONT_REUSE_OID table to be able to reuse a heap file. This patch possibly makes the number of allocated pages and slots different than before. Could it have an impact on the query plan? Please let me have your thoughts. Thank you. |
Please check the below code sequence in query optimization:
|
I think the answer file is wrong and should be changed together. With this PR, it is no longer affected by the previous dropped heap file. So it seems to reveal the wrong answer of the test case. As mentioned by @byungwook-kim, one of the factors for generating a query plan is the number of pages in the heap file, and this is different like below: Num_pages (by SHOW HEAP CAPACITY): I need your confirmation because query optimization is not my area, @byungwook-kim. Do you agree that this different number of pages affects the query plan and the answer file should be changed along? |
Ok, I agree with you. If the query plan need to change by this issue then please request QA team to change the test case. |
@byungwook-kim thanks for replying. |
src/storage/heap_file.c
Outdated
@@ -5187,7 +5187,7 @@ heap_create_internal (THREAD_ENTRY * thread_p, HFID * hfid, const OID * class_oi | |||
|
|||
memset (&des, 0, sizeof (des)); | |||
|
|||
if (prm_get_bool_value (PRM_ID_DONT_REUSE_HEAP_FILE) == false) | |||
if (prm_get_bool_value (PRM_ID_DONT_REUSE_HEAP_FILE) == false && file_type != FILE_HEAP_REUSE_SLOTS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- How about using '==' like the first condition of &&? I mean that the 'file_type == FILE_HEAP' expression is more readable I think.
- Codes that check FILE_HEAP_REUSE_SLOTS remain in the functions called when the 'if condition' is true. This is no longer unnecessary and needs to be removed. However, I ask you to keep a separate record for this because it is more efficient to deal with this problem in the reuse heap improvement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the code sequence, the heap_cache_class_info is called. the heap_cache_class_info asserts that file type is FILE_HEAP. I think therefore it needs check the file type is FILE_HEAP or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I partially agree with that. I did like you said, but I changed because in pre-version like 10.1, file_type is already filtered and this code is based on it. If
file_type == FILE_HEAP
is used, the code will be different by version although the purpose is the same. What do you think about it? - Do you mean all the code blocks not covered due to this patch should be removed together? For example,
file_tracker_item_reuse_heap()
and evenheap_reuse()
? I'm not sure it's right because that functions are designed to cover both file types and it'd be better to leave it for future use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@byungwook-kim Could you let me know more clearly? Do you have the same opinion with @hornetmj and give me one more reason?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I think it's right to move in the right direction. And as the code is changed to cpp, the logic is the same, but there are many cases where the code has changed.
- I partially agree with your opinion. The important thing is to write it down so we can consider it if necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I agree
http://jira.cubrid.org/browse/CBRD-23866