Re: Receiving many more rows than expected

From: Vincent de Phily <vincent(dot)dephily(at)mobile-devices(dot)fr>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: Receiving many more rows than expected
Date: 2014-05-12 16:57:58
Message-ID: 1505308.5GZDhGOHS9@moltowork
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Friday 09 May 2014 16:53:49 Adrian Klaver wrote:
> On 05/09/2014 08:04 AM, Vincent de Phily wrote:
> > Thanks to all for taking an interest so far, this bug is... weird.
>
> Yes weird. I tried to replicate your query to see if I could see
> anything similar. Tried it on 9.0.17 and 9.3.4 and could not get it to fail.
>
> Did hard coding the limit value change anything?

I didn't hardcode the formating, just the test to display more debug when the
bug happens:

> if rlen != curs.rowcount or rlen > 5000:
> LOG.error("Fetched strange number of rows %d %d %s", rlen, curs.rowcount,
> query)

And I got 2 instances of the bug during the weekend. Annoyingly, the debug
showed as expected that rlen == curs.rowcount and that the query does ask for
5000 records. So the querystring formating is apparently not at fault.

I also verified that none of the returned row ids overlapped (as expected).

So... Still not solved :(

I'm running out of ideas, but there are still two things I want to try:
* Logging all queries on the server side until I catch at least one instance
of the bug. Is there a way to log the number of rows affected by a query ?
* Create a new cursor for each execute(), in case there somehow is some
leftover state between two execute() calls. However I did a number of code
changes today; they should be unrelated but I'll let them run on their own
for a while to verify that.

--
Vincent de Phily

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G Johnston 2014-05-12 17:10:36 Re: Receiving many more rows than expected
Previous Message Borodin Vladimir 2014-05-12 16:42:10 Question about synchronous replication