mirror of
https://github.com/percona/pg_stat_monitor.git
synced 2026-02-04 05:56:21 +00:00
Remove unused code
Remove unused code, macros and imports.
This commit is contained in:
committed by
Artem Gavrilov
parent
58d569f26c
commit
4041b4bd02
@@ -52,8 +52,6 @@ PG_MODULE_MAGIC;
|
|||||||
#define PG_STAT_MONITOR_COLS_V2_3 73
|
#define PG_STAT_MONITOR_COLS_V2_3 73
|
||||||
#define PG_STAT_MONITOR_COLS PG_STAT_MONITOR_COLS_V2_3 /* maximum of above */
|
#define PG_STAT_MONITOR_COLS PG_STAT_MONITOR_COLS_V2_3 /* maximum of above */
|
||||||
|
|
||||||
#define PGSM_TEXT_FILE PGSTAT_STAT_PERMANENT_DIRECTORY "pg_stat_monitor_query"
|
|
||||||
|
|
||||||
#define PGUNSIXBIT(val) (((val) & 0x3F) + '0')
|
#define PGUNSIXBIT(val) (((val) & 0x3F) + '0')
|
||||||
|
|
||||||
#define _snprintf(_str_dst, _str_src, _len, _max_len)\
|
#define _snprintf(_str_dst, _str_src, _len, _max_len)\
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
@@ -40,13 +39,11 @@
|
|||||||
#include "mb/pg_wchar.h"
|
#include "mb/pg_wchar.h"
|
||||||
#include "miscadmin.h"
|
#include "miscadmin.h"
|
||||||
#include "optimizer/planner.h"
|
#include "optimizer/planner.h"
|
||||||
#include "postmaster/bgworker.h"
|
|
||||||
#include "parser/analyze.h"
|
#include "parser/analyze.h"
|
||||||
#include "parser/parsetree.h"
|
#include "parser/parsetree.h"
|
||||||
#include "parser/scanner.h"
|
#include "parser/scanner.h"
|
||||||
#include "parser/scansup.h"
|
#include "parser/scansup.h"
|
||||||
#include "pgstat.h"
|
#include "pgstat.h"
|
||||||
#include "storage/fd.h"
|
|
||||||
#include "storage/ipc.h"
|
#include "storage/ipc.h"
|
||||||
#include "storage/spin.h"
|
#include "storage/spin.h"
|
||||||
#include "tcop/utility.h"
|
#include "tcop/utility.h"
|
||||||
@@ -57,54 +54,33 @@
|
|||||||
#include "utils/lsyscache.h"
|
#include "utils/lsyscache.h"
|
||||||
#include "utils/guc.h"
|
#include "utils/guc.h"
|
||||||
#include "utils/guc_tables.h"
|
#include "utils/guc_tables.h"
|
||||||
#include "utils/memutils.h"
|
|
||||||
#include "utils/palloc.h"
|
#include "utils/palloc.h"
|
||||||
|
|
||||||
|
|
||||||
#define MAX_BACKEND_PROCESES (MaxBackends + NUM_AUXILIARY_PROCS + max_prepared_xacts)
|
|
||||||
|
|
||||||
/* XXX: Should USAGE_EXEC reflect execution time and/or buffer usage? */
|
/* XXX: Should USAGE_EXEC reflect execution time and/or buffer usage? */
|
||||||
#define USAGE_EXEC(duration) (1.0)
|
#define USAGE_EXEC(duration) (1.0)
|
||||||
#define USAGE_INIT (1.0) /* including initial planning */
|
#define USAGE_INIT (1.0) /* including initial planning */
|
||||||
#define ASSUMED_LENGTH_INIT 1024 /* initial assumed mean query length */
|
|
||||||
#define USAGE_DECREASE_FACTOR (0.99) /* decreased every entry_dealloc */
|
|
||||||
#define STICKY_DECREASE_FACTOR (0.50) /* factor for sticky entries */
|
|
||||||
#define USAGE_DEALLOC_PERCENT 5 /* free this % of entries at once */
|
|
||||||
|
|
||||||
#define JUMBLE_SIZE 1024 /* query serialization buffer size */
|
#define JUMBLE_SIZE 1024 /* query serialization buffer size */
|
||||||
|
|
||||||
#define HISTOGRAM_MAX_TIME 50000000
|
#define HISTOGRAM_MAX_TIME 50000000
|
||||||
#define MAX_RESPONSE_BUCKET 50
|
#define MAX_RESPONSE_BUCKET 50
|
||||||
#define INVALID_BUCKET_ID -1
|
#define INVALID_BUCKET_ID -1
|
||||||
#define TEXT_LEN 255
|
|
||||||
#define ERROR_MESSAGE_LEN 100
|
#define ERROR_MESSAGE_LEN 100
|
||||||
#define REL_TYPENAME_LEN 64
|
#define REL_TYPENAME_LEN 64
|
||||||
#define REL_LST 10
|
#define REL_LST 10
|
||||||
#define REL_LEN 132 /* REL_TYPENAME_LEN * 2 (relname + schema) + 1
|
#define REL_LEN 132 /* REL_TYPENAME_LEN * 2 (relname + schema) + 1
|
||||||
* (for view indication) + 1 and dot and
|
* (for view indication) + 1 and dot and
|
||||||
* string terminator */
|
* string terminator */
|
||||||
#define CMD_LST 10
|
|
||||||
#define CMD_LEN 20
|
|
||||||
#define APPLICATIONNAME_LEN NAMEDATALEN
|
#define APPLICATIONNAME_LEN NAMEDATALEN
|
||||||
#define COMMENTS_LEN 256
|
#define COMMENTS_LEN 256
|
||||||
#define PGSM_OVER_FLOW_MAX 10
|
|
||||||
#define PLAN_TEXT_LEN 1024
|
#define PLAN_TEXT_LEN 1024
|
||||||
/* the assumption of query max nested level */
|
|
||||||
#define DEFAULT_MAX_NESTED_LEVEL 10
|
|
||||||
|
|
||||||
#define MAX_QUERY_BUF ((int64)pgsm_query_shared_buffer * 1024 * 1024)
|
#define MAX_QUERY_BUF ((int64)pgsm_query_shared_buffer * 1024 * 1024)
|
||||||
#define MAX_BUCKETS_MEM ((int64)pgsm_max * 1024 * 1024)
|
#define MAX_BUCKETS_MEM ((int64)pgsm_max * 1024 * 1024)
|
||||||
#define BUCKETS_MEM_OVERFLOW() ((hash_get_num_entries(pgsm_hash) * sizeof(pgsmEntry)) >= MAX_BUCKETS_MEM)
|
|
||||||
#define MAX_BUCKET_ENTRIES (MAX_BUCKETS_MEM / sizeof(pgsmEntry))
|
#define MAX_BUCKET_ENTRIES (MAX_BUCKETS_MEM / sizeof(pgsmEntry))
|
||||||
#define QUERY_BUFFER_OVERFLOW(x,y) ((x + y + sizeof(uint64) + sizeof(uint64)) > MAX_QUERY_BUF)
|
|
||||||
#define QUERY_MARGIN 100
|
|
||||||
#define MIN_QUERY_LEN 10
|
|
||||||
#define SQLCODE_LEN 20
|
#define SQLCODE_LEN 20
|
||||||
#define TOTAL_RELS_LENGTH (REL_LST * REL_LEN)
|
#define TOTAL_RELS_LENGTH (REL_LST * REL_LEN)
|
||||||
#define MAX_SETTINGS 15
|
|
||||||
|
|
||||||
/* Update this if need a enum GUC with more options. */
|
|
||||||
#define MAX_ENUM_OPTIONS 6
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* pg_stat_monitor uses the hash structure to store all query statistics
|
* pg_stat_monitor uses the hash structure to store all query statistics
|
||||||
@@ -153,23 +129,6 @@ typedef enum pgsmStoreKind
|
|||||||
PGSM_ERROR,
|
PGSM_ERROR,
|
||||||
} pgsmStoreKind;
|
} pgsmStoreKind;
|
||||||
|
|
||||||
#define PGSM_NUMKIND (PGSM_ERROR + 1)
|
|
||||||
|
|
||||||
/* the assumption of query max nested level */
|
|
||||||
#define DEFAULT_MAX_NESTED_LEVEL 10
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Type of aggregate keys
|
|
||||||
*/
|
|
||||||
typedef enum AGG_KEY
|
|
||||||
{
|
|
||||||
AGG_KEY_DATABASE = 0,
|
|
||||||
AGG_KEY_USER,
|
|
||||||
AGG_KEY_HOST
|
|
||||||
} AGG_KEY;
|
|
||||||
|
|
||||||
#define MAX_QUERY_LEN 1024
|
|
||||||
|
|
||||||
/* shared memory storage for the query */
|
/* shared memory storage for the query */
|
||||||
typedef struct CallTime
|
typedef struct CallTime
|
||||||
{
|
{
|
||||||
@@ -439,10 +398,7 @@ bool IsHashInitialize(void);
|
|||||||
bool IsSystemOOM(void);
|
bool IsSystemOOM(void);
|
||||||
void pgsm_shmem_startup(void);
|
void pgsm_shmem_startup(void);
|
||||||
void pgsm_shmem_shutdown(int code, Datum arg);
|
void pgsm_shmem_shutdown(int code, Datum arg);
|
||||||
int pgsm_get_bucket_size(void);
|
|
||||||
pgsmSharedState *pgsm_get_ss(void);
|
pgsmSharedState *pgsm_get_ss(void);
|
||||||
void hash_query_entries();
|
|
||||||
void hash_query_entry_dealloc(int new_bucket_id, int old_bucket_id, unsigned char *query_buffer[]);
|
|
||||||
void hash_entry_dealloc(int new_bucket_id, int old_bucket_id, unsigned char *query_buffer);
|
void hash_entry_dealloc(int new_bucket_id, int old_bucket_id, unsigned char *query_buffer);
|
||||||
pgsmEntry *hash_entry_alloc(pgsmSharedState *pgsm, pgsmHashKey *key, int encoding);
|
pgsmEntry *hash_entry_alloc(pgsmSharedState *pgsm, pgsmHashKey *key, int encoding);
|
||||||
Size pgsm_ShmemSize(void);
|
Size pgsm_ShmemSize(void);
|
||||||
|
|||||||
Reference in New Issue
Block a user