Tweak mdnblocks() to avoid doing lseek() on segments that it has previously determined not to be the last segment of a relation. This reduces the expected cost to one seek, rather than one seek per segment.  We can get away with this because truncation of a relation will cause a relcache flush and so the md.c file descriptor will be closed; when it is re-opened we will re-determine the last segment.
Tweak mdnblocks() to avoid doing lseek() on segments that it has
previously determined not to be the last segment of a relation.
This reduces the expected cost to one seek, rather than one seek per
segment.  We can get away with this because truncation of a relation
will cause a relcache flush and so the md.c file descriptor will be
closed; when it is re-opened we will re-determine the last segment.

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