pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #14450: inconsistent results on async slave
2+ messages / 2 participants
[nested] [flat]

* BUG #14450: inconsistent results on async slave
@ 2016-12-06 08:57  rikard@ngs.hr
  0 siblings, 1 reply; 2+ messages in thread

From: rikard@ngs.hr @ 2016-12-06 08:57 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      14450
Logged by:          Rikard Pavelic
Email address:      rikard@ngs.hr
PostgreSQL version: 9.3.14
Operating system:   Linux
Description:        

Before applying new version of the function to the database I wanted to
check if results of the function were the same

So we ran a query like this:

select a.id, original_fun(a.id), new_fun(a.id)
from table a
where coalesce(original_fun(a.id), MIN_DATE) != coalesce(new_fun(a.id),
MIN_DATE)

on all our async slave instances.
Strangely for small number of rows (6 out of 500k) this query returned
different results.
After running:

select original_fun(diff_id), new_fun(diff_id);

for one of those ids, the function returned the same result.

Is this expected behavior?

original_fun = plpgsql (volatile - should be stable)
new_fun = sql

What is even more strange, is that different results were like this:

id1, X1, null
id2, null, X2
id3, X3, null
id4, X4, null
id5, X5, null
id6, X6, null

data is only inserted and X_ represents min date of sum subset of data in
other tables.

Regards,
Rikard


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #14450: inconsistent results on async slave
@ 2016-12-06 15:44  Tom Lane <tgl@sss.pgh.pa.us>
  parent: rikard@ngs.hr
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2016-12-06 15:44 UTC (permalink / raw)
  To: rikard@ngs.hr; +Cc: pgsql-bugs

rikard@ngs.hr writes:
> Is this expected behavior?

You haven't provided nearly enough information to let anyone diagnose
this with certainty; but if the data is changing under you, then replacing
a volatile function with a stable one could certainly cause different
results, because the data visibility rules would be different.  See
https://www.postgresql.org/docs/9.3/static/xfunc-volatility.html
particularly the bit about volatile functions using a new snapshot
on each call.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2016-12-06 15:44 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-12-06 08:57 BUG #14450: inconsistent results on async slave rikard@ngs.hr
2016-12-06 15:44 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox