Skip to content
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-25509] Remove big_length handling from the function, heap_stats_find_best_page. #5687

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions src/storage/heap_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ static HEAP_FINDSPACE heap_stats_find_page_in_bestspace (THREAD_ENTRY * thread_p
int record_length, int needed_space,
HEAP_SCANCACHE * scan_cache, PGBUF_WATCHER * pg_watcher);
static PAGE_PTR heap_stats_find_best_page (THREAD_ENTRY * thread_p, const HFID * hfid, int needed_space, bool isnew_rec,
int newrec_size, HEAP_SCANCACHE * space_cache, PGBUF_WATCHER * pg_watcher);
HEAP_SCANCACHE * space_cache, PGBUF_WATCHER * pg_watcher);
static int heap_stats_sync_bestspace (THREAD_ENTRY * thread_p, const HFID * hfid, HEAP_HDR_STATS * heap_hdr,
VPID * hdr_vpid, bool scan_all, bool can_cycle);

Expand Down Expand Up @@ -3492,8 +3492,8 @@ heap_stats_find_page_in_bestspace (THREAD_ENTRY * thread_p, const HFID * hfid, H
* hfid(in): Object heap file identifier
* needed_space(in): The minimal space needed
* isnew_rec(in): Are we inserting a new record to the heap ?
* newrec_size(in): Size of the new record
* scan_cache(in/out): Scan cache used to estimate the best space pages
* pg_watcher(out): watcher for a found page.
*
* Note: Find a page among the set of best pages of the heap which has
* the needed space. If we do not find any page, a new page is
Expand All @@ -3503,7 +3503,7 @@ heap_stats_find_page_in_bestspace (THREAD_ENTRY * thread_p, const HFID * hfid, H
*/
static PAGE_PTR
heap_stats_find_best_page (THREAD_ENTRY * thread_p, const HFID * hfid, int needed_space, bool isnew_rec,
int newrec_size, HEAP_SCANCACHE * scan_cache, PGBUF_WATCHER * pg_watcher)
HEAP_SCANCACHE * scan_cache, PGBUF_WATCHER * pg_watcher)
{
VPID vpid; /* Volume and page identifiers */
LOG_DATA_ADDR addr_hdr; /* Address of logging data */
Expand Down Expand Up @@ -3564,17 +3564,14 @@ heap_stats_find_best_page (THREAD_ENTRY * thread_p, const HFID * hfid, int neede

heap_hdr = (HEAP_HDR_STATS *) hdr_recdes.data;

assert (!heap_is_big_length (needed_space));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT:

함수의 첫번째 assert() 검사가 전달받은 인자를 검사하는 것입니다. 해당 assert() 다음 라인에서 검사하는게 일관성 있어 보입니다.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이건 디테일이네요. 처리 후 멘션 드리겠습니다!


if (isnew_rec == true)
{
heap_hdr->estimates.num_recs += 1;
if (newrec_size > DB_PAGESIZE)
hyahong marked this conversation as resolved.
Show resolved Hide resolved
{
heap_hdr->estimates.num_pages += CEIL_PTVDIV (newrec_size, DB_PAGESIZE);
}
}
heap_hdr->estimates.recs_sumlen += (float) newrec_size;
heap_hdr->estimates.recs_sumlen += (float) needed_space;

assert (!heap_is_big_length (needed_space));
/* Take into consideration the unfill factor for pages with objects */
total_space = needed_space + heap_Slotted_overhead + heap_hdr->unfill_space;
if (heap_is_big_length (total_space))
Expand Down Expand Up @@ -20463,13 +20460,13 @@ heap_get_insert_location_with_lock (THREAD_ENTRY * thread_p, HEAP_OPERATION_CONT
assert (context != NULL);
assert (context->type == HEAP_OPERATION_INSERT);
assert (context->recdes_p != NULL);
assert (context->recdes_p->type != REC_NEWHOME);

if (home_hint_p == NULL)
{
/* find and fix page for insert */
if (heap_stats_find_best_page (thread_p, &context->hfid, context->recdes_p->length,
(context->recdes_p->type != REC_NEWHOME), context->recdes_p->length,
context->scan_cache_p, context->home_page_watcher_p) == NULL)
true, context->scan_cache_p, context->home_page_watcher_p) == NULL)
{
ASSERT_ERROR_AND_SET (error_code);
return error_code;
Expand Down Expand Up @@ -20610,7 +20607,7 @@ heap_find_location_and_insert_rec_newhome (THREAD_ENTRY * thread_p, HEAP_OPERATI
}
#endif

if (heap_stats_find_best_page (thread_p, &context->hfid, context->recdes_p->length, false, context->recdes_p->length,
if (heap_stats_find_best_page (thread_p, &context->hfid, context->recdes_p->length, false,
context->scan_cache_p, context->home_page_watcher_p) == NULL)
{
ASSERT_ERROR_AND_SET (error_code);
Expand Down
Loading