Fix two ancient bugs in GiST code to re-find a parent after page split:
Fix two ancient bugs in GiST code to re-find a parent after page split:

First, when following a right-link, we incorrectly marked the current page
as the parent of the right sibling. In reality, the parent of the right page
is the same as the parent of the current page (or some page to the right of
it, gistFindCorrectParent() will sort that out).

Secondly, when we follow a right-link, we must prepend, not append, the right
page to our list of pages to visit. That's because we assume that once we
hit a leaf page in the list, all the rest are leaf pages too, and give up.

To hit these bugs, you need concurrent actions and several unlucky accidents.
Another backend must split the root page, while you're in process of
splitting a lower-level page. Furthermore, while you scan the internal nodes
to re-find the parent, another backend needs to again split some more internal
pages. Even then, the bugs don't necessarily manifest as user-visible errors
or index corruption.

While we're at it, make the error reporting a bit better if gistFindPath()
fails to re-find the parent. It used to be an assertion, but an elog() seems
more appropriate.

Backpatch to all supported branches.

postmind-net/postgres-xl,arcivanov/postgres-xl,techdragon/Postgres-XL,greenplum-db/gpdb,50wu/gpdb,kmjungersen/PostgresXL,kmjungersen/PostgresXL,xinzweb/gpdb,ovr/postgres-xl,jmcatamney/gpdb,50wu/gpdb,ovr/postgres-xl,zeroae/postgres-xl,ashwinstar/gpdb,lisakowen/gpdb,lisakowen/gpdb,adam8157/gpdb,yazun/postgres-xl,oberstet/postgres-xl,lisakowen/gpdb,arcivanov/postgres-xl,50wu/gpdb,ashwinstar/gpdb,snaga/postgres-xl,postmind-net/postgres-xl,techdragon/Postgres-XL,greenplum-db/gpdb,jmcatamney/gpdb,xinzweb/gpdb,Postgres-XL/Postgres-XL,tpostgres-projects/tPostgres,greenplum-db/gpdb,kmjungersen/PostgresXL,pavanvd/postgres-xl,adam8157/gpdb,ashwinstar/gpdb,oberstet/postgres-xl,arcivanov/postgres-xl,kmjungersen/PostgresXL,arcivanov/postgres-xl,pavanvd/postgres-xl,yazun/postgres-xl,50wu/gpdb,pavanvd/postgres-xl,xinzweb/gpdb,jmcatamney/gpdb,snaga/postgres-xl,Postgres-XL/Postgres-XL,oberstet/postgres-xl,tpostgres-projects/tPostgres,zeroae/postgres-xl,ovr/postgres-xl,jmcatamney/gpdb,snaga/postgres-xl,Postgres-XL/Postgres-XL,ashwinstar/gpdb,snaga/postgres-xl,adam8157/gpdb,zeroae/postgres-xl,jmcatamney/gpdb,xinzweb/gpdb,tpostgres-projects/tPostgres,oberstet/postgres-xl,ashwinstar/gpdb,yazun/postgres-xl,lisakowen/gpdb,greenplum-db/gpdb,greenplum-db/gpdb,Postgres-XL/Postgres-XL,zeroae/postgres-xl,ashwinstar/gpdb,tpostgres-projects/tPostgres,oberstet/postgres-xl,ashwinstar/gpdb,greenplum-db/gpdb,arcivanov/postgres-xl,adam8157/gpdb,xinzweb/gpdb,jmcatamney/gpdb,50wu/gpdb,50wu/gpdb,lisakowen/gpdb,adam8157/gpdb,greenplum-db/gpdb,adam8157/gpdb,techdragon/Postgres-XL,arcivanov/postgres-xl,jmcatamney/gpdb,kmjungersen/PostgresXL,xinzweb/gpdb,postmind-net/postgres-xl,jmcatamney/gpdb,Postgres-XL/Postgres-XL,50wu/gpdb,ovr/postgres-xl,tpostgres-projects/tPostgres,yazun/postgres-xl,postmind-net/postgres-xl,pavanvd/postgres-xl,lisakowen/gpdb,pavanvd/postgres-xl,50wu/gpdb,greenplum-db/gpdb,adam8157/gpdb,xinzweb/gpdb,techdragon/Postgres-XL,xinzweb/gpdb,postmind-net/postgres-xl,snaga/postgres-xl,adam8157/gpdb,ovr/postgres-xl,yazun/postgres-xl,lisakowen/gpdb,lisakowen/gpdb,zeroae/postgres-xl,techdragon/Postgres-XL,ashwinstar/gpdb