Re: pg_dump test instability - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: pg_dump test instability
Date
Msg-id 080c109e-0426-0aff-7a88-c0ea9399fa56@2ndquadrant.com
Whole thread Raw
In response to Re: pg_dump test instability  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pg_dump test instability
List pgsql-hackers
On 12/09/2018 18:06, Tom Lane wrote:
> No.  In both code paths, the array slot at index first_te is being
> physically dropped from the set of valid entries (by incrementing
> first_te).  In the first path, that slot holds the item we want to
> remove logically from the set, so that incrementing first_te is
> all we have to do: the remaining entries are still in the range
> first_te..last_te, and they're still sorted.  In the second code
> path, the item that was in that slot is still wanted as part of
> the set, so we copy it into the valid range (overwriting the item
> in slot i, which is no longer wanted).  Now the valid range is
> probably not sorted, so we have to flag that a re-sort is needed.

I see.  Why not shift all items up to the i'th up by one place, instead
of moving only the first one?  That way the sortedness would be
preserved.  Otherwise we'd move the first one into the middle, then
sorting would move it to the front again, etc.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


pgsql-hackers by date:

Previous
From: Paul Guo
Date:
Subject: Re: [Patch] Create a new session in postmaster by calling setsid()
Next
From: Michael Paquier
Date:
Subject: Re: Unused argument from execute_sql_string()