Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1apu41-0002sX-8l for pgsql-bugs@arkaria.postgresql.org; Tue, 12 Apr 2016 08:52:49 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1apu40-0008LN-Ck for pgsql-bugs@arkaria.postgresql.org; Tue, 12 Apr 2016 08:52:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1apu3M-0006xr-Rt; Tue, 12 Apr 2016 08:52:08 +0000 Received: from boipeva.ensmp.fr ([194.214.158.136]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1apu3F-0004mK-7O; Tue, 12 Apr 2016 08:52:08 +0000 Received: from cri.ensmp.fr (228.Red-88-2-177.staticIP.rima-tde.net [88.2.177.228]) (authenticated bits=0) by boipeva.ensmp.fr (8.15.2/8.15.1/JMMC-22/Oct/2013) with ESMTPSA id u3C8poEc015336 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 12 Apr 2016 10:51:52 +0200 Date: Tue, 12 Apr 2016 09:51:49 +0100 (WEST) From: Fabien COELHO X-X-Sender: fabien@sto To: Andres Freund cc: Robert Haas , Michael Paquier , Haribabu Kommi , Thom Brown , pgsql-bugs , "pgsql-hackers@postgresql.org" Subject: Re: [HACKERS] Breakage with VACUUM ANALYSE + partitions In-Reply-To: <20160411171742.n5xebjt7tcdy4sxf@alap3.anarazel.de> Message-ID: References: <20160326123942.qnuwqg3yg2y7ae4p@alap3.anarazel.de> <20160411165054.r35o4fjicdg4avs7@alap3.anarazel.de> <20160411171742.n5xebjt7tcdy4sxf@alap3.anarazel.de> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-Miltered: at boipeva.ensmp.fr with ID 570CB726.000 by Joe's j-chkmail (http : // j-chkmail dot ensmp dot fr)! X-j-chkmail-Auth: USER-ID fabien.coelho X-j-chkmail-Enveloppe: 570CB726.000 from 228.Red-88-2-177.staticIP.rima-tde.net/228.Red-88-2-177.staticIP.rima-tde.net/88.2.177.228/cri.ensmp.fr/ X-Pg-Spam-Score: -2.9 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Hello Andres, > I can think of a number of relatively easy ways to address this: > 1) Just zap (or issue?) all pending flush requests when getting an > smgrinval/smgrclosenode > 2) Do 1), but filter for the closed relnode > 3) Actually handle the case of the last open segment not being > RELSEG_SIZE properly in _mdfd_getseg() - mdnblocks() does so. > > I'm kind of inclined to do both 3) and 1). Alas I'm a little bit outside my area of expertise. Just for suggestion purpose, possibly totally wrong (please accept my apology if this is the case), the ideas I had while thinking about these issues, some may be quite close to your suggestions above: - keep track of file/segment closing/reopenings (say with a counter), so that if a flush is about a file/segment which has been closed or reopened, it is just skipped. I'm not sure this is enough, because one process may do the file cleaning and another may want to flush, although I guess there is some kind of locking/shared data structures to manage such interactions between pg processes. - because of "empty the bucket when filled behavior" of the current implementation, a buffer to be flused may be kept for a very long time in the bucket. I think that flushing advices become stale after a while so should not be issued (the buffer may have been written again, ...), or the bucket should be flushed after a while even of not full. Also, a detail in "pg_flush_data", there are a serie of three if/endif, but it is not obvious to me whether they are mutually exclusive while looking at the source, so I was wondering whether the code could try several flushings approaches one after the other... This is probably not the case, but I would be more at ease with a if/elif/elif/endif structure there so that is clearer. -- Fabien. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs