This is an automated email from the ASF dual-hosted git repository. chenjinbao1989 pushed a commit to branch cbdb-postgres-merge in repository https://gitbox.apache.org/repos/asf/cloudberry.git
The following commit(s) were added to refs/heads/cbdb-postgres-merge by this push: new 45e5d6e0150 Fix conflict for some files on include 45e5d6e0150 is described below commit 45e5d6e015094dde1d22496fc493027aafd0265b Author: Jinbao Chen <chenjinbao1...@gmail.com> AuthorDate: Fri Sep 12 10:40:25 2025 +0800 Fix conflict for some files on include --- src/backend/Makefile | 4 +- src/include/Makefile | 11 +- src/include/c.h | 7 - src/include/fmgr.h | 13 +- src/include/pgstat.h | 1009 -------------------------------------------------- 5 files changed, 6 insertions(+), 1038 deletions(-) diff --git a/src/backend/Makefile b/src/backend/Makefile index 50fa0853fc7..601b2ef4710 100644 --- a/src/backend/Makefile +++ b/src/backend/Makefile @@ -164,8 +164,8 @@ storage/lmgr/lwlocknames.h: storage/lmgr/generate-lwlocknames.pl storage/lmgr/lw $(MAKE) -C storage/lmgr lwlocknames.h lwlocknames.c # run this unconditionally to avoid needing to know its dependencies here: -#submake-catalog-headers: -# $(MAKE) -C catalog distprep generated-header-symlinks +submake-catalog-headers: + $(MAKE) -C catalog distprep generated-header-symlinks # run this unconditionally to avoid needing to know its dependencies here: #submake-nodes-headers: diff --git a/src/include/Makefile b/src/include/Makefile index 8e184b80652..f6639834c59 100644 --- a/src/include/Makefile +++ b/src/include/Makefile @@ -55,13 +55,8 @@ install: all installdirs $(INSTALL_DATA) $(srcdir)/$$dir/*.h '$(DESTDIR)$(includedir_server)'/$$dir || exit; \ done ifeq ($(vpath_build),yes) -<<<<<<< HEAD - for file in catalog/schemapg.h catalog/system_fk_info.h catalog/pg_*_d.h catalog/gp_*_d.h parser/gram.h storage/lwlocknames.h utils/probes.h; do \ - cp $$file '$(DESTDIR)$(includedir_server)'/$$file || exit; \ -======= - for file in catalog/schemapg.h catalog/system_fk_info.h catalog/pg_*_d.h storage/lwlocknames.h utils/probes.h; do \ + for file in catalog/schemapg.h catalog/system_fk_info.h catalog/pg_*_d.h catalog/gp_*_d.h storage/lwlocknames.h utils/probes.h; do \ $(INSTALL_DATA) $$file '$(DESTDIR)$(includedir_server)'/$$file || exit; \ ->>>>>>> REL_16_9 done endif @@ -83,12 +78,8 @@ clean: rm -f utils/fmgroids.h utils/fmgrprotos.h utils/errcodes.h utils/header-stamp rm -f storage/lwlocknames.h utils/probes.h rm -f catalog/schemapg.h catalog/system_fk_info.h -<<<<<<< HEAD rm -f catalog/pg_*_d.h catalog/gp_*_d.h catalog/header-stamp -======= - rm -f catalog/pg_*_d.h catalog/header-stamp rm -f nodes/nodetags.h nodes/header-stamp ->>>>>>> REL_16_9 distclean maintainer-clean: clean rm -f pg_config.h pg_config_ext.h pg_config_os.h stamp-h stamp-ext-h diff --git a/src/include/c.h b/src/include/c.h index 91679f4187c..ba094e287e9 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -9,13 +9,9 @@ * polluting the namespace with lots of stuff... * * -<<<<<<< HEAD * Portions Copyright (c) 2006-2011, Greenplum inc * Portions Copyright (c) 2012-Present VMware, Inc. or its affiliates. - * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group -======= * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group ->>>>>>> REL_16_9 * Portions Copyright (c) 1994, Regents of the University of California * * src/include/c.h @@ -891,7 +887,6 @@ typedef NameData *Name; #define Assert(condition) ((void)true) #define AssertMacro(condition) ((void)true) -<<<<<<< HEAD #define AssertArg(condition) ((void)true) #define AssertState(condition) ((void)true) #define AssertPointerAlignment(ptr, bndr) ((void)true) @@ -899,8 +894,6 @@ typedef NameData *Name; #define AssertEquivalent(cond1, cond2) ((void)true) #define Trap(condition, errorType) ((void)true) #define TrapMacro(condition, errorType) (true) -======= ->>>>>>> REL_16_9 #elif defined(FRONTEND) diff --git a/src/include/fmgr.h b/src/include/fmgr.h index 301bf5ae2a2..85bb6281193 100644 --- a/src/include/fmgr.h +++ b/src/include/fmgr.h @@ -474,11 +474,8 @@ typedef struct int indexmaxkeys; /* INDEX_MAX_KEYS */ int namedatalen; /* NAMEDATALEN */ int float8byval; /* FLOAT8PASSBYVAL */ -<<<<<<< HEAD - int product; /* magic product code */ -======= char abi_extra[32]; /* see pg_config_manual.h */ ->>>>>>> REL_16_9 + int product; /* magic product code */ } Pg_magic_struct; /* @@ -503,8 +500,8 @@ typedef enum { FUNC_MAX_ARGS, \ INDEX_MAX_KEYS, \ NAMEDATALEN, \ - FLOAT8PASSBYVAL, \ -<<<<<<< HEAD + FLOAT8PASSBYVAL, \ + FMGR_ABI_EXTRA, \ PgMagicProductCloudberry \ } @@ -514,14 +511,10 @@ typedef enum { #ifndef FLOAT8PASSBYVAL #define FLOAT8PASSBYVAL 1 #endif -======= - FMGR_ABI_EXTRA, \ -} StaticAssertDecl(sizeof(FMGR_ABI_EXTRA) <= sizeof(((Pg_magic_struct *) 0)->abi_extra), "FMGR_ABI_EXTRA too long"); ->>>>>>> REL_16_9 /* * Declare the module magic function. It needs to be a function as the dlsym * in the backend is only guaranteed to work on functions, not data diff --git a/src/include/pgstat.h b/src/include/pgstat.h index cad186d1335..338f5ae9562 100644 --- a/src/include/pgstat.h +++ b/src/include/pgstat.h @@ -85,44 +85,6 @@ typedef enum SessionEndType } SessionEndType; /* ---------- -<<<<<<< HEAD - * The types of backend -> collector messages - * ---------- - */ -typedef enum StatMsgType -{ - PGSTAT_MTYPE_DUMMY, - PGSTAT_MTYPE_INQUIRY, - PGSTAT_MTYPE_TABSTAT, - PGSTAT_MTYPE_TABPURGE, - PGSTAT_MTYPE_DROPDB, - PGSTAT_MTYPE_RESETCOUNTER, - PGSTAT_MTYPE_RESETSHAREDCOUNTER, - PGSTAT_MTYPE_RESETSINGLECOUNTER, - PGSTAT_MTYPE_RESETSLRUCOUNTER, - PGSTAT_MTYPE_RESETREPLSLOTCOUNTER, - PGSTAT_MTYPE_AUTOVAC_START, - PGSTAT_MTYPE_VACUUM, - PGSTAT_MTYPE_ANALYZE, - PGSTAT_MTYPE_ARCHIVER, - PGSTAT_MTYPE_QUEUESTAT, /* GPDB */ - PGSTAT_MTYPE_BGWRITER, - PGSTAT_MTYPE_WAL, - PGSTAT_MTYPE_SLRU, - PGSTAT_MTYPE_FUNCSTAT, - PGSTAT_MTYPE_FUNCPURGE, - PGSTAT_MTYPE_RECOVERYCONFLICT, - PGSTAT_MTYPE_TEMPFILE, - PGSTAT_MTYPE_DEADLOCK, - PGSTAT_MTYPE_CHECKSUMFAILURE, - PGSTAT_MTYPE_REPLSLOT, - PGSTAT_MTYPE_CONNECT, - PGSTAT_MTYPE_DISCONNECT, -} StatMsgType; - -/* ---------- -======= ->>>>>>> REL_16_9 * The data type used for counters. * ---------- */ @@ -191,13 +153,8 @@ typedef struct PgStat_BackendSubEntry * the index AM, while tuples_fetched is the number of tuples successfully * fetched by heap_fetch under the control of simple indexscans for this index. * -<<<<<<< HEAD - * tuples_inserted/updated/deleted/hot_updated count attempted actions, - * regardless of whether the transaction committed. delta_live_tuples, -======= * tuples_inserted/updated/deleted/hot_updated/newpage_updated count attempted * actions, regardless of whether the transaction committed. delta_live_tuples, ->>>>>>> REL_16_9 * delta_dead_tuples, and changed_tuples are set depending on commit or abort. * Note that delta_live_tuples and delta_dead_tuples can be negative! * ---------- @@ -273,532 +230,7 @@ typedef struct PgStat_TableXactStatus /* ------------------------------------------------------------ -<<<<<<< HEAD - * Message formats follow - * ------------------------------------------------------------ - */ - - -/* ---------- - * PgStat_MsgHdr The common message header - * ---------- - */ -typedef struct PgStat_MsgHdr -{ - StatMsgType m_type; - int m_size; -} PgStat_MsgHdr; - -/* ---------- - * Space available in a message. This will keep the UDP packets below 1K, - * which should fit unfragmented into the MTU of the loopback interface. - * (Larger values of PGSTAT_MAX_MSG_SIZE would work for that on most - * platforms, but we're being conservative here.) - * ---------- - */ -#define PGSTAT_MAX_MSG_SIZE 1000 -#define PGSTAT_MSG_PAYLOAD (PGSTAT_MAX_MSG_SIZE - sizeof(PgStat_MsgHdr)) - - -/* ---------- - * PgStat_MsgDummy A dummy message, ignored by the collector - * ---------- - */ -typedef struct PgStat_MsgDummy -{ - PgStat_MsgHdr m_hdr; -} PgStat_MsgDummy; - - -/* ---------- - * PgStat_MsgInquiry Sent by a backend to ask the collector - * to write the stats file(s). - * - * Ordinarily, an inquiry message prompts writing of the global stats file, - * the stats file for shared catalogs, and the stats file for the specified - * database. If databaseid is InvalidOid, only the first two are written. - * - * New file(s) will be written only if the existing file has a timestamp - * older than the specified cutoff_time; this prevents duplicated effort - * when multiple requests arrive at nearly the same time, assuming that - * backends send requests with cutoff_times a little bit in the past. - * - * clock_time should be the requestor's current local time; the collector - * uses this to check for the system clock going backward, but it has no - * effect unless that occurs. We assume clock_time >= cutoff_time, though. - * ---------- - */ - -typedef struct PgStat_MsgInquiry -{ - PgStat_MsgHdr m_hdr; - TimestampTz clock_time; /* observed local clock time */ - TimestampTz cutoff_time; /* minimum acceptable file timestamp */ - Oid databaseid; /* requested DB (InvalidOid => shared only) */ -} PgStat_MsgInquiry; - - -/* ---------- - * PgStat_TableEntry Per-table info in a MsgTabstat - * ---------- - */ -typedef struct PgStat_TableEntry -{ - Oid t_id; - PgStat_TableCounts t_counts; -} PgStat_TableEntry; - -/* ---------- - * PgStat_MsgTabstat Sent by the backend to report table - * and buffer access statistics. - * ---------- - */ -#define PGSTAT_NUM_TABENTRIES \ - ((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - 3 * sizeof(int) - 5 * sizeof(PgStat_Counter)) \ - / sizeof(PgStat_TableEntry)) - -typedef struct PgStat_MsgTabstat -{ - PgStat_MsgHdr m_hdr; - Oid m_databaseid; - int m_nentries; - int m_xact_commit; - int m_xact_rollback; - PgStat_Counter m_block_read_time; /* times in microseconds */ - PgStat_Counter m_block_write_time; - PgStat_Counter m_session_time; - PgStat_Counter m_active_time; - PgStat_Counter m_idle_in_xact_time; - PgStat_TableEntry m_entry[PGSTAT_NUM_TABENTRIES]; -} PgStat_MsgTabstat; - - -/* ---------- - * PgStat_MsgTabpurge Sent by the backend to tell the collector - * about dead tables. - * ---------- - */ -#define PGSTAT_NUM_TABPURGE \ - ((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - sizeof(int)) \ - / sizeof(Oid)) - -typedef struct PgStat_MsgTabpurge -{ - PgStat_MsgHdr m_hdr; - Oid m_databaseid; - int m_nentries; - Oid m_tableid[PGSTAT_NUM_TABPURGE]; -} PgStat_MsgTabpurge; - - -/* ---------- - * PgStat_MsgDropdb Sent by the backend to tell the collector - * about a dropped database - * ---------- - */ -typedef struct PgStat_MsgDropdb -{ - PgStat_MsgHdr m_hdr; - Oid m_databaseid; -} PgStat_MsgDropdb; - - -/* ---------- - * PgStat_MsgResetcounter Sent by the backend to tell the collector - * to reset counters - * ---------- - */ -typedef struct PgStat_MsgResetcounter -{ - PgStat_MsgHdr m_hdr; - Oid m_databaseid; -} PgStat_MsgResetcounter; - -/* ---------- - * PgStat_MsgResetsharedcounter Sent by the backend to tell the collector - * to reset a shared counter - * ---------- - */ -typedef struct PgStat_MsgResetsharedcounter -{ - PgStat_MsgHdr m_hdr; - PgStat_Shared_Reset_Target m_resettarget; -} PgStat_MsgResetsharedcounter; - -/* ---------- - * PgStat_MsgResetsinglecounter Sent by the backend to tell the collector - * to reset a single counter - * ---------- - */ -typedef struct PgStat_MsgResetsinglecounter -{ - PgStat_MsgHdr m_hdr; - Oid m_databaseid; - PgStat_Single_Reset_Type m_resettype; - Oid m_objectid; -} PgStat_MsgResetsinglecounter; - -/* ---------- - * PgStat_MsgResetslrucounter Sent by the backend to tell the collector - * to reset a SLRU counter - * ---------- - */ -typedef struct PgStat_MsgResetslrucounter -{ - PgStat_MsgHdr m_hdr; - int m_index; -} PgStat_MsgResetslrucounter; - -/* ---------- - * PgStat_MsgResetreplslotcounter Sent by the backend to tell the collector - * to reset replication slot counter(s) - * ---------- - */ -typedef struct PgStat_MsgResetreplslotcounter -{ - PgStat_MsgHdr m_hdr; - NameData m_slotname; - bool clearall; -} PgStat_MsgResetreplslotcounter; - -/* ---------- - * PgStat_MsgAutovacStart Sent by the autovacuum daemon to signal - * that a database is going to be processed - * ---------- - */ -typedef struct PgStat_MsgAutovacStart -{ - PgStat_MsgHdr m_hdr; - Oid m_databaseid; - TimestampTz m_start_time; -} PgStat_MsgAutovacStart; - - -/* ---------- - * PgStat_MsgVacuum Sent by the backend or autovacuum daemon - * after VACUUM - * ---------- - */ -typedef struct PgStat_MsgVacuum -{ - PgStat_MsgHdr m_hdr; - Oid m_databaseid; - Oid m_tableoid; - bool m_autovacuum; - TimestampTz m_vacuumtime; - PgStat_Counter m_live_tuples; - PgStat_Counter m_dead_tuples; -} PgStat_MsgVacuum; - - -/* ---------- - * PgStat_MsgAnalyze Sent by the backend or autovacuum daemon - * after ANALYZE - * ---------- - */ -typedef struct PgStat_MsgAnalyze -{ - PgStat_MsgHdr m_hdr; - Oid m_databaseid; - Oid m_tableoid; - bool m_autovacuum; - bool m_resetcounter; - TimestampTz m_analyzetime; - PgStat_Counter m_live_tuples; - PgStat_Counter m_dead_tuples; -} PgStat_MsgAnalyze; - - -/* ---------- - * PgStat_MsgArchiver Sent by the archiver to update statistics. - * ---------- - */ -typedef struct PgStat_MsgArchiver -{ - PgStat_MsgHdr m_hdr; - bool m_failed; /* Failed attempt */ - char m_xlog[MAX_XFN_CHARS + 1]; - TimestampTz m_timestamp; -} PgStat_MsgArchiver; - -/* ---------- - * PgStat_MsgQueuestat Sent by the backend to report resource queue - * activity statistics. - * ---------- GPDB - */ -typedef struct PgStat_MsgQueuestat -{ - PgStat_MsgHdr m_hdr; - Oid m_queueid; - PgStat_Counter m_queries_exec; - PgStat_Counter m_queries_wait; - PgStat_Counter m_elapsed_exec; - PgStat_Counter m_elapsed_wait; -} PgStat_MsgQueuestat; - -/* ---------- - * PgStat_MsgBgWriter Sent by the bgwriter to update statistics. - * ---------- - */ -typedef struct PgStat_MsgBgWriter -{ - PgStat_MsgHdr m_hdr; - - PgStat_Counter m_timed_checkpoints; - PgStat_Counter m_requested_checkpoints; - PgStat_Counter m_buf_written_checkpoints; - PgStat_Counter m_buf_written_clean; - PgStat_Counter m_maxwritten_clean; - PgStat_Counter m_buf_written_backend; - PgStat_Counter m_buf_fsync_backend; - PgStat_Counter m_buf_alloc; - PgStat_Counter m_checkpoint_write_time; /* times in milliseconds */ - PgStat_Counter m_checkpoint_sync_time; -} PgStat_MsgBgWriter; - -/* ---------- - * PgStat_MsgWal Sent by backends and background processes to update WAL statistics. - * ---------- - */ -typedef struct PgStat_MsgWal -{ - PgStat_MsgHdr m_hdr; - PgStat_Counter m_wal_records; - PgStat_Counter m_wal_fpi; - uint64 m_wal_bytes; - PgStat_Counter m_wal_buffers_full; - PgStat_Counter m_wal_write; - PgStat_Counter m_wal_sync; - PgStat_Counter m_wal_write_time; /* time spent writing wal records in - * microseconds */ - PgStat_Counter m_wal_sync_time; /* time spent syncing wal records in - * microseconds */ -} PgStat_MsgWal; - -/* ---------- - * PgStat_MsgSLRU Sent by a backend to update SLRU statistics. - * ---------- - */ -typedef struct PgStat_MsgSLRU -{ - PgStat_MsgHdr m_hdr; - PgStat_Counter m_index; - PgStat_Counter m_blocks_zeroed; - PgStat_Counter m_blocks_hit; - PgStat_Counter m_blocks_read; - PgStat_Counter m_blocks_written; - PgStat_Counter m_blocks_exists; - PgStat_Counter m_flush; - PgStat_Counter m_truncate; -} PgStat_MsgSLRU; - -/* ---------- - * PgStat_MsgReplSlot Sent by a backend or a wal sender to update replication - * slot statistics. - * ---------- - */ -typedef struct PgStat_MsgReplSlot -{ - PgStat_MsgHdr m_hdr; - NameData m_slotname; - bool m_create; - bool m_drop; - PgStat_Counter m_spill_txns; - PgStat_Counter m_spill_count; - PgStat_Counter m_spill_bytes; - PgStat_Counter m_stream_txns; - PgStat_Counter m_stream_count; - PgStat_Counter m_stream_bytes; - PgStat_Counter m_total_txns; - PgStat_Counter m_total_bytes; -} PgStat_MsgReplSlot; - - -/* ---------- - * PgStat_MsgRecoveryConflict Sent by the backend upon recovery conflict - * ---------- - */ -typedef struct PgStat_MsgRecoveryConflict -{ - PgStat_MsgHdr m_hdr; - - Oid m_databaseid; - int m_reason; -} PgStat_MsgRecoveryConflict; - -/* ---------- - * PgStat_MsgTempFile Sent by the backend upon creating a temp file - * ---------- - */ -typedef struct PgStat_MsgTempFile -{ - PgStat_MsgHdr m_hdr; - - Oid m_databaseid; - size_t m_filesize; -} PgStat_MsgTempFile; - -/* ---------- - * PgStat_FunctionCounts The actual per-function counts kept by a backend - * - * This struct should contain only actual event counters, because we memcmp - * it against zeroes to detect whether there are any counts to transmit. - * - * Note that the time counters are in instr_time format here. We convert to - * microseconds in PgStat_Counter format when transmitting to the collector. - * ---------- - */ -typedef struct PgStat_FunctionCounts -{ - PgStat_Counter f_numcalls; - instr_time f_total_time; - instr_time f_self_time; -} PgStat_FunctionCounts; - -/* ---------- - * PgStat_BackendFunctionEntry Entry in backend's per-function hash table - * ---------- - */ -typedef struct PgStat_BackendFunctionEntry -{ - Oid f_id; - PgStat_FunctionCounts f_counts; -} PgStat_BackendFunctionEntry; - -/* ---------- - * PgStat_FunctionEntry Per-function info in a MsgFuncstat - * ---------- - */ -typedef struct PgStat_FunctionEntry -{ - Oid f_id; - PgStat_Counter f_numcalls; - PgStat_Counter f_total_time; /* times in microseconds */ - PgStat_Counter f_self_time; -} PgStat_FunctionEntry; - -/* ---------- - * PgStat_MsgFuncstat Sent by the backend to report function - * usage statistics. - * ---------- - */ -#define PGSTAT_NUM_FUNCENTRIES \ - ((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - sizeof(int)) \ - / sizeof(PgStat_FunctionEntry)) - -typedef struct PgStat_MsgFuncstat -{ - PgStat_MsgHdr m_hdr; - Oid m_databaseid; - int m_nentries; - PgStat_FunctionEntry m_entry[PGSTAT_NUM_FUNCENTRIES]; -} PgStat_MsgFuncstat; - -/* ---------- - * PgStat_MsgFuncpurge Sent by the backend to tell the collector - * about dead functions. - * ---------- - */ -#define PGSTAT_NUM_FUNCPURGE \ - ((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - sizeof(int)) \ - / sizeof(Oid)) - -typedef struct PgStat_MsgFuncpurge -{ - PgStat_MsgHdr m_hdr; - Oid m_databaseid; - int m_nentries; - Oid m_functionid[PGSTAT_NUM_FUNCPURGE]; -} PgStat_MsgFuncpurge; - -/* ---------- - * PgStat_MsgDeadlock Sent by the backend to tell the collector - * about a deadlock that occurred. - * ---------- - */ -typedef struct PgStat_MsgDeadlock -{ - PgStat_MsgHdr m_hdr; - Oid m_databaseid; -} PgStat_MsgDeadlock; - -/* ---------- - * PgStat_MsgChecksumFailure Sent by the backend to tell the collector - * about checksum failures noticed. - * ---------- - */ -typedef struct PgStat_MsgChecksumFailure -{ - PgStat_MsgHdr m_hdr; - Oid m_databaseid; - int m_failurecount; - TimestampTz m_failure_time; -} PgStat_MsgChecksumFailure; - -/* ---------- - * PgStat_MsgConnect Sent by the backend upon connection - * establishment - * ---------- - */ -typedef struct PgStat_MsgConnect -{ - PgStat_MsgHdr m_hdr; - Oid m_databaseid; -} PgStat_MsgConnect; - -/* ---------- - * PgStat_MsgDisconnect Sent by the backend when disconnecting - * ---------- - */ -typedef struct PgStat_MsgDisconnect -{ - PgStat_MsgHdr m_hdr; - Oid m_databaseid; - SessionEndType m_cause; -} PgStat_MsgDisconnect; - -/* ---------- - * PgStat_Msg Union over all possible messages. - * ---------- - */ -typedef union PgStat_Msg -{ - PgStat_MsgHdr msg_hdr; - PgStat_MsgDummy msg_dummy; - PgStat_MsgInquiry msg_inquiry; - PgStat_MsgTabstat msg_tabstat; - PgStat_MsgTabpurge msg_tabpurge; - PgStat_MsgDropdb msg_dropdb; - PgStat_MsgResetcounter msg_resetcounter; - PgStat_MsgResetsharedcounter msg_resetsharedcounter; - PgStat_MsgResetsinglecounter msg_resetsinglecounter; - PgStat_MsgResetslrucounter msg_resetslrucounter; - PgStat_MsgResetreplslotcounter msg_resetreplslotcounter; - PgStat_MsgAutovacStart msg_autovacuum_start; - PgStat_MsgVacuum msg_vacuum; - PgStat_MsgAnalyze msg_analyze; - PgStat_MsgArchiver msg_archiver; - PgStat_MsgQueuestat msg_queuestat; /* GPDB */ - PgStat_MsgBgWriter msg_bgwriter; - PgStat_MsgWal msg_wal; - PgStat_MsgSLRU msg_slru; - PgStat_MsgFuncstat msg_funcstat; - PgStat_MsgFuncpurge msg_funcpurge; - PgStat_MsgRecoveryConflict msg_recoveryconflict; - PgStat_MsgDeadlock msg_deadlock; - PgStat_MsgTempFile msg_tempfile; - PgStat_MsgChecksumFailure msg_checksumfailure; - PgStat_MsgReplSlot msg_replslot; - PgStat_MsgConnect msg_connect; - PgStat_MsgDisconnect msg_disconnect; -} PgStat_Msg; - - -/* ------------------------------------------------------------ - * Statistic collector data structures follow -======= * Data structures on disk and in shared memory follow ->>>>>>> REL_16_9 * * PGSTAT_FILE_FORMAT_ID should be changed whenever any of these * data structures change. @@ -807,156 +239,6 @@ typedef union PgStat_Msg #define PGSTAT_FILE_FORMAT_ID 0x01A5BCAC -<<<<<<< HEAD -/* ---------- - * PgStat_StatDBEntry The collector's data per database - * ---------- - */ -typedef struct PgStat_StatDBEntry -{ - Oid databaseid; - PgStat_Counter n_xact_commit; - PgStat_Counter n_xact_rollback; - PgStat_Counter n_blocks_fetched; - PgStat_Counter n_blocks_hit; - PgStat_Counter n_tuples_returned; - PgStat_Counter n_tuples_fetched; - PgStat_Counter n_tuples_inserted; - PgStat_Counter n_tuples_updated; - PgStat_Counter n_tuples_deleted; - TimestampTz last_autovac_time; - PgStat_Counter n_conflict_tablespace; - PgStat_Counter n_conflict_lock; - PgStat_Counter n_conflict_snapshot; - PgStat_Counter n_conflict_bufferpin; - PgStat_Counter n_conflict_startup_deadlock; - PgStat_Counter n_temp_files; - PgStat_Counter n_temp_bytes; - PgStat_Counter n_deadlocks; - PgStat_Counter n_checksum_failures; - TimestampTz last_checksum_failure; - PgStat_Counter n_block_read_time; /* times in microseconds */ - PgStat_Counter n_block_write_time; - PgStat_Counter n_sessions; - PgStat_Counter total_session_time; - PgStat_Counter total_active_time; - PgStat_Counter total_idle_in_xact_time; - PgStat_Counter n_sessions_abandoned; - PgStat_Counter n_sessions_fatal; - PgStat_Counter n_sessions_killed; - - TimestampTz stat_reset_timestamp; - TimestampTz stats_timestamp; /* time of db stats file update */ - - /* - * tables and functions must be last in the struct, because we don't write - * the pointers out to the stats file. - */ - HTAB *tables; - HTAB *functions; -} PgStat_StatDBEntry; - - -/* ---------- - * PgStat_StatTabEntry The collector's data per table (or index) - * ---------- - */ -typedef struct PgStat_StatTabEntry -{ - Oid tableid; - - PgStat_Counter numscans; - - PgStat_Counter tuples_returned; - PgStat_Counter tuples_fetched; - - PgStat_Counter tuples_inserted; - PgStat_Counter tuples_updated; - PgStat_Counter tuples_deleted; - PgStat_Counter tuples_hot_updated; - - PgStat_Counter n_live_tuples; - PgStat_Counter n_dead_tuples; - PgStat_Counter changes_since_analyze; - PgStat_Counter unused_counter; /* kept for ABI compatibility */ - PgStat_Counter inserts_since_vacuum; - - PgStat_Counter blocks_fetched; - PgStat_Counter blocks_hit; - - TimestampTz vacuum_timestamp; /* user initiated vacuum */ - PgStat_Counter vacuum_count; - TimestampTz autovac_vacuum_timestamp; /* autovacuum initiated */ - PgStat_Counter autovac_vacuum_count; - TimestampTz analyze_timestamp; /* user initiated */ - PgStat_Counter analyze_count; - TimestampTz autovac_analyze_timestamp; /* autovacuum initiated */ - PgStat_Counter autovac_analyze_count; -} PgStat_StatTabEntry; - - -/* ---------- - * PgStat_StatQueueEntry The collector's data per resource queue - * ---------- - * --- cdb extension --- - */ -typedef struct PgStat_StatQueueEntry -{ - Oid queueid; - PgStat_Counter n_queries_exec; - PgStat_Counter n_queries_wait; - PgStat_Counter elapsed_exec; - PgStat_Counter elapsed_wait; -} PgStat_StatQueueEntry; - -/* ---------- - * PgStat_StatFuncEntry The collector's data per function - * ---------- - */ -typedef struct PgStat_StatFuncEntry -{ - Oid functionid; - - PgStat_Counter f_numcalls; - - PgStat_Counter f_total_time; /* times in microseconds */ - PgStat_Counter f_self_time; -} PgStat_StatFuncEntry; - - - -/* ---------- - * PgStat_StatPortalEntry - * - * Each backend maintains a hash that contains a PgStat_StatPortalEntry for - * each portal. This is so we can easily track elapsed times for execute and - * wait, as well as counts for each of these. - * - * In order to (hopefully) not cause a performance degradation when queue - * statistics are enabled, we only store and caclulate elapsed time to the - * nearest second (via the time() call). This may mean that large numbers of - * sub-second queries get ignored due to roundoff. - * - * Note that the collector never sees these structs, the PgStat_StatQueueEntry - * is what is sent at report time. - * ---------- - */ -typedef struct PgStat_StatPortalEntry -{ - uint32 portalid; - time_t t_exec_start; - time_t t_exec_end; - time_t t_wait_start; - time_t t_wait_end; - PgStat_StatQueueEntry queueentry; -} PgStat_StatPortalEntry; - - -/* - * Archiver statistics kept in the stats collector - */ -======= ->>>>>>> REL_16_9 typedef struct PgStat_ArchiverStats { PgStat_Counter archived_count; /* archival successes */ @@ -1167,43 +449,12 @@ typedef struct PgStat_WalStats */ typedef struct PgStat_PendingWalStats { -<<<<<<< HEAD - PgStat_Counter blocks_zeroed; - PgStat_Counter blocks_hit; - PgStat_Counter blocks_read; - PgStat_Counter blocks_written; - PgStat_Counter blocks_exists; - PgStat_Counter flush; - PgStat_Counter truncate; - TimestampTz stat_reset_timestamp; -} PgStat_SLRUStats; - - - -/* - * Replication slot statistics kept in the stats collector - */ -typedef struct PgStat_StatReplSlotEntry -{ - NameData slotname; - PgStat_Counter spill_txns; - PgStat_Counter spill_count; - PgStat_Counter spill_bytes; - PgStat_Counter stream_txns; - PgStat_Counter stream_count; - PgStat_Counter stream_bytes; - PgStat_Counter total_txns; - PgStat_Counter total_bytes; - TimestampTz stat_reset_timestamp; -} PgStat_StatReplSlotEntry; -======= PgStat_Counter wal_buffers_full; PgStat_Counter wal_write; PgStat_Counter wal_sync; instr_time wal_write_time; instr_time wal_sync_time; } PgStat_PendingWalStats; ->>>>>>> REL_16_9 @@ -1221,86 +472,17 @@ extern void pgstat_restore_stats(void); extern void pgstat_discard_stats(void); extern void pgstat_before_server_shutdown(int code, Datum arg); -<<<<<<< HEAD -extern bool pgstat_collect_queuelevel; - - -/* - * BgWriter statistics counters are updated directly by bgwriter and bufmgr - */ -extern PgStat_MsgBgWriter BgWriterStats; -======= /* Functions for backend initialization */ extern void pgstat_initialize(void); ->>>>>>> REL_16_9 /* Functions called from backends */ extern long pgstat_report_stat(bool force); extern void pgstat_force_next_flush(void); -<<<<<<< HEAD -/* - * Updated by pgstat_count_buffer_*_time macros - */ -extern PgStat_Counter pgStatBlockReadTime; -extern PgStat_Counter pgStatBlockWriteTime; - -/* - * Updated by pgstat_count_conn_*_time macros, called by - * pgstat_report_activity(). - */ -extern PgStat_Counter pgStatActiveTime; -extern PgStat_Counter pgStatTransactionIdleTime; - - -/* - * Updated by the traffic cop and in errfinish() - */ -extern SessionEndType pgStatSessionEndCause; - -/* ---------- - * Functions called from postmaster - * ---------- - */ -extern void pgstat_init(void); -extern int pgstat_start(void); -extern void pgstat_reset_all(void); -extern void allow_immediate_pgstat_restart(void); - -#ifdef EXEC_BACKEND -extern void PgstatCollectorMain(int argc, char *argv[]) pg_attribute_noreturn(); -#endif - - -/* ---------- - * Functions called from backends - * ---------- - */ -extern void pgstat_ping(void); - -extern void pgstat_report_stat(bool force); -extern void pgstat_vacuum_stat(void); -extern void pgstat_report_queuestat(void); /* GPDB */ - -extern void pgstat_drop_database(Oid databaseid); - -extern void pgstat_clear_snapshot(void); -======= ->>>>>>> REL_16_9 extern void pgstat_reset_counters(void); extern void pgstat_reset(PgStat_Kind kind, Oid dboid, Oid objoid); extern void pgstat_reset_of_kind(PgStat_Kind kind); -<<<<<<< HEAD -extern void pgstat_report_connect(Oid dboid); -extern void pgstat_report_autovac(Oid dboid); -extern void pgstat_report_vacuum(Oid tableoid, bool shared, - PgStat_Counter livetuples, PgStat_Counter deadtuples); -extern void pgstat_report_analyze(Relation rel, - PgStat_Counter livetuples, PgStat_Counter deadtuples, - bool resetcounter); - -======= /* stats accessors */ extern void pgstat_clear_snapshot(void); extern TimestampTz pgstat_get_stat_snapshot_timestamp(bool *have_snapshot); @@ -1363,95 +545,12 @@ extern bool pgstat_tracks_io_op(BackendType bktype, IOObject io_object, extern void pgstat_drop_database(Oid databaseid); extern void pgstat_report_autovac(Oid dboid); ->>>>>>> REL_16_9 extern void pgstat_report_recovery_conflict(int reason); extern void pgstat_report_deadlock(void); extern void pgstat_report_checksum_failures_in_db(Oid dboid, int failurecount); extern void pgstat_report_checksum_failure(void); extern void pgstat_report_connect(Oid dboid); -<<<<<<< HEAD -extern void pgstat_initialize(void); - - -extern void pgstat_report_sessionid(int new_sessionid); - - - - -extern PgStat_TableStatus *find_tabstat_entry(Oid rel_id); -extern PgStat_BackendFunctionEntry *find_funcstat_entry(Oid func_id); - -extern void pgstat_report_resgroup(Oid groupid); - -extern void pgstat_initstats(Relation rel); - - -extern char *pgstat_clip_activity(const char *raw_activity); - -extern void pgstat_init_localportalhash(void); -extern PgStat_StatPortalEntry *pgstat_getportalentry(uint32 portalid, - Oid queueid); - - -/* nontransactional event counts are simple enough to inline */ - -#define pgstat_count_heap_scan(rel) \ - do { \ - if ((rel)->pgstat_info != NULL) \ - (rel)->pgstat_info->t_counts.t_numscans++; \ - } while (0) -#define pgstat_count_heap_getnext(rel) \ - do { \ - if ((rel)->pgstat_info != NULL) \ - (rel)->pgstat_info->t_counts.t_tuples_returned++; \ - } while (0) -#define pgstat_count_heap_fetch(rel) \ - do { \ - if ((rel)->pgstat_info != NULL) \ - (rel)->pgstat_info->t_counts.t_tuples_fetched++; \ - } while (0) - -/* -#define pgstat_count_heap_insert(s) \ - do { \ - if (pgstat_track_counts) \ - (s)->pgstat_info->t_counts.t_tuples_inserted++; \ - } while (0) -#define pgstat_count_heap_update(s,h) \ - do { \ - if (pgstat_track_counts) \ - (s)->pgstat_info->t_counts.t_tuples_updated++; \ - } while (0) -#define pgstat_count_heap_delete(s) \ - do { \ - if (pgstat_track_counts) \ - (s)->pgstat_info->t_counts.t_tuples_deleted++; \ - } while (0) - */ - -#define pgstat_count_index_scan(rel) \ - do { \ - if ((rel)->pgstat_info != NULL) \ - (rel)->pgstat_info->t_counts.t_numscans++; \ - } while (0) -#define pgstat_count_index_tuples(rel, n) \ - do { \ - if ((rel)->pgstat_info != NULL) \ - (rel)->pgstat_info->t_counts.t_tuples_returned += (n); \ - } while (0) -#define pgstat_count_buffer_read(rel) \ - do { \ - if ((rel)->pgstat_info != NULL) \ - (rel)->pgstat_info->t_counts.t_blocks_fetched++; \ - } while (0) -#define pgstat_count_buffer_hit(rel) \ - do { \ - if ((rel)->pgstat_info != NULL) \ - (rel)->pgstat_info->t_counts.t_blocks_hit++; \ - } while (0) -======= ->>>>>>> REL_16_9 #define pgstat_count_buffer_read_time(n) \ (pgStatBlockReadTime += (n)) #define pgstat_count_buffer_write_time(n) \ @@ -1461,79 +560,6 @@ extern PgStat_StatPortalEntry *pgstat_getportalentry(uint32 portalid, #define pgstat_count_conn_txn_idle_time(n) \ (pgStatTransactionIdleTime += (n)) -<<<<<<< HEAD -/* Resource queue statistics: */ -#define pgstat_count_queue_exec(p, q) \ - do { \ - if (pgstat_collect_queuelevel) \ - { \ - PgStat_StatPortalEntry *pentry; \ - \ - pentry = pgstat_getportalentry(p, q); \ - ((pentry)->queueentry).n_queries_exec++; \ - } \ - } while (0) -#define pgstat_record_start_queue_exec(p, q) \ - do { \ - if (pgstat_collect_queuelevel) \ - { \ - PgStat_StatPortalEntry *pentry; \ - \ - pentry = pgstat_getportalentry(p, q); \ - (pentry)->t_exec_start = time(NULL); \ - } \ - } while (0) -#define pgstat_record_end_queue_exec(p, q) \ - do { \ - if (pgstat_collect_queuelevel) \ - { \ - PgStat_StatPortalEntry *pentry; \ - \ - pentry = pgstat_getportalentry(p, q); \ - (pentry)->t_exec_end = time(NULL); \ - ((pentry)->queueentry).elapsed_exec += \ - (PgStat_Counter)((pentry)->t_exec_end - (pentry)->t_exec_start); \ - } \ - } while (0) -#define pgstat_count_queue_wait(p, q) \ - do { \ - if (pgstat_collect_queuelevel) \ - { \ - PgStat_StatPortalEntry *pentry; \ - \ - pentry = pgstat_getportalentry(p, q); \ - ((pentry)->queueentry).n_queries_wait++; \ - } \ - } while (0) -#define pgstat_record_start_queue_wait(p, q) \ - do { \ - if (pgstat_collect_queuelevel) \ - { \ - PgStat_StatPortalEntry *pentry; \ - \ - pentry = pgstat_getportalentry(p, q); \ - (pentry)->t_wait_start = time(NULL); \ - } \ - } while (0) -#define pgstat_record_end_queue_wait(p, q) \ - do { \ - if (pgstat_collect_queuelevel) \ - { \ - PgStat_StatPortalEntry *pentry; \ - \ - pentry = pgstat_getportalentry(p, q); \ - (pentry)->t_wait_end = time(NULL); \ - ((pentry)->queueentry).elapsed_wait += \ - (PgStat_Counter)((pentry)->t_wait_end - (pentry)->t_wait_start); \ - } \ - } while (0) - -extern void pgstat_count_heap_insert(Relation rel, PgStat_Counter n); -extern void pgstat_count_heap_update(Relation rel, bool hot); -extern void pgstat_count_heap_delete(Relation rel); -extern void pgstat_count_truncate(Relation rel); -extern void pgstat_update_heap_dead_tuples(Relation rel, int delta); -======= extern PgStat_StatDBEntry *pgstat_fetch_stat_dbentry(Oid dboid); @@ -1543,7 +569,6 @@ extern PgStat_StatDBEntry *pgstat_fetch_stat_dbentry(Oid dboid); extern void pgstat_create_function(Oid proid); extern void pgstat_drop_function(Oid proid); ->>>>>>> REL_16_9 struct FunctionCallInfoBaseData; extern void pgstat_init_function_usage(struct FunctionCallInfoBaseData *fcinfo, @@ -1631,39 +656,6 @@ extern void pgstat_twophase_postcommit(TransactionId xid, uint16 info, extern void pgstat_twophase_postabort(TransactionId xid, uint16 info, void *recdata, uint32 len); -<<<<<<< HEAD -extern void pgstat_send_archiver(const char *xlog, bool failed); -extern void pgstat_send_bgwriter(void); -extern void pgstat_send_wal(bool force); - -struct CdbDispatchResults; -struct pg_result; -extern void pgstat_send_qd_tabstats(void); /* GPDB */ -extern void pgstat_combine_one_qe_result(List **oidList, /* GPDB */ - struct pg_result *pgresult, - int nest_level, - int32 segindex); -extern void pgstat_combine_from_qe(struct CdbDispatchResults *results, /* GPDB */ - int writerSliceIndex); - -/* ---------- - * Support functions for the SQL-callable functions to - * generate the pgstat* views. - * ---------- - */ -extern PgStat_StatDBEntry *pgstat_fetch_stat_dbentry(Oid dbid); -extern PgStat_StatTabEntry *pgstat_fetch_stat_tabentry(Oid relid); - -extern PgStat_StatQueueEntry *pgstat_fetch_stat_queueentry(Oid queueid); /* GPDB */ -extern PgBackendStatus *pgstat_fetch_stat_beentry(int beid); -extern LocalPgBackendStatus *pgstat_fetch_stat_local_beentry(int beid); - -extern PgStat_StatFuncEntry *pgstat_fetch_stat_funcentry(Oid funcid); -extern PgStat_ArchiverStats *pgstat_fetch_stat_archiver(void); -extern PgStat_GlobalStats *pgstat_fetch_global(void); -extern PgStat_WalStats *pgstat_fetch_stat_wal(void); -extern PgStat_SLRUStats *pgstat_fetch_slru(void); -======= extern PgStat_StatTabEntry *pgstat_fetch_stat_tabentry(Oid relid); extern PgStat_StatTabEntry *pgstat_fetch_stat_tabentry_ext(bool shared, Oid reloid); @@ -1680,7 +672,6 @@ extern void pgstat_report_replslot(struct ReplicationSlot *slot, const PgStat_St extern void pgstat_create_replslot(struct ReplicationSlot *slot); extern void pgstat_acquire_replslot(struct ReplicationSlot *slot); extern void pgstat_drop_replslot(struct ReplicationSlot *slot); ->>>>>>> REL_16_9 extern PgStat_StatReplSlotEntry *pgstat_fetch_replslot(NameData slotname); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cloudberry.apache.org For additional commands, e-mail: commits-h...@cloudberry.apache.org