pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Justin Pryzby <pryzby@telsasoft.com>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: pgsql-hackers@postgresql.org
Subject: Re: PG10.1 autovac killed building extended stats
Date: Mon, 27 Nov 2017 07:33:38 -0600
Message-ID: <20171127133338.GC19405@telsasoft.com> (raw)
In-Reply-To: <20171117214352.GE25796@telsasoft.com>
References: <20171117152714.GA25754@telsasoft.com>
	<20171117163600.d7zsm2odaizikdhs@alvherre.pgsql>
	<20171117214352.GE25796@telsasoft.com>

On Fri, Nov 17, 2017 at 03:43:52PM -0600, Justin Pryzby wrote:
> On Fri, Nov 17, 2017 at 01:36:00PM -0300, Alvaro Herrera wrote:
> > Justin Pryzby wrote:
> > 
> > > Core was generated by `postgres: autovacuum worker process   gtt             '.
> > > Program terminated with signal 11, Segmentation fault.
> > > #0  statext_ndistinct_build (totalrows=300, numrows=300, rows=0x21df3e8, attrs=<value optimized out>, stats=0x0) at mvdistinct.c:103
> > > 103                                     item->attrs = bms_add_member(item->attrs,
> > > 
> > > (gdb) p stats
> > > $5 = (VacAttrStats **) 0x0
> > > => This is an error, no ??
> > 
> > Not necessarily, but then I think this previous code is busted:
> 
> > If I recall things correctly, the "continue" should be executed
> > regardless of IsAutoVacuumWorkerProcess() (only the log should be
> > conditional on that).  I'm not sure how I arrived at the current coding,
> > which I added in bf2a691e02d7 -- probably just fuzzy thinking.
> 
> Is it useful to run with that change ?

FYI: the affected server ran without crashing since Nov 18 with this change.

--- postgresql-10.1.orig/src/backend/statistics/extended_stats.c	2017-11-06 20:46:52.000000000 -0400
+++ postgresql-10.1/src/backend/statistics/extended_stats.c	2017-11-18 18:23:44.057988419 -0400
@@ -98,20 +98,21 @@
 		if (!stats && !IsAutoVacuumWorkerProcess())
 		{
 			ereport(WARNING,
 					(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
 					 errmsg("statistics object \"%s.%s\" could not be computed for relation \"%s.%s\"",
 							stat->schema, stat->name,
 							get_namespace_name(onerel->rd_rel->relnamespace),
 							RelationGetRelationName(onerel)),
 					 errtable(onerel)));
-			continue;
 		}
+		if (!stats)
+			continue;
 
 		/* check allowed number of dimensions */
 		Assert(bms_num_members(stat->columns) >= 2 &&
 			   bms_num_members(stat->columns) <= STATS_MAX_DIMENSIONS);
 
 		/* compute statistic of each requested type */
 		foreach(lc2, stat->types)
 		{
 			char		t = (char) lfirst_int(lc2);

Justin
--- postgresql-10.1.orig/src/backend/statistics/extended_stats.c	2017-11-06 20:46:52.000000000 -0400
+++ postgresql-10.1/src/backend/statistics/extended_stats.c	2017-11-18 18:23:44.057988419 -0400
@@ -98,20 +98,21 @@
 		if (!stats && !IsAutoVacuumWorkerProcess())
 		{
 			ereport(WARNING,
 					(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
 					 errmsg("statistics object \"%s.%s\" could not be computed for relation \"%s.%s\"",
 							stat->schema, stat->name,
 							get_namespace_name(onerel->rd_rel->relnamespace),
 							RelationGetRelationName(onerel)),
 					 errtable(onerel)));
-			continue;
 		}
+		if (!stats)
+			continue;
 
 		/* check allowed number of dimensions */
 		Assert(bms_num_members(stat->columns) >= 2 &&
 			   bms_num_members(stat->columns) <= STATS_MAX_DIMENSIONS);
 
 		/* compute statistic of each requested type */
 		foreach(lc2, stat->types)
 		{
 			char		t = (char) lfirst_int(lc2);

Attachments:

mvstats-continue (text/plain, 922B) download --- postgresql-10.1.orig/src/backend/statistics/extended_stats.c 2017-11-06 20:46:52.000000000 -0400 +++ postgresql-10.1/src/backend/statistics/extended_stats.c 2017-11-18 18:23:44.057988419 -0400 @@ -98,20 +98,21 @@ if (!stats && !IsAutoVacuumWorkerProcess()) { ereport(WARNING, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), errmsg("statistics object \"%s.%s\" could not be computed for relation \"%s.%s\"", stat->schema, stat->name, get_namespace_name(onerel->rd_rel->relnamespace), RelationGetRelationName(onerel)), errtable(onerel))); - continue; } + if (!stats) + continue; /* check allowed number of dimensions */ Assert(bms_num_members(stat->columns) >= 2 && bms_num_members(stat->columns) <= STATS_MAX_DIMENSIONS); /* compute statistic of each requested type */ foreach(lc2, stat->types) { char t = (char) lfirst_int(lc2);

view thread (6+ messages)  latest in thread

Message-ID: <20171127133338.GC19405@telsasoft.com>
Permalink:  ../20171127133338.GC19405@telsasoft.com/
Also on:    postgresql.org/message-id/20171127133338.GC19405@telsasoft.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: pryzby@telsasoft.com, alvherre@alvh.no-ip.org
  Subject: Re: PG10.1 autovac killed building extended stats
  In-Reply-To: <20171127133338.GC19405@telsasoft.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox