Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cWUrC-0003Vb-HM for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Jan 2017 21:11:54 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cWUrB-0000dY-KC for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Jan 2017 21:11:53 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cWUr8-0000Xj-W8 for pgsql-hackers@postgresql.org; Wed, 25 Jan 2017 21:11:51 +0000 Received: from mail-ua0-x22f.google.com ([2607:f8b0:400c:c08::22f]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1cWUr5-0000bv-Vy for pgsql-hackers@postgresql.org; Wed, 25 Jan 2017 21:11:49 +0000 Received: by mail-ua0-x22f.google.com with SMTP id 96so168656694uaq.3 for ; Wed, 25 Jan 2017 13:11:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=Qki/UXBKrsL7zl4uMNE6iyrUD6RUry760SIA8z83lYk=; b=jy7RqxcsfBfQLv1whuZbaV0ak3+Zo8/P8WtrJZhpw6aw4NvyG+puGXaefXd0pqRPg6 r1yZzdZMA1Hj85JYk5Wa39fVzVpolX+eFiekOsgy0baLWaWT4AYCpcLT/5gBi3UvqXip LP2qGWTKgRsm6A76AmZX/ZuchAdLST4FZAWGALaPLCKPiXuZT8VxzGi6LMeHUUvYxwFD jZan737sFxbrXjce5meeWG3FXNqoCRAl0H6O1fmkd19dXBTSYN4/Cfvd6spzQ6G16X2e nUiBDVK20YnodL7cvd6nKCXj13MM6j9ad9U/6JVlhwCdvlTSCI52Lk5ldUpAkmbrfQZS rQXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=Qki/UXBKrsL7zl4uMNE6iyrUD6RUry760SIA8z83lYk=; b=r4+3frLQsV3E+aig5MTmyOD1nvoQQQkjlgSnLcSZlktJ/XBr16SDp21OM3Hb5TM4IQ BvYBDbRfdJ/E4LysRmcepa729w9deuZPEvFqNnkf2zSpyyI5ujxTG4l7wu1ckm4mscqh GH9/rdmDERhzLwxh6fiXw5vVQCsXIyt5ur42V6zBMCBkZ4NMHn9bHr+JpETgMGafanac RRtlOhKngzwjMie/rauT84v6NhUWtgaU9jHUiqD+fbgRy8nh7MtIwLeq/7egj7VEk2gq RqcsDajq+J/gZVt87lZUTfazeYtEJxzT/ftf5wMrOJ8ULZoJnyU7KiPDWqFCJY3QCoBd aIQw== X-Gm-Message-State: AIkVDXJocfl1WOe4xRlFY0g7Rzt1FNV7y0/lCpr/MENn+UaHnMcYKZ935MJhly/VqzF1jcNZ X-Received: by 10.176.83.218 with SMTP id l26mr18606563uaa.69.1485378706736; Wed, 25 Jan 2017 13:11:46 -0800 (PST) Received: from alvin.alvh.no-ip.org ([186.9.130.110]) by smtp.gmail.com with ESMTPSA id p196sm641047vkd.10.2017.01.25.13.11.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Jan 2017 13:11:46 -0800 (PST) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 37A6FC27; Wed, 25 Jan 2017 18:08:32 -0300 (CLST) Date: Wed, 25 Jan 2017 18:08:32 -0300 From: Alvaro Herrera To: Pavan Deolasee Cc: Jaime Casanova , Haribabu Kommi , Tomas Vondra , pgsql-hackers Subject: Re: Patch: Write Amplification Reduction Method (WARM) Message-ID: <20170125210832.p7johdmfnqvd2ysn@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Looking at your 0002 patch now. It no longer applies, but the conflicts are trivial to fix. Please rebase and resubmit. I think the way WARM works has been pretty well hammered by now, other than the CREATE INDEX CONCURRENTLY issues, so I'm looking at the code from a maintainability point of view only. I think we should have some test harness for WARM as part of the source repository. A test that runs for an hour hammering the machine to highest possible load cannot be run in "make check", of course, but we could have some specific Make target to run it manually. We don't have this for any other feature, but this looks like a decent place to start. Maybe we should even do it before going any further. The test code you submitted looks OK to test the feature, but I'm not in love with it enough to add it to the repo. Maybe I will spend some time trying to convert it to Perl using PostgresNode. I think having the "recheck" index methods create an ExecutorState looks out of place. How difficult is it to pass the estate from the calling code? IMO heap_get_root_tuple_one should be called just heap_get_root_tuple(). That function and its plural sibling heap_get_root_tuples() should indicate in their own comments what the expectations are regarding the root_offsets output argument, rather than deferring to the comments in the "internal" function, since they differ on that point; for the rest of the invariants I think it makes sense to say "Also see the comment for heap_get_root_tuples_internal". I wonder if heap_get_root_tuple should just return the ctid instead of assigning the value to a passed-in pointer, i.e. OffsetNumber heap_get_root_tuple(Page page, OffsetNumber target_offnum) { OffsetNumber off; heap_get_root_tuples_internal(page, target_offnum, &off); return off; } The simple_heap_update + CatalogUpdateIndexes pattern is getting obnoxious. How about creating something like catalog_heap_update which does both things at once, and stop bothering each callsite with the WARM stuff? In fact, given that CatalogUpdateIndexes is used in other places, maybe we should leave its API alone and create another function, so that we don't have to change the many places that only do simple_heap_insert. (Places like OperatorCreate which do either insert or update could just move the index update call into each branch.) I'm not real sure about the interface between index AM and executor, namely IndexScanDesc->xs_tuple_recheck. For example, this pattern: if (!scan->xs_recheck) scan->xs_tuple_recheck = false; else scan->xs_tuple_recheck = true; can become simply scan->xs_tuple_recheck = scan->xs_recheck; which looks odd. I can't pinpoint exactly what's the problem, though. I'll continue looking at this one. I wonder if heap_hot_search_buffer() and heap_hot_search() should return a tri-valued enum instead of boolean; that idea looks reasonable in theory but callers have to do more work afterwards, so maybe not. I think heap_hot_search() sometimes leaving the buffer pinned is confusing. Really, the whole idea of having heap_hot_search have a buffer output argument is an important API change that should be better thought. Maybe it'd be better to return the buffer pinned always, and the caller is always in charge of unpinning if not InvalidBuffer. Or perhaps we need a completely new function, given how different it is to the original? If you tried to document in the comment above heap_hot_search how it works, you'd find that it's difficult to describe, which'd be an indicator that it's not well considered. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers