From 4c5739863ba90b4d35545941af6d75806e9dee35 Mon Sep 17 00:00:00 2001 From: InChijun Date: Mon, 9 Dec 2024 10:49:56 +0900 Subject: [PATCH 1/3] [CBRD-25028] Disable heap_chnguess_realloc() function --- src/storage/heap_file.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/storage/heap_file.c b/src/storage/heap_file.c index 0afd46641b3..29a5be362a6 100644 --- a/src/storage/heap_file.c +++ b/src/storage/heap_file.c @@ -721,7 +721,9 @@ static int heap_chkreloc_print_notfound (const void *ignore_reloc_oid, void *ent static DISK_ISVALID heap_chkreloc_next (THREAD_ENTRY * thread_p, HEAP_CHKALL_RELOCOIDS * chk, PAGE_PTR pgptr); static int heap_chnguess_initialize (void); +#if defined(ENABLE_UNUSED_FUNCTION) static int heap_chnguess_realloc (void); +#endif /* #if defined (ENABLE_UNUSED_FUNCTION) */ static int heap_chnguess_finalize (void); static int heap_chnguess_decache (const OID * oid); static int heap_chnguess_remove_entry (const void *oid_key, void *ent, void *xignore); @@ -15214,6 +15216,7 @@ heap_chnguess_initialize (void) return (ret == NO_ERROR) ? ER_FAILED : ret; } +#if defined(ENABLE_UNUSED_FUNCTION) /* * heap_chnguess_realloc () - More clients that currently maintained * return: NO_ERROR @@ -15295,6 +15298,7 @@ heap_chnguess_realloc (void) return (ret == NO_ERROR && (ret = er_errid ()) == NO_ERROR) ? ER_FAILED : ret; } +#endif /* ENABLE_UNUSED_FUNCTION */ /* * heap_chnguess_finalize () - Finish chnguess information @@ -15574,14 +15578,7 @@ heap_chnguess_get (THREAD_ENTRY * thread_p, const OID * oid, int tran_index) if (heap_Guesschn != NULL) { - if (heap_Guesschn->num_clients <= tran_index) - { - if (heap_chnguess_realloc () != NO_ERROR) - { - csect_exit (thread_p, CSECT_HEAP_CHNGUESS); - return NULL_CHN; - } - } + assert (heap_Guesschn->num_clients > tran_index); /* * Do we have this entry in hash table, if we do then check corresponding @@ -15629,14 +15626,7 @@ heap_chnguess_put (THREAD_ENTRY * thread_p, const OID * oid, int tran_index, int return NULL_CHN; } - if (heap_Guesschn->num_clients <= tran_index) - { - if (heap_chnguess_realloc () != NO_ERROR) - { - csect_exit (thread_p, CSECT_HEAP_CHNGUESS); - return NULL_CHN; - } - } + assert (heap_Guesschn->num_clients > tran_index); /* * Is the entry already in the chnguess hash table ? From 1c324b69a743837b733be8a3e4a2b71b8fcd7e24 Mon Sep 17 00:00:00 2001 From: InChijun Date: Mon, 9 Dec 2024 13:24:20 +0900 Subject: [PATCH 2/3] [CBRD-25028] Refactor: remove comments --- src/storage/heap_file.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/storage/heap_file.c b/src/storage/heap_file.c index 29a5be362a6..c7a27f96628 100644 --- a/src/storage/heap_file.c +++ b/src/storage/heap_file.c @@ -670,7 +670,7 @@ static int heap_scancache_end_internal (THREAD_ENTRY * thread_p, HEAP_SCANCACHE #if defined (ENABLE_UNUSED_FUNCTION) static SCAN_CODE heap_get_if_diff_chn (THREAD_ENTRY * thread_p, PAGE_PTR pgptr, INT16 slotid, RECDES * recdes, bool ispeeking, int chn, MVCC_SNAPSHOT * mvcc_snapshot); -#endif /* ENABLE_UNUSED_FUNCTION */ +#endif static int heap_estimate_avg_length (THREAD_ENTRY * thread_p, const HFID * hfid, int &avg_reclen); static int heap_get_capacity (THREAD_ENTRY * thread_p, const HFID * hfid, INT64 * num_recs, INT64 * num_recs_relocated, INT64 * num_recs_inovf, INT64 * num_pages, int *avg_freespace, int *avg_freespace_nolast, @@ -723,7 +723,7 @@ static DISK_ISVALID heap_chkreloc_next (THREAD_ENTRY * thread_p, HEAP_CHKALL_REL static int heap_chnguess_initialize (void); #if defined(ENABLE_UNUSED_FUNCTION) static int heap_chnguess_realloc (void); -#endif /* #if defined (ENABLE_UNUSED_FUNCTION) */ +#endif static int heap_chnguess_finalize (void); static int heap_chnguess_decache (const OID * oid); static int heap_chnguess_remove_entry (const void *oid_key, void *ent, void *xignore); @@ -741,7 +741,7 @@ static int heap_stats_del_bestspace_by_vpid (THREAD_ENTRY * thread_p, VPID * vpi static int heap_stats_del_bestspace_by_hfid (THREAD_ENTRY * thread_p, const HFID * hfid); #if defined (ENABLE_UNUSED_FUNCTION) static HEAP_BESTSPACE heap_stats_get_bestspace_by_vpid (THREAD_ENTRY * thread_p, VPID * vpid); -#endif /* #if defined (ENABLE_UNUSED_FUNCTION) */ +#endif static HEAP_STATS_ENTRY *heap_stats_add_bestspace (THREAD_ENTRY * thread_p, const HFID * hfid, VPID * vpid, int freespace); static int heap_stats_entry_free (THREAD_ENTRY * thread_p, void *data, void *args); From c5eb5717a5bd4ea58472dc38106a73b2d616f731 Mon Sep 17 00:00:00 2001 From: InChijun Date: Tue, 17 Dec 2024 10:31:57 +0900 Subject: [PATCH 3/3] [CBRD-25028] Add comments to directives --- src/storage/heap_file.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/storage/heap_file.c b/src/storage/heap_file.c index c7a27f96628..952fb52c4c4 100644 --- a/src/storage/heap_file.c +++ b/src/storage/heap_file.c @@ -670,7 +670,7 @@ static int heap_scancache_end_internal (THREAD_ENTRY * thread_p, HEAP_SCANCACHE #if defined (ENABLE_UNUSED_FUNCTION) static SCAN_CODE heap_get_if_diff_chn (THREAD_ENTRY * thread_p, PAGE_PTR pgptr, INT16 slotid, RECDES * recdes, bool ispeeking, int chn, MVCC_SNAPSHOT * mvcc_snapshot); -#endif +#endif /* ENABLE_UNUSED_FUNCTION */ static int heap_estimate_avg_length (THREAD_ENTRY * thread_p, const HFID * hfid, int &avg_reclen); static int heap_get_capacity (THREAD_ENTRY * thread_p, const HFID * hfid, INT64 * num_recs, INT64 * num_recs_relocated, INT64 * num_recs_inovf, INT64 * num_pages, int *avg_freespace, int *avg_freespace_nolast, @@ -723,7 +723,7 @@ static DISK_ISVALID heap_chkreloc_next (THREAD_ENTRY * thread_p, HEAP_CHKALL_REL static int heap_chnguess_initialize (void); #if defined(ENABLE_UNUSED_FUNCTION) static int heap_chnguess_realloc (void); -#endif +#endif /* ENABLE_UNUSED_FUNCTION */ static int heap_chnguess_finalize (void); static int heap_chnguess_decache (const OID * oid); static int heap_chnguess_remove_entry (const void *oid_key, void *ent, void *xignore); @@ -741,7 +741,7 @@ static int heap_stats_del_bestspace_by_vpid (THREAD_ENTRY * thread_p, VPID * vpi static int heap_stats_del_bestspace_by_hfid (THREAD_ENTRY * thread_p, const HFID * hfid); #if defined (ENABLE_UNUSED_FUNCTION) static HEAP_BESTSPACE heap_stats_get_bestspace_by_vpid (THREAD_ENTRY * thread_p, VPID * vpid); -#endif +#endif /* ENABLE_UNUSED_FUNCTION */ static HEAP_STATS_ENTRY *heap_stats_add_bestspace (THREAD_ENTRY * thread_p, const HFID * hfid, VPID * vpid, int freespace); static int heap_stats_entry_free (THREAD_ENTRY * thread_p, void *data, void *args);