Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gp5OD-0001xe-5a for pgsql-hackers@arkaria.postgresql.org; Thu, 31 Jan 2019 05:59:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gp5OB-00065a-TD for pgsql-hackers@arkaria.postgresql.org; Thu, 31 Jan 2019 05:59:51 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gp5OB-00065T-Fe for pgsql-hackers@lists.postgresql.org; Thu, 31 Jan 2019 05:59:51 +0000 Received: from smtp-fw-9102.amazon.com ([207.171.184.29]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gp5O4-0005ev-CW for pgsql-hackers@postgresql.org; Thu, 31 Jan 2019 05:59:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1548914384; x=1580450384; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=B7m22UdAHuMSE/yF4h2j+/amJwre29WusPEFo9eeags=; b=TLamnODQDVRKQ0d7/KnWz+PbFaeHkdGkMkvy9rwZPMA9e2LcXBmiliqp G8hje+Riawehk+IZIsminzUZE9QBtbhehin2/sHC39sxYqWIfiGDpoeIS UT3gLitOU1CPEGwjFYg55sbH5CnsJ7n3sdbtkVto2YS+CXlYQ8etHVc/0 0=; X-IronPort-AV: E=Sophos;i="5.56,543,1539648000"; d="scan'208";a="656668160" Received: from sea3-co-svc-lb6-vlan3.sea.amazon.com (HELO email-inbound-relay-2b-859fe132.us-west-2.amazon.com) ([10.47.22.38]) by smtp-border-fw-out-9102.sea19.amazon.com with ESMTP; 31 Jan 2019 05:59:40 +0000 Received: from EX13MTAUWC001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan3.pdx.amazon.com [10.236.137.198]) by email-inbound-relay-2b-859fe132.us-west-2.amazon.com (Postfix) with ESMTPS id C4E3E221967; Thu, 31 Jan 2019 05:59:40 +0000 (UTC) Received: from EX13D05UWC002.ant.amazon.com (10.43.162.92) by EX13MTAUWC001.ant.amazon.com (10.43.162.135) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 31 Jan 2019 05:59:40 +0000 Received: from f01898859afd.ant.amazon.com (10.43.161.152) by EX13D05UWC002.ant.amazon.com (10.43.162.92) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 31 Jan 2019 05:59:39 +0000 Date: Wed, 30 Jan 2019 21:59:38 -0800 From: Shawn Debnath To: Thomas Munro CC: Dmitry Dolgov <9erthalion6@gmail.com>, Robert Haas , Andres Freund , PostgreSQL-development Subject: Re: Refactoring the checkpointer's fsync request queue Message-ID: <20190131055938.GA52540@f01898859afd.ant.amazon.com> References: <20181114214948.r2adyxjclnz2lvxe@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.2 (2019-01-07) X-Originating-IP: [10.43.161.152] X-ClientProxiedBy: EX13D06UWA003.ant.amazon.com (10.43.160.13) To EX13D05UWC002.ant.amazon.com (10.43.162.92) Precedence: Bulk List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I (finally) got a chance to go through these patches and they look great. Thank you for working on this! Few comments: - I do not see SmgrFileTag being defined or used like you mentioned in your first email. I see RelFileNode still being used. Is this planned for the future? - Would be great to add a set of Tests for SimpleVector. > For the 0001 patch, I'll probably want to reconsider the naming a it > ("simple -> "specialized", "generic", ...?) I think the name SimpleVector is fine, fits with the SimpleHash theme. If the goal is to shorten it, perhaps PG prefix would suffice? > 4. The protocol for forgetting relations etc is slightly different: > if a file is found to be missing, AbsortFsyncRequests() and then probe > to see if the segment number disappeared from the set (instead of > cancel flags), though I need to test this case. Can you explain this part a bit more? I am likely missing something in the patch. > I couldn't resist the urge to try porting pg_qsort() to this style. > It seems to be about twice as fast as the original at sorting integers > on my machine with -O2. I suppose people aren't going to be too > enthusiastic about yet another copy of qsort in the tree, but maybe > this approach (with a bit more work) could replace the Perl code-gen > for tuple sorting. Then the net number of copies wouldn't go up, but > this could be used for more things too, and it fits with the style of > simplehash.h and simplevector.h. Thoughts? +1 for avoiding duplicate code. Would it be acceptable to migrate the rest of the usages to this model over time perhaps? Love to move this patch forward. I wonder if it might be better to introduce two different functions catering to the two different use cases for forcing an immediate sync: - sync a relation smgrimmedsyncrel(SMgrRelation, ForkNumber) - sync a specific segment smgrimmedsyncseg(SMgrRelation, ForkNumber, SegmentNumber) This will avoid having to specify InvalidSegmentNumber for majority of the callers today. -- Shawn Debnath Amazon Web Services (AWS)