Fixing data types and cleaning up some code
parent
8d4e99a7af
commit
031547cf6d
|
@ -2115,10 +2115,6 @@ pg_stat_monitor_internal(FunctionCallInfo fcinfo,
|
||||||
|
|
||||||
values[i++] = UInt64GetDatum(pgsm_query_id);
|
values[i++] = UInt64GetDatum(pgsm_query_id);
|
||||||
|
|
||||||
/* state at column number 8 for V1.0 API*/
|
|
||||||
if (api_version <= PGSM_V1_0)
|
|
||||||
values[i++] = Int64GetDatumFast(tmp.state);
|
|
||||||
|
|
||||||
/* parentid at column number 9 */
|
/* parentid at column number 9 */
|
||||||
if (tmp.info.parentid != UINT64CONST(0))
|
if (tmp.info.parentid != UINT64CONST(0))
|
||||||
{
|
{
|
||||||
|
@ -2264,12 +2260,8 @@ pg_stat_monitor_internal(FunctionCallInfo fcinfo,
|
||||||
values[i++] = Int64GetDatumFast(tmp.blocks.temp_blks_written);
|
values[i++] = Int64GetDatumFast(tmp.blocks.temp_blks_written);
|
||||||
values[i++] = Float8GetDatumFast(tmp.blocks.blk_read_time);
|
values[i++] = Float8GetDatumFast(tmp.blocks.blk_read_time);
|
||||||
values[i++] = Float8GetDatumFast(tmp.blocks.blk_write_time);
|
values[i++] = Float8GetDatumFast(tmp.blocks.blk_write_time);
|
||||||
|
|
||||||
if (api_version >= PGSM_V2_0)
|
|
||||||
{
|
|
||||||
values[i++] = Float8GetDatumFast(tmp.blocks.temp_blk_read_time);
|
values[i++] = Float8GetDatumFast(tmp.blocks.temp_blk_read_time);
|
||||||
values[i++] = Float8GetDatumFast(tmp.blocks.temp_blk_write_time);
|
values[i++] = Float8GetDatumFast(tmp.blocks.temp_blk_write_time);
|
||||||
}
|
|
||||||
|
|
||||||
/* resp_calls at column number 41 */
|
/* resp_calls at column number 41 */
|
||||||
values[i++] = IntArrayGetTextDatum(tmp.resp_calls, hist_bucket_count_total);
|
values[i++] = IntArrayGetTextDatum(tmp.resp_calls, hist_bucket_count_total);
|
||||||
|
@ -2305,8 +2297,6 @@ pg_stat_monitor_internal(FunctionCallInfo fcinfo,
|
||||||
else
|
else
|
||||||
nulls[i++] = true;
|
nulls[i++] = true;
|
||||||
|
|
||||||
if (api_version >= PGSM_V2_0)
|
|
||||||
{
|
|
||||||
values[i++] = Int64GetDatumFast(tmp.jitinfo.jit_functions);
|
values[i++] = Int64GetDatumFast(tmp.jitinfo.jit_functions);
|
||||||
values[i++] = Float8GetDatumFast(tmp.jitinfo.jit_generation_time);
|
values[i++] = Float8GetDatumFast(tmp.jitinfo.jit_generation_time);
|
||||||
values[i++] = Int64GetDatumFast(tmp.jitinfo.jit_inlining_count);
|
values[i++] = Int64GetDatumFast(tmp.jitinfo.jit_inlining_count);
|
||||||
|
@ -2316,7 +2306,6 @@ pg_stat_monitor_internal(FunctionCallInfo fcinfo,
|
||||||
values[i++] = Int64GetDatumFast(tmp.jitinfo.jit_emission_count);
|
values[i++] = Int64GetDatumFast(tmp.jitinfo.jit_emission_count);
|
||||||
values[i++] = Float8GetDatumFast(tmp.jitinfo.jit_emission_time);
|
values[i++] = Float8GetDatumFast(tmp.jitinfo.jit_emission_time);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
values[i++] = BoolGetDatum(toplevel);
|
values[i++] = BoolGetDatum(toplevel);
|
||||||
values[i++] = BoolGetDatum(pg_atomic_read_u64(&pgss->current_wbucket) != bucketid);
|
values[i++] = BoolGetDatum(pg_atomic_read_u64(&pgss->current_wbucket) != bucketid);
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,6 @@
|
||||||
|
|
||||||
#define MAX_RESPONSE_BUCKET 50
|
#define MAX_RESPONSE_BUCKET 50
|
||||||
#define INVALID_BUCKET_ID -1
|
#define INVALID_BUCKET_ID -1
|
||||||
#define MAX_REL_LEN 255
|
|
||||||
#define MAX_BUCKETS 10
|
#define MAX_BUCKETS 10
|
||||||
#define TEXT_LEN 255
|
#define TEXT_LEN 255
|
||||||
#define ERROR_MESSAGE_LEN 100
|
#define ERROR_MESSAGE_LEN 100
|
||||||
|
@ -83,8 +82,8 @@
|
||||||
#define REL_LEN 132 /* REL_TYPENAME_LEN * 2 (relname + schema) + 1 (for view indication) + 1 and dot and string terminator */
|
#define REL_LEN 132 /* REL_TYPENAME_LEN * 2 (relname + schema) + 1 (for view indication) + 1 and dot and string terminator */
|
||||||
#define CMD_LST 10
|
#define CMD_LST 10
|
||||||
#define CMD_LEN 20
|
#define CMD_LEN 20
|
||||||
#define APPLICATIONNAME_LEN 100
|
#define APPLICATIONNAME_LEN NAMEDATALEN
|
||||||
#define COMMENTS_LEN 512
|
#define COMMENTS_LEN 256
|
||||||
#define PGSM_OVER_FLOW_MAX 10
|
#define PGSM_OVER_FLOW_MAX 10
|
||||||
#define PLAN_TEXT_LEN 1024
|
#define PLAN_TEXT_LEN 1024
|
||||||
/* the assumption of query max nested level */
|
/* the assumption of query max nested level */
|
||||||
|
@ -346,8 +345,8 @@ typedef struct JitInfo
|
||||||
|
|
||||||
typedef struct SysInfo
|
typedef struct SysInfo
|
||||||
{
|
{
|
||||||
float utime; /* user cpu time */
|
double utime; /* user cpu time */
|
||||||
float stime; /* system cpu time */
|
double stime; /* system cpu time */
|
||||||
} SysInfo;
|
} SysInfo;
|
||||||
|
|
||||||
typedef struct Wal_Usage
|
typedef struct Wal_Usage
|
||||||
|
@ -374,7 +373,6 @@ typedef struct Counters
|
||||||
Wal_Usage walusage;
|
Wal_Usage walusage;
|
||||||
int resp_calls[MAX_RESPONSE_BUCKET]; /* execution time's in
|
int resp_calls[MAX_RESPONSE_BUCKET]; /* execution time's in
|
||||||
* msec */
|
* msec */
|
||||||
int64 state; /* query state */
|
|
||||||
} Counters;
|
} Counters;
|
||||||
|
|
||||||
/* Some global structure to get the cpu usage, really don't like the idea of global variable */
|
/* Some global structure to get the cpu usage, really don't like the idea of global variable */
|
||||||
|
@ -404,14 +402,10 @@ typedef struct pgssSharedState
|
||||||
LWLock *lock; /* protects hashtable search/modification */
|
LWLock *lock; /* protects hashtable search/modification */
|
||||||
double cur_median_usage; /* current median usage in hashtable */
|
double cur_median_usage; /* current median usage in hashtable */
|
||||||
slock_t mutex; /* protects following fields only: */
|
slock_t mutex; /* protects following fields only: */
|
||||||
Size extent; /* current extent of query file */
|
|
||||||
int64 n_writers; /* number of active writers to query file */
|
|
||||||
pg_atomic_uint64 current_wbucket;
|
pg_atomic_uint64 current_wbucket;
|
||||||
pg_atomic_uint64 prev_bucket_sec;
|
pg_atomic_uint64 prev_bucket_sec;
|
||||||
uint64 bucket_entry[MAX_BUCKETS];
|
uint64 bucket_entry[MAX_BUCKETS];
|
||||||
TimestampTz bucket_start_time[MAX_BUCKETS]; /* start time of the bucket */
|
TimestampTz bucket_start_time[MAX_BUCKETS]; /* start time of the bucket */
|
||||||
LWLock *errors_lock; /* protects errors hashtable
|
|
||||||
* search/modification */
|
|
||||||
int hash_tranche_id;
|
int hash_tranche_id;
|
||||||
void *raw_dsa_area; /* DSA area pointer to store query texts.
|
void *raw_dsa_area; /* DSA area pointer to store query texts.
|
||||||
* dshash also lives in this memory when
|
* dshash also lives in this memory when
|
||||||
|
@ -436,7 +430,6 @@ typedef struct pgsmLocalState
|
||||||
do { \
|
do { \
|
||||||
x->cur_median_usage = ASSUMED_MEDIAN_INIT; \
|
x->cur_median_usage = ASSUMED_MEDIAN_INIT; \
|
||||||
x->cur_median_usage = ASSUMED_MEDIAN_INIT; \
|
x->cur_median_usage = ASSUMED_MEDIAN_INIT; \
|
||||||
x->n_writers = 0; \
|
|
||||||
pg_atomic_init_u64(&x->current_wbucket, 0); \
|
pg_atomic_init_u64(&x->current_wbucket, 0); \
|
||||||
pg_atomic_init_u64(&x->prev_bucket_sec, 0); \
|
pg_atomic_init_u64(&x->prev_bucket_sec, 0); \
|
||||||
memset(&x->bucket_entry, 0, MAX_BUCKETS * sizeof(uint64)); \
|
memset(&x->bucket_entry, 0, MAX_BUCKETS * sizeof(uint64)); \
|
||||||
|
@ -479,15 +472,6 @@ typedef struct JumbleState
|
||||||
} JumbleState;
|
} JumbleState;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Links to shared memory state */
|
|
||||||
|
|
||||||
bool SaveQueryText(uint64 bucketid,
|
|
||||||
uint64 queryid,
|
|
||||||
unsigned char *buf,
|
|
||||||
const char *query,
|
|
||||||
uint64 query_len,
|
|
||||||
size_t *query_pos);
|
|
||||||
|
|
||||||
/* guc.c */
|
/* guc.c */
|
||||||
void init_guc(void);
|
void init_guc(void);
|
||||||
GucVariable *get_conf(int i);
|
GucVariable *get_conf(int i);
|
||||||
|
|
Loading…
Reference in New Issue