I have fixed all these items in the attached, thanks -- most user-visible change was the pageinspect 1.3 thingy. pg_upgrade from 1.2 works fine now. I also fixed some things Heikki noted, mainly avoid retail pfree where possible, and renumber the support procs to leave room for future expansion of the framework. XLog replay code is updated too.
Also, I made the summarization step callable directly from SQL without having to invoke VACUUM.
So here's v21. I also attach a partial diff from v20, just in case anyone wants to give it a look.
I get a couple compiler warnings with this:
brin.c: In function 'brininsert':
brin.c:97: warning: 'tupcxt' may be used uninitialized in this function
brin.c:98: warning: 'oldcxt' may be used uninitialized in this function
Also, I think it is missing a cat version bump. It let me start the patched server against an unpatched initdb run, but once started it didn't find the index method.
What would it take to make CLUSTER work on a brin index? Now I just added a btree index on the same column, clustered on that, then dropped that index.