Clamp last_anl_tuples to n_live_tuples, in case we vacuum a table without analyzing, so that future analyze threshold calculations don't get confused. Also, make sure we correctly track the decrease of live tuples cause by deletes.
Clamp last_anl_tuples to n_live_tuples, in case we vacuum a table without
analyzing, so that future analyze threshold calculations don't get confused.
Also, make sure we correctly track the decrease of live tuples cause by
deletes.

Per report from Dylan Hansen, patches by Tom Lane and me.

greenplum-db/gpdb,oberstet/postgres-xl,snaga/postgres-xl,postmind-net/postgres-xl,Chibin/gpdb,yuanzhao/gpdb,zaksoup/gpdb,atris/gpdb,ashwinstar/gpdb,CraigHarris/gpdb,50wu/gpdb,adam8157/gpdb,xinzweb/gpdb,Chibin/gpdb,lintzc/gpdb,0x0FFF/gpdb,lisakowen/gpdb,CraigHarris/gpdb,arcivanov/postgres-xl,xinzweb/gpdb,chrishajas/gpdb,yazun/postgres-xl,rvs/gpdb,yuanzhao/gpdb,greenplum-db/gpdb,adam8157/gpdb,janebeckman/gpdb,rvs/gpdb,yuanzhao/gpdb,adam8157/gpdb,Chibin/gpdb,oberstet/postgres-xl,50wu/gpdb,foyzur/gpdb,xinzweb/gpdb,techdragon/Postgres-XL,xuegang/gpdb,ashwinstar/gpdb,oberstet/postgres-xl,atris/gpdb,Postgres-XL/Postgres-XL,zaksoup/gpdb,Postgres-XL/Postgres-XL,randomtask1155/gpdb,Quikling/gpdb,ahachete/gpdb,Chibin/gpdb,lisakowen/gpdb,kaknikhil/gpdb,royc1/gpdb,jmcatamney/gpdb,oberstet/postgres-xl,rubikloud/gpdb,ovr/postgres-xl,tpostgres-projects/tPostgres,kaknikhil/gpdb,lpetrov-pivotal/gpdb,Quikling/gpdb,rubikloud/gpdb,kaknikhil/gpdb,rvs/gpdb,postmind-net/postgres-xl,lpetrov-pivotal/gpdb,tangp3/gpdb,ahachete/gpdb,CraigHarris/gpdb,Chibin/gpdb,arcivanov/postgres-xl,yuanzhao/gpdb,cjcjameson/gpdb,royc1/gpdb,ashwinstar/gpdb,pavanvd/postgres-xl,lpetrov-pivotal/gpdb,jmcatamney/gpdb,lisakowen/gpdb,cjcjameson/gpdb,janebeckman/gpdb,ashwinstar/gpdb,greenplum-db/gpdb,rvs/gpdb,rvs/gpdb,Quikling/gpdb,ahachete/gpdb,adam8157/gpdb,Chibin/gpdb,kaknikhil/gpdb,Quikling/gpdb,yuanzhao/gpdb,royc1/gpdb,Chibin/gpdb,cjcjameson/gpdb,Postgres-XL/Postgres-XL,adam8157/gpdb,50wu/gpdb,postmind-net/postgres-xl,postmind-net/postgres-xl,postmind-net/postgres-xl,Chibin/gpdb,rubikloud/gpdb,zaksoup/gpdb,ahachete/gpdb,randomtask1155/gpdb,CraigHarris/gpdb,zaksoup/gpdb,xuegang/gpdb,Postgres-XL/Postgres-XL,pavanvd/postgres-xl,lisakowen/gpdb,rubikloud/gpdb,cjcjameson/gpdb,rvs/gpdb,arcivanov/postgres-xl,lintzc/gpdb,xuegang/gpdb,rvs/gpdb,chrishajas/gpdb,cjcjameson/gpdb,janebeckman/gpdb,Quikling/gpdb,0x0FFF/gpdb,50wu/gpdb,lintzc/gpdb,lisakowen/gpdb,0x0FFF/gpdb,randomtask1155/gpdb,greenplum-db/gpdb,arcivanov/postgres-xl,kmjungersen/PostgresXL,edespino/gpdb,randomtask1155/gpdb,xuegang/gpdb,rubikloud/gpdb,techdragon/Postgres-XL,chrishajas/gpdb,Quikling/gpdb,ahachete/gpdb,kaknikhil/gpdb,rubikloud/gpdb,tpostgres-projects/tPostgres,yazun/postgres-xl,chrishajas/gpdb,foyzur/gpdb,xinzweb/gpdb,lisakowen/gpdb,lintzc/gpdb,kmjungersen/PostgresXL,jmcatamney/gpdb,ovr/postgres-xl,yazun/postgres-xl,pavanvd/postgres-xl,cjcjameson/gpdb,tangp3/gpdb,jmcatamney/gpdb,Postgres-XL/Postgres-XL,lpetrov-pivotal/gpdb,cjcjameson/gpdb,janebeckman/gpdb,xuegang/gpdb,greenplum-db/gpdb,yazun/postgres-xl,randomtask1155/gpdb,ashwinstar/gpdb,edespino/gpdb,cjcjameson/gpdb,techdragon/Postgres-XL,ashwinstar/gpdb,royc1/gpdb,xinzweb/gpdb,foyzur/gpdb,zaksoup/gpdb,atris/gpdb,50wu/gpdb,royc1/gpdb,atris/gpdb,ovr/postgres-xl,kmjungersen/PostgresXL,pavanvd/postgres-xl,arcivanov/postgres-xl,ahachete/gpdb,edespino/gpdb,zaksoup/gpdb,zeroae/postgres-xl,Chibin/gpdb,arcivanov/postgres-xl,yuanzhao/gpdb,royc1/gpdb,tangp3/gpdb,yuanzhao/gpdb,yazun/postgres-xl,Quikling/gpdb,lisakowen/gpdb,techdragon/Postgres-XL,0x0FFF/gpdb,rvs/gpdb,tpostgres-projects/tPostgres,lintzc/gpdb,yuanzhao/gpdb,ashwinstar/gpdb,zeroae/postgres-xl,xuegang/gpdb,adam8157/gpdb,snaga/postgres-xl,janebeckman/gpdb,foyzur/gpdb,0x0FFF/gpdb,jmcatamney/gpdb,zeroae/postgres-xl,tangp3/gpdb,kmjungersen/PostgresXL,atris/gpdb,randomtask1155/gpdb,chrishajas/gpdb,50wu/gpdb,zaksoup/gpdb,snaga/postgres-xl,janebeckman/gpdb,xinzweb/gpdb,lintzc/gpdb,kaknikhil/gpdb,rvs/gpdb,zeroae/postgres-xl,edespino/gpdb,rvs/gpdb,janebeckman/gpdb,jmcatamney/gpdb,zaksoup/gpdb,greenplum-db/gpdb,royc1/gpdb,kaknikhil/gpdb,atris/gpdb,xuegang/gpdb,xuegang/gpdb,ovr/postgres-xl,greenplum-db/gpdb,janebeckman/gpdb,edespino/gpdb,lintzc/gpdb,chrishajas/gpdb,tpostgres-projects/tPostgres,zeroae/postgres-xl,royc1/gpdb,jmcatamney/gpdb,tangp3/gpdb,randomtask1155/gpdb,ahachete/gpdb,xuegang/gpdb,edespino/gpdb,xinzweb/gpdb,CraigHarris/gpdb,foyzur/gpdb,janebeckman/gpdb,janebeckman/gpdb,lintzc/gpdb,techdragon/Postgres-XL,Quikling/gpdb,snaga/postgres-xl,cjcjameson/gpdb,0x0FFF/gpdb,Chibin/gpdb,ovr/postgres-xl,yuanzhao/gpdb,lpetrov-pivotal/gpdb,lpetrov-pivotal/gpdb,tangp3/gpdb,tangp3/gpdb,0x0FFF/gpdb,edespino/gpdb,greenplum-db/gpdb,snaga/postgres-xl,edespino/gpdb,adam8157/gpdb,ashwinstar/gpdb,Quikling/gpdb,chrishajas/gpdb,foyzur/gpdb,lisakowen/gpdb,0x0FFF/gpdb,CraigHarris/gpdb,atris/gpdb,oberstet/postgres-xl,CraigHarris/gpdb,rubikloud/gpdb,kaknikhil/gpdb,atris/gpdb,CraigHarris/gpdb,cjcjameson/gpdb,kmjungersen/PostgresXL,randomtask1155/gpdb,kaknikhil/gpdb,foyzur/gpdb,Quikling/gpdb,edespino/gpdb,pavanvd/postgres-xl,CraigHarris/gpdb,xinzweb/gpdb,jmcatamney/gpdb,tangp3/gpdb,tpostgres-projects/tPostgres,50wu/gpdb,chrishajas/gpdb,yuanzhao/gpdb,lpetrov-pivotal/gpdb,rubikloud/gpdb,foyzur/gpdb,kaknikhil/gpdb,edespino/gpdb,lintzc/gpdb,ahachete/gpdb,adam8157/gpdb,50wu/gpdb,lpetrov-pivotal/gpdb