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 1fqWKw-0003hq-Ma for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Aug 2018 04:26:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fqWKt-0000lw-RS for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Aug 2018 04:26:07 +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.89) (envelope-from ) id 1fqWKt-0000lk-DD for pgsql-hackers@lists.postgresql.org; Fri, 17 Aug 2018 04:26:07 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fqWKn-00014e-D1 for pgsql-hackers@postgresql.org; Fri, 17 Aug 2018 04:26:05 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 8AD3921C2908; Fri, 17 Aug 2018 07:25:58 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from [192.168.0.103] (unknown [5.79.139.210]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 4777621C2903; Fri, 17 Aug 2018 07:25:58 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1534479958; bh=ZmyjT/Ju0/MJw6mbuyFENwZF/kTm86bhjtP09A3OqFI=; h=Reply-To:Subject:To:Cc:References:From:Date:In-Reply-To; b=pDgS11ZKqc/y+7yWfNmYaJ/bHt+SzG45SBx1TirX6TG7KcOyPDbUqbbaU4RoyoIwW nwjoMYUthuBLk6lW4ZbHCfPcdy9kYoWFY3lsXRNy5wgR+agzsuwDnZ/WZHuw8gYRTO KY7hPRWC09iehtuQrKlr5SZlNs/eIG021NxiOwZI= Reply-To: a.lepikhov@postgrespro.ru Subject: Re: [PATCH] XLogReadRecord returns pointer to currently read page To: Michael Paquier Cc: PostgreSQL-Dev References: <20180817035521.GF1693@paquier.xyz> From: Andrey Lepikhov Organization: Postgres Professional Message-ID: <0884f09b-4fe4-bd62-e624-741815e4bf15@postgrespro.ru> Date: Fri, 17 Aug 2018 09:25:57 +0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180817035521.GF1693@paquier.xyz> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 17.08.2018 08:55, Michael Paquier пишет: > On Fri, Aug 17, 2018 at 08:47:15AM +0500, Andrey Lepikhov wrote: >> Previously, in all cases of using WAL this was not a problem. However if you >> plan to perform some decoding operations before returning the WAL record to >> the caller (this is my case), this can lead to bugs that are difficult to >> catch. > > What kind of cases with logical decoding are you referring to? If > any of them can be reproduced with upstream, could you send a > reproducer, or a way to see it? > -- > Michael > I'm working on the problem of a WAL-record size reducing. One of the PostgreSQL experimental extensions uses a 64-bit xid, and the XLogRecord size is increased to 32 bytes. Representing a 64-bit xid in WAL Segment as a pair (16-bit base, 8-bit offset) reduces the size of the WAL record header and its body. So, I encode a WAL-record in XLogInsertRecord() (decreasing the size) just before writing to a shared memory pages and performs the decoding just before processing DecodeXLogRecord() operation. It looks like a layer in the xlog subsystem for additional WAL compression. However, this is a long story ... -- Andrey Lepikhov Postgres Professional https://postgrespro.com The Russian Postgres Company