I made it so it rolled over files at 1MB.  My table ended up with 120 segments, and my indexes had 3(Yes, it DOES work!). DROP TABLE removed ALL segments from the table, but only the main index segment.
I made it so it rolled over files at 1MB.  My table ended up with 120
segments, and my indexes had 3(Yes, it DOES work!).
DROP TABLE removed ALL segments from the table, but only the main index
segment.

So it looks like removing the table itself is using mdunlink in md.c,
while removing indexes uses FileNameUnlink() which only unlinks 1 file.
As far as I can tell, calling FileNameUnlink() and mdunlink() is basically
the same, except mdunlink() deletes any extra segments.

I've done some testing and it seems to work.  It also passes regression
tests(except float8, geometry and rules, but that's normal).

If this patch is right, this fixes all known multi-segment problems on
Linux.

Ole Gjerde

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