Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1canI5-0001P4-Pp for pgsql-bugs@arkaria.postgresql.org; Mon, 06 Feb 2017 17:41:25 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1canI5-0007aj-DB for pgsql-bugs@arkaria.postgresql.org; Mon, 06 Feb 2017 17:41:25 +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 1canI4-0007Yt-PO for pgsql-bugs@postgresql.org; Mon, 06 Feb 2017 17:41:24 +0000 Received: from mimolette.dalibo.net ([212.85.157.144] helo=mail.dalibo.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1canI1-0003q8-2F for pgsql-bugs@postgresql.org; Mon, 06 Feb 2017 17:41:24 +0000 Received: from [192.168.1.12] (bgd76-1-82-233-212-24.fbx.proxad.net [82.233.212.24]) by mail.dalibo.com (Postfix) with ESMTPSA id 1466A2C0259; Mon, 6 Feb 2017 18:41:19 +0100 (CET) Subject: Re: BUG #14529: Missing non pk data for "before image" in logical decoding To: Petr Jelinek , pgsql-bugs@postgresql.org References: <20170206161229.1409.73502@wrigleys.postgresql.org> <6f20b38c-13a2-2b22-04c2-88fd97d5c5e7@2ndquadrant.com> From: Philippe Beaudoin Message-ID: <2a8df43a-8023-6619-c043-7b0aa713ee46@dalibo.com> Date: Mon, 6 Feb 2017 18:41:18 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <6f20b38c-13a2-2b22-04c2-88fd97d5c5e7@2ndquadrant.com> Content-Type: multipart/alternative; boundary="------------DEF7B2DA342D6E4B83A32AD5" X-Pg-Spam-Score: -1.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 This is a multi-part message in MIME format. --------------DEF7B2DA342D6E4B83A32AD5 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Le 06/02/2017 à 18:01, Petr Jelinek a écrit : > Hi, > > On 06/02/17 17:12, philippe.beaudoin@dalibo.com wrote: >> The following bug has been logged on the website: >> >> Bug reference: 14529 >> Logged by: Philippe BEAUDOIN >> Email address: philippe.beaudoin@dalibo.com >> PostgreSQL version: 9.6.1 >> Operating system: Linux >> Description: >> >> I am currently studying the logical decoding mechanism as an alternative to >> log triggers for the E-Maj extension. >> Using pg_recvlogical and pgbench, I have been able to reproduce an issue >> that I met. >> >> [...snip...] >> >> BEGIN 5454770 >> table public.pgbench_accounts: UPDATE: old-key: aid[integer]:24469 >> bid[integer]:1 abalance[integer]:0 filler[character]:' >> ' new-tuple: >> aid[integer]:24469 bid[integer]:1 abalance[integer]:-3373 >> filler[character]:' >> ' >> table public.pgbench_tellers: UPDATE: old-key: tid[integer]:2 bid[integer]:1 >> tbalance[integer]:0 new-tuple: tid[integer]:2 bid[integer]:1 >> tbalance[integer]:-3373 filler[character]:null >> table public.pgbench_branches: UPDATE: old-key: bid[integer]:1 >> bbalance[integer]:0 new-tuple: bid[integer]:1 bbalance[integer]:-3373 >> filler[character]:null >> table public.pgbench_history: INSERT: tid[integer]:2 bid[integer]:1 >> aid[integer]:24469 delta[integer]:-3373 mtime[timestamp without time >> zone]:'2017-01-21 09:51:29.728733' filler[character]:null >> COMMIT 5454770 >> BEGIN 5454771 >> table public.pgbench_accounts: UPDATE: old-key: aid[integer]:4016 >> bid[integer]:1 abalance[integer]:0 filler[character]:' >> ' new-tuple: >> aid[integer]:4016 bid[integer]:1 abalance[integer]:3308 filler[character]:' >> >> ' >> table public.pgbench_tellers: UPDATE: old-key: tid[integer]:2 bid[integer]:1 >> tbalance[integer]:-3373 new-tuple: tid[integer]:2 bid[integer]:1 >> tbalance[integer]:-65 filler[character]:null >> table public.pgbench_branches: UPDATE: old-key: bid[integer]:1 >> bbalance[integer]:-3373 new-tuple: bid[integer]:1 bbalance[integer]:-65 >> filler[character]:null >> table public.pgbench_history: INSERT: tid[integer]:2 bid[integer]:1 >> aid[integer]:4016 delta[integer]:3308 mtime[timestamp without time >> zone]:'2017-01-21 09:51:29.74555' filler[character]:null >> COMMIT 5454771 >> #------------------------------------------------------------------------------- >> >> The incomplete UPDATEs concern pgbench_tellers and pgbench_branches >> tables. >> > Seems to me like what you see here is not bug but just behavior of > test_decoding plugin which skips NULL values from old-key printing - see > the tuple_to_stringinfo() function and calls to it from pg_decode_change(). > Thank a lot, Petr, for your quick answer. Effectively, the code you have pointed out is clear. And looking more closely at the pgbench scenario and table structure confirms your explanation. The documentation doesn't explain this detail level. But as this output plugin is only an example, I understand the documentation remains light. Sorry for the trouble. Philippe. ------------------------------------------------------------------------ *DALIBO* *L'expertise PostgreSQL* 10 rue d'Uzès 75002 Paris *Philippe Beaudoin* *Consultant Avant-Vente* +33 (0)1 84 19 36 94 +33 (0)7 69 14 67 21 --------------DEF7B2DA342D6E4B83A32AD5 Content-Type: multipart/related; boundary="------------063D9774D0D68FFBEAE6394B" --------------063D9774D0D68FFBEAE6394B Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
Le 06/02/2017 à 18:01, Petr Jelinek a écrit :
Hi,

On 06/02/17 17:12, philippe.beaudoin@dalibo.com wrote:
The following bug has been logged on the website:

Bug reference:      14529
Logged by:          Philippe BEAUDOIN
Email address:      philippe.beaudoin@dalibo.com
PostgreSQL version: 9.6.1
Operating system:   Linux
Description:        

I am currently studying the logical decoding mechanism as an alternative to
log triggers for the E-Maj extension.
Using pg_recvlogical and pgbench, I have been able to reproduce an issue
that I met.

[...snip...]

BEGIN 5454770
table public.pgbench_accounts: UPDATE: old-key: aid[integer]:24469
bid[integer]:1 abalance[integer]:0 filler[character]:'                      
                                                             ' new-tuple:
aid[integer]:24469 bid[integer]:1 abalance[integer]:-3373
filler[character]:'                                                         
                          '
table public.pgbench_tellers: UPDATE: old-key: tid[integer]:2 bid[integer]:1
tbalance[integer]:0 new-tuple: tid[integer]:2 bid[integer]:1
tbalance[integer]:-3373 filler[character]:null
table public.pgbench_branches: UPDATE: old-key: bid[integer]:1
bbalance[integer]:0 new-tuple: bid[integer]:1 bbalance[integer]:-3373
filler[character]:null
table public.pgbench_history: INSERT: tid[integer]:2 bid[integer]:1
aid[integer]:24469 delta[integer]:-3373 mtime[timestamp without time
zone]:'2017-01-21 09:51:29.728733' filler[character]:null
COMMIT 5454770
BEGIN 5454771
table public.pgbench_accounts: UPDATE: old-key: aid[integer]:4016
bid[integer]:1 abalance[integer]:0 filler[character]:'                      
                                                             ' new-tuple:
aid[integer]:4016 bid[integer]:1 abalance[integer]:3308 filler[character]:' 
                                                                            
     '
table public.pgbench_tellers: UPDATE: old-key: tid[integer]:2 bid[integer]:1
tbalance[integer]:-3373 new-tuple: tid[integer]:2 bid[integer]:1
tbalance[integer]:-65 filler[character]:null
table public.pgbench_branches: UPDATE: old-key: bid[integer]:1
bbalance[integer]:-3373 new-tuple: bid[integer]:1 bbalance[integer]:-65
filler[character]:null
table public.pgbench_history: INSERT: tid[integer]:2 bid[integer]:1
aid[integer]:4016 delta[integer]:3308 mtime[timestamp without time
zone]:'2017-01-21 09:51:29.74555' filler[character]:null
COMMIT 5454771
#-------------------------------------------------------------------------------

The incomplete UPDATEs concern pgbench_tellers and pgbench_branches
tables.

Seems to me like what you see here is not bug but just behavior of
test_decoding plugin which skips NULL values from old-key printing - see
the tuple_to_stringinfo() function and calls to it from pg_decode_change().

Thank a lot, Petr, for your quick answer.

Effectively, the code you have pointed out is clear. And looking more closely at the pgbench scenario and table structure confirms your explanation.

The documentation doesn't explain this detail level. But as this output plugin is only an example, I understand the documentation remains light.

Sorry for the trouble.
Philippe.


DALIBO
L'expertise PostgreSQL
10 rue d'Uzès
75002 Paris
Philippe Beaudoin
Consultant Avant-Vente
+33 (0)1 84 19 36 94
+33 (0)7 69 14 67 21
--------------063D9774D0D68FFBEAE6394B Content-Type: image/png; name="iaebonkgopgmdnfj.png" Content-Transfer-Encoding: base64 Content-ID: Content-Disposition: inline; filename="iaebonkgopgmdnfj.png" iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFz UkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA AdFQTFRFAAAAMIznMYznMIvmMYzmMYvmMIzmOYznNIzqLIziMYvnMozoMoznMYznMYznMIzn MIvmMYzmMYznMYznMYzmMIvmMYzmMYznMYvmMIznMYznMYzmMYznMYznMIzmMYzmMYznMIzm MYznMYznMYznMYznMYznMYzmMYzmMYznMYznMYznMYznMYznMYznMYznMYznMYznMYzmMYzn MYznMYzmMYznMYznMYzmMYznMYznMYznMYznMYznMYznMYznMYznMYznMYznMYznMYznMYzn MYznMYznMYznMYznMYznMYznMYznMYznMYznMYznMYznMYznMYzmMYzmMYzmMYzmMYznMYzn MYzmMYznMYznMYznMYznMYznMYznMIznMYznMIvmMYznMYznMYznMYznMYznMIzmMYznL4rl MYznMYznMYznMYznMYznMYzmMYzmMYznMYvnMYznMYznMYznMYznMYznMYzmMYznMYznMYzn MYznMIznMYznMYznMYznMYznMYznMIznMYznMYzmMYznMYznMYzmMYznMYznMYvnMYznMYzn MYznMYznMYznMYznMYznMYznMYznMYznMYznMYznMYznMYzn////Lrr++AAAAJl0Uk5TAAAA AAAAAAAAAAAAAAoTFBQUFBUVFhYWFhUHBQ8QEBAREQgon9vf3+Dg4eLj5OXm5+jp6UxBt8jJ y8zNmCeh/vVTVe2n7/Ty+/z9+vn281L3VjtAP0rSWBfJ0TTZtVmHBYhQKdgyhJ0NBV/wWld9 t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