Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into CBRD-25241
Browse files Browse the repository at this point in the history
  • Loading branch information
jongmin-won committed Apr 29, 2024
2 parents 98e3a9c + 26df098 commit aa6b1aa
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 35 deletions.
5 changes: 0 additions & 5 deletions src/base/perf_monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -1051,11 +1051,6 @@ perfmon_get_from_statistic (THREAD_ENTRY * thread_p, const int statistic_id)
if (stats != NULL)
{
int offset = pstat_Metadata[statistic_id].start_offset;
if (statistic_id == PSTAT_PB_PAGE_FIX_ACQUIRE_TIME_10USEC)
{
perfmon_server_calc_stats (stats);
return stats[offset] / 100;
}
return stats[offset];
}

Expand Down
32 changes: 32 additions & 0 deletions src/base/perf_monitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,8 @@ STATIC_INLINE void perfmon_add_stat (THREAD_ENTRY * thread_p, PERF_STAT_ID psid,
STATIC_INLINE void perfmon_add_stat_to_global (PERF_STAT_ID psid, UINT64 amount) __attribute__ ((ALWAYS_INLINE));
STATIC_INLINE void perfmon_add_at_offset (THREAD_ENTRY * thread_p, int offset, UINT64 amount)
__attribute__ ((ALWAYS_INLINE));
STATIC_INLINE void perfmon_add_at_offset_to_local (THREAD_ENTRY * thread_p, int offset, UINT64 amount)
__attribute__ ((ALWAYS_INLINE));
STATIC_INLINE void perfmon_inc_stat (THREAD_ENTRY * thread_p, PERF_STAT_ID psid) __attribute__ ((ALWAYS_INLINE));
STATIC_INLINE void perfmon_inc_stat_to_global (PERF_STAT_ID psid) __attribute__ ((ALWAYS_INLINE));
STATIC_INLINE void perfmon_set_stat (THREAD_ENTRY * thread_p, PERF_STAT_ID psid, int statval, bool check_watchers)
Expand Down Expand Up @@ -975,6 +977,36 @@ perfmon_add_at_offset (THREAD_ENTRY * thread_p, int offset, UINT64 amount)
#endif /* SERVER_MODE || SA_MODE */
}

/*
* perfmon_add_at_offset_to_local () - Add amount to statistic in local at offset.
*
* return : Void.
* thread_p (in) : Thread entry.
* offset (in) : Offset to statistics value.
* amount (in) : Amount to add.
*/
STATIC_INLINE void
perfmon_add_at_offset_to_local (THREAD_ENTRY * thread_p, int offset, UINT64 amount)
{
#if defined (SERVER_MODE) || defined (SA_MODE)
int tran_index;
#endif /* SERVER_MODE || SA_MODE */

assert (offset >= 0 && offset < pstat_Global.n_stat_values);
assert (pstat_Global.initialized);

#if defined (SERVER_MODE) || defined (SA_MODE)
/* Update local statistic */
tran_index = LOG_FIND_THREAD_TRAN_INDEX (thread_p);
assert (tran_index >= 0 && tran_index < pstat_Global.n_trans);
if (pstat_Global.is_watching[tran_index])
{
assert (pstat_Global.tran_stats[tran_index] != NULL);
pstat_Global.tran_stats[tran_index][offset] += amount;
}
#endif /* SERVER_MODE || SA_MODE */
}

/*
* perfmon_add_at_offset_to_global () - Add amount to statistic in global
*
Expand Down
32 changes: 4 additions & 28 deletions src/optimizer/query_rewrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -1774,35 +1774,11 @@ qo_reduce_equality_terms (PARSER_CONTEXT * parser, PT_NODE * node, PT_NODE ** wh
}
else
{ /* is CAST expr */
if ((dt1 = arg1->data_type) && (dt2 = arg2->data_type) && dt1->type_enum == dt2->type_enum
&& (dt1->info.data_type.precision == dt2->info.data_type.precision)
&& (dt1->info.data_type.dec_precision == dt2->info.data_type.dec_precision))
if ((temp = parser_copy_tree_list (parser, arg2)) == NULL)
{
/* exactly the same type */
if ((temp = parser_copy_tree_list (parser, arg2)) == NULL)
{
PT_ERRORm (parser, arg2, MSGCAT_SET_PARSER_SEMANTIC, MSGCAT_SEMANTIC_OUT_OF_MEMORY);
*wherep = save_where_next;
continue; /* give up */
}
}
else
{ /* create nested CAST node */
PT_NODE *dt = NULL;
if (arg1->type_enum == PT_TYPE_ENUMERATION)
{
/* be sure to cast to the same enumeration type */
dt = arg1->data_type;
}
temp =
pt_wrap_with_cast_op (parser, parser_copy_tree_list (parser, arg2), arg1->type_enum,
TP_FLOATING_PRECISION_VALUE, 0, dt);
if (temp == NULL)
{
PT_ERRORm (parser, arg2, MSGCAT_SET_PARSER_SEMANTIC, MSGCAT_SEMANTIC_OUT_OF_MEMORY);
*wherep = save_where_next;
continue; /* give up */
}
PT_ERRORm (parser, arg2, MSGCAT_SET_PARSER_SEMANTIC, MSGCAT_SEMANTIC_OUT_OF_MEMORY);
*wherep = save_where_next;
continue; /* give up */
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/query/query_executor.c
Original file line number Diff line number Diff line change
Expand Up @@ -2248,7 +2248,6 @@ qexec_clear_xasl (THREAD_ENTRY * thread_p, xasl_node * xasl, bool is_final)
pg_cnt += qexec_clear_agg_orderby_const_list (thread_p, xasl, is_final);
}


if (is_final)
{
/* clear the db_values in the tree */
Expand Down Expand Up @@ -13660,7 +13659,8 @@ qexec_execute_mainblock (THREAD_ENTRY * thread_p, xasl_node * xasl, xasl_state *
xasl->xasl_stats.fetches += perfmon_get_from_statistic (thread_p, PSTAT_PB_NUM_FETCHES) - old_fetches;
xasl->xasl_stats.ioreads += perfmon_get_from_statistic (thread_p, PSTAT_PB_NUM_IOREADS) - old_ioreads;
xasl->xasl_stats.fetch_time +=
perfmon_get_from_statistic (thread_p, PSTAT_PB_PAGE_FIX_ACQUIRE_TIME_10USEC) - old_fetch_time;
(UINT64) ((perfmon_get_from_statistic (thread_p, PSTAT_PB_PAGE_FIX_ACQUIRE_TIME_10USEC) -
old_fetch_time) / 1000);
}

thread_dec_recursion_depth (thread_p);
Expand Down
2 changes: 2 additions & 0 deletions src/storage/page_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -2152,6 +2152,8 @@ pgbuf_fix_release (THREAD_ENTRY * thread_p, const VPID * vpid, PAGE_FETCH_MODE f
{
perfmon_pbx_fix_acquire_time (thread_p, perf.perf_page_type, perf.perf_page_found, perf.perf_latch_mode,
perf.perf_cond_type, perf.fix_wait_time);
perfmon_add_at_offset_to_local (thread_p, pstat_Metadata[PSTAT_PB_PAGE_FIX_ACQUIRE_TIME_10USEC].start_offset,
perf.fix_wait_time);
}
}

Expand Down

0 comments on commit aa6b1aa

Please sign in to comment.