forked from huawei/openGauss-server
Fix unique sql bug.
This commit is contained in:
parent
a8e142f0cb
commit
bf32e4ae36
|
|
@ -19732,7 +19732,8 @@ static void assign_instr_unique_sql_count(int newval, void* extra)
|
|||
#define RESET_UNIQUE_SQL_FUNC 5716
|
||||
|
||||
/* only let WLMProcessThread do the cleanup */
|
||||
if (AmWLMWorkerProcess() && IS_PGXC_COORDINATOR && u_sess->attr.attr_common.instr_unique_sql_count > newval) {
|
||||
if (AmWLMWorkerProcess() && (IS_PGXC_COORDINATOR || IS_SINGLE_NODE) &&
|
||||
u_sess->attr.attr_common.instr_unique_sql_count > newval) {
|
||||
bool result = DatumGetBool(OidFunctionCall3(RESET_UNIQUE_SQL_FUNC,
|
||||
CStringGetTextDatum("GLOBAL"),
|
||||
CStringGetTextDatum("BY_GUC"),
|
||||
|
|
|
|||
|
|
@ -1579,13 +1579,13 @@ void instr_stmt_report_unique_sql_info(const PgStat_TableCounts *agg_table_stat,
|
|||
|
||||
if (timeInfo != NULL) {
|
||||
for (int idx = 0; idx < TOTAL_TIME_INFO_TYPES; idx++) {
|
||||
ssctx->timeModel[idx] += timeInfo[idx];
|
||||
(void)gs_atomic_add_64(&ssctx->timeModel[idx], timeInfo[idx]);
|
||||
}
|
||||
}
|
||||
|
||||
if (netInfo != NULL) {
|
||||
for (int i = 0; i < TOTAL_NET_INFO_TYPES; i++) {
|
||||
ssctx->networkInfo[i] += netInfo[i];
|
||||
(void)pg_atomic_fetch_add_u64(&ssctx->networkInfo[i], netInfo[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -543,7 +543,7 @@ static void UpdateUniqueSQLTimeStat(UniqueSQL* entry, int64 timeInfo[])
|
|||
int idx;
|
||||
|
||||
for (idx = 0; idx < TOTAL_TIME_INFO_TYPES; idx++) {
|
||||
entry->timeInfo.TimeInfoArray[idx] += timeInfo[idx];
|
||||
(void)gs_atomic_add_64(&(entry->timeInfo.TimeInfoArray[idx]), timeInfo[idx]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -552,7 +552,7 @@ static void UpdateUniqueSQLNetInfo(UniqueSQL* entry, const uint64* netInfo)
|
|||
if (netInfo == NULL)
|
||||
return;
|
||||
for (int i = 0; i < TOTAL_NET_INFO_TYPES; i++) {
|
||||
entry->netInfo.netInfoArray[i] += netInfo[i];
|
||||
(void)pg_atomic_fetch_add_u64(&(entry->netInfo.netInfoArray[i]), netInfo[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -701,8 +701,8 @@ void UpdateUniqueSQLStat(Query* query, const char* sql, int64 elapse_start_time,
|
|||
// record statement KPI info
|
||||
instr_stmt_report_unique_sql_info(NULL, sqlStat->timeInfo, sqlStat->netInfo);
|
||||
}
|
||||
(void)gs_lock_test_and_set_64(&entry->updated_time, GetCurrentTimestamp());
|
||||
UnlockUniqueSQLHashPartition(hashCode);
|
||||
entry->updated_time = GetCurrentTimestamp();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ typedef struct StatementStatContext {
|
|||
int slow_query_threshold; /* from knl_session_attr_storage's log_min_duration_statement */
|
||||
|
||||
int64 timeModel[TOTAL_TIME_INFO_TYPES]; /* from knl_u_stat_context's localTimeInfoArray */
|
||||
int64 networkInfo[TOTAL_NET_INFO_TYPES]; /* from knl_u_stat_context's localNetInfo */
|
||||
uint64 networkInfo[TOTAL_NET_INFO_TYPES]; /* from knl_u_stat_context's localNetInfo */
|
||||
UniqueSQLRowActivity row_activity; /* row activity */
|
||||
UniqueSQLCacheIO cache_io; /* cache/IO */
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue