Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5e07d3d

Browse files
committed
pgstat: fix small bug in pgstat_drop_relation().
Just after committing5891c7a, a test running with debug_discard_caches=1failed locally...pgstat_drop_relation() neither checked pgstat_should_count_relation() norcalled pgstat_prep_relation_pending(). With debug_discard_caches=1rel->pgstat_info wasn't set up, leading pg_stat_get_xact_tuples_inserted()spuriously still returning > 0 while in the transaction dropping the table.
1 parent81ae9e6 commit5e07d3d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

‎src/backend/utils/activity/pgstat_relation.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,18 +180,21 @@ void
180180
pgstat_drop_relation(Relationrel)
181181
{
182182
intnest_level=GetCurrentTransactionNestLevel();
183-
PgStat_TableStatus*pgstat_info=rel->pgstat_info;
183+
PgStat_TableStatus*pgstat_info;
184184

185185
pgstat_drop_transactional(PGSTAT_KIND_RELATION,
186186
rel->rd_rel->relisshared ?InvalidOid :MyDatabaseId,
187187
RelationGetRelid(rel));
188188

189+
if (!pgstat_should_count_relation(rel))
190+
return;
191+
189192
/*
190193
* Transactionally set counters to 0. That ensures that accesses to
191194
* pg_stat_xact_all_tables inside the transaction show 0.
192195
*/
193-
if (pgstat_info&&
194-
pgstat_info->trans!=NULL&&
196+
pgstat_info=rel->pgstat_info;
197+
if (pgstat_info->trans&&
195198
pgstat_info->trans->nest_level==nest_level)
196199
{
197200
save_truncdrop_counters(pgstat_info->trans, true);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp