On Tue, Nov 16, 2021 at 6:04 PM osumi.takami...@fujitsu.com <osumi.takami...@fujitsu.com> wrote: > > On Monday, November 15, 2021 9:14 PM I wrote: > > I've conducted some update for this. > > (The rebased part is only C code and checked by pgindent) > I'll update my patches since a new skip xid patch > has been shared in [1]. > > This version includes some minor renames of functions > that are related to transaction sizes.
Thanks for the updated patch, Few comments: 1) since pgstat_get_subworker_prepared_txn is called from only one place and create is passed as true, we can remove create function parameter or the function could be removed. + * Return subscription worker entry with the given subscription OID and + * gid. + * ---------- + */ +static PgStat_SW_PreparedXactEntry * +pgstat_get_subworker_prepared_txn(Oid databaseid, Oid subid, + char *gid, bool create) +{ + PgStat_StatDBEntry *dbentry; + PgStat_SW_PreparedXactKey key; 2) Include subworker prepared transactions also /* * Don't create tables/functions/subworkers hashtables for * uninteresting databases. */ if (onlydb != InvalidOid) { if (dbbuf.databaseid != onlydb && dbbuf.databaseid != InvalidOid) break; } 3) Similarly it should be mentioned in: reset_dbentry_counters function header, pgstat_read_db_statsfile function header and pgstat_get_db_entry function comments. 4) I felt we can remove "COMMIT of streaming transaction", since only commit and commit prepared are the user operations. Shall we change it to "COMMIT and COMMIT PREPARED will increment this counter." + <structfield>commit_count</structfield> <type>bigint</type> + </para> + <para> + Number of transactions successfully applied in this subscription. + COMMIT, COMMIT of streaming transaction and COMMIT PREPARED increments + this counter. + </para></entry> + </row> 5) PgStat_SW_PreparedXactEntry should be before PgStat_SW_PreparedXactKey PgStat_StatSubWorkerEntry PgStat_StatSubWorkerKey +PgStat_SW_PreparedXactKey +PgStat_SW_PreparedXactEntry PgStat_StatTabEntry PgStat_SubXactStatus 6) This change is not required @@ -293,6 +306,7 @@ static inline void cleanup_subxact_info(void); static void stream_cleanup_files(Oid subid, TransactionId xid); static void stream_open_file(Oid subid, TransactionId xid, bool first); static void stream_write_change(char action, StringInfo s); + static void stream_close_file(void); Regards, Vignesh