Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ff3f8-0001hX-P6 for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Jul 2018 13:35:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ff3f7-00061o-3S for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Jul 2018 13:35:37 +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.89) (envelope-from ) id 1ff3f6-00061h-SG for pgsql-hackers@lists.postgresql.org; Mon, 16 Jul 2018 13:35:36 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ff3ez-0000nK-AB for pgsql-hackers@postgresql.org; Mon, 16 Jul 2018 13:35:36 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 36D4E21924; Mon, 16 Jul 2018 09:35:28 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Mon, 16 Jul 2018 09:35:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=4IehDLozQO03tidSxGI12VmBUMQ59QDiakO6MbI3xMI=; b=CCAe2gv9 7Z2HT/gs0f8POcVtCXqIpy9tw2dqs/78jPRBTv2bg5RtWti5T4k8kvUB2yfc6BXi N6BmzmrwjuRQck02VWadgWqynMcfoIOqnWUN8WJqnr0HJ3lDMxODUWSEnZtj8sGJ vgoTQCj6ekRne4+s0kKdtVC6LpyfsQ9mFexjqpNwXcOwYGxVW+u6beAQvUtc6CZ5 NlBg1Cb3vHo368G/01nnOtG9FUVf5bkzDKI4nkcHLlwtm//N9fYG9jjjWeSyfG7u aIQmV9GYkh2/OVXqhZdC3c8wqPU9sguvxI3Ln7HPsWulJV4ewN3UC2uvFlqYz3sS 1aKQq2Eyzc3f2A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; bh=4IehDLozQO03tidSxGI12VmBUMQ59 QDiakO6MbI3xMI=; b=QrBgbf4XUb4qlj4sryPiyafjzB4utXbUhwjVzigZvDsKm KPX3+OiK+87QHn92RV6CW1f322oZEF/g9NvvGc7oILtqLHSCygwlQOl70/Tw0sMx 3m5nq/tabyCDYBUvedPkESkRt7YcQtCCG8IG4q7Kmdt/1gOWk9RfXnAlWNSwYjw1 lH5f8kQlD1adUQaA5KLd0Ad9wjaxLofP1h6UCyeYSL638E73ntZsmXVZ980Cns6D G1zWY1yKa46PEpWTQoc5dB6A/UIn13fSN9YZ1qvGzghKFNF3SmRRmnrmt7gho9jl F+QkdEbiiGz0AFmrtJeqrVLinz4TlWxkCQXt6Wesw== X-ME-Proxy: X-ME-Sender: Received: from intern.anarazel.de (c-75-69-87-158.hsd1.vt.comcast.net [75.69.87.158]) by mail.messagingengine.com (Postfix) with ESMTPA id 904C910268; Mon, 16 Jul 2018 09:35:27 -0400 (EDT) Date: Mon, 16 Jul 2018 06:35:27 -0700 From: Andres Freund To: Haribabu Kommi Cc: Alvaro Herrera , Alexander Korotkov , Pg Hackers Subject: Re: Pluggable Storage - Andres's take Message-ID: <20180716133527.csbps4chmr7qsa7e@alap3.anarazel.de> References: <20180703070645.wchpu5muyto5n647@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, I've pushed up a new version to https://github.com/anarazel/postgres-pluggable-storage which now passes all the tests. Besides a lot of bugfixes, I've rebased the tree, moved TriggerData to be primarily slot based (with a conversion roundtrip when calling trigger functions), and a lot of other small things. On 2018-07-04 20:11:21 +1000, Haribabu Kommi wrote: > On Tue, Jul 3, 2018 at 5:06 PM Andres Freund wrote: > > The current state of my version of the patch is *NOT* ready for proper > > review (it doesn't even pass all tests, there's FIXME / elog()s). But I > > think it's getting close enough to it's eventual shape that more eyes, > > and potentially more hands on keyboards, can be useful. > > > > I will try to update it to make sure that it passes all the tests and also > try to > reduce the FIXME's. Cool. Alexander, Haribabu, if you give me (privately) your github accounts, I'll give you write access to that repository. > > The most fundamental issues I had with Haribabu's last version from [2] > > are the following: > > > > - The use of TableTuple, a typedef from void *, is bad from multiple > > fronts. For one it reduces just about all type safety. There were > > numerous bugs in the patch where things were just cast from HeapTuple > > to TableTuple to HeapTuple (and even to TupleTableSlot). I think it's > > a really, really bad idea to introduce a vague type like this for > > development purposes alone, it makes it way too hard to refactor - > > essentially throwing the biggest benefit of type safe languages out of > > the window. > > > > My earlier intention was to remove the HeapTuple usage entirely and replace > it with slot everywhere outside the tableam. But it ended up with TableTuple > before it reach to the stage because of heavy use of HeapTuple. I don't think that's necessary - a lot of the system catalog accesses are going to continue to be heap tuple accesses. And the conversions you did significantly continue to access TableTuples as heap tuples - it was just that the compiler didn't warn about it anymore. A prime example of that is the way the rewriteheap / cluster integreation was done. Cluster continued to sort tuples as heap tuples - even though that's likely incompatible with other tuple formats which need different state. > > Additionally I think it's also the wrong approach architecturally. We > > shouldn't assume that a tuple can efficiently be represented as a > > single palloc'ed chunk. In fact, we should move *away* from relying on > > that so much. > > > > I've thus removed the TableTuple type entirely. > > > > Thanks for the changes, I didn't check the code yet, so for now whenever the > HeapTuple is required it will be generated from slot? Pretty much. > > - the heap tableam did a heap_copytuple() nearly everywhere. Leading to > > a higher memory usage, because the resulting tuples weren't freed or > > anything. There might be a reason for doing such a change - we've > > certainly discussed that before - but I'm *vehemently* against doing > > that at the same time we introduce pluggable storage. Analyzing the > > performance effects will be hard enough without changes like this. > > > > How about using of slot instead of tuple and reusing of it? I don't know > yet whether it is possible everywhere. Not quite sure what you mean? > > Tasks / Questions: > > > > - split up patch > > > > How about generating refactoring changes as patches first based on > the code in your repo as discussed here[1]? Sure - it was just at the moment too much work ;) > > - Change heap table AM to not allocate handler function for each table, > > instead allocate it statically. Avoids a significant amount of data > > duplication, and allows for a few more compiler optimizations. > > > > Some kind of static variable handlers for each tableam, but need to check > how can we access that static handler from the relation. I'm not sure what you mean by "how can we access"? We can just return a pointer from the constant data from the current handler? Except that adding a bunch of consts would be good, the external interface wouldn't need to change? > > - change scan level slot creation to use tableam function for doing so > > - get rid of slot->tts_tid, tts_tupleOid and potentially tts_tableOid > > > > so with this there shouldn't be a way from slot to tid mapping or there > should be some other way. I'm not sure I follow? > - bitmap index scans probably need a new tableam.h callback, abstracting > > bitgetpage() > > > > OK. Any chance you could try to tackle this? I'm going to be mostly out this week, so we'd probably not run across each others feet... Greetings, Andres Freund