Make gistvacuumcleanup() count the actual number of index tuples.
Make gistvacuumcleanup() count the actual number of index tuples.

Previously, it just returned the heap tuple count, which might be only an
estimate, and would be completely the wrong thing if the index is partial.
Since this function scans every index page anyway to find free pages,
it's practically free to count the surviving index tuples.  Let's do that
and return an accurate count.

This is easily visible as a wrong reltuples value for a partial GiST
index following VACUUM, so back-patch to all supported branches.

Andrey Borodin, reviewed by Michail Nikolaev

Discussion: dc0aeb2767c85fe3e292a798c664c5564c1d88fe@coridan.postgresql.org

lisakowen/gpdb,lisakowen/gpdb,jmcatamney/gpdb,ashwinstar/gpdb,lisakowen/gpdb,jmcatamney/gpdb,50wu/gpdb,xinzweb/gpdb,xinzweb/gpdb,xinzweb/gpdb,lisakowen/gpdb,jmcatamney/gpdb,50wu/gpdb,greenplum-db/gpdb,50wu/gpdb,xinzweb/gpdb,jmcatamney/gpdb,ashwinstar/gpdb,greenplum-db/gpdb,adam8157/gpdb,adam8157/gpdb,50wu/gpdb,ashwinstar/gpdb,greenplum-db/gpdb,greenplum-db/gpdb,50wu/gpdb,greenplum-db/gpdb,50wu/gpdb,jmcatamney/gpdb,greenplum-db/gpdb,xinzweb/gpdb,50wu/gpdb,ashwinstar/gpdb,ashwinstar/gpdb,xinzweb/gpdb,greenplum-db/gpdb,50wu/gpdb,xinzweb/gpdb,jmcatamney/gpdb,adam8157/gpdb,jmcatamney/gpdb,ashwinstar/gpdb,lisakowen/gpdb,xinzweb/gpdb,adam8157/gpdb,adam8157/gpdb,lisakowen/gpdb,ashwinstar/gpdb,jmcatamney/gpdb,ashwinstar/gpdb,adam8157/gpdb,lisakowen/gpdb,greenplum-db/gpdb,adam8157/gpdb,lisakowen/gpdb,adam8157/gpdb