> I would also like to see the visibilitymap_test function exposed in SQL, > so we can write code to examine the map contents for particular ctids. > By doing that we can then write a formal test that shows the evolution of tuples from insertion, > vacuuming and freezing, testing the map has been set correctly at each stage. > I guess that needs to be done as an isolationtest so we have an observer that contrains the xmin in various ways. > In light of multixact bugs, any code that changes the on-disk tuple metadata needs formal tests.
Attached patch adds a few function to contrib/pg_freespacemap to explore the inside of visibility map, which I used for my test. I hope it helps for testing this feature.
I don't think pg_freespacemap is the right place.
I'd prefer to add that as a single function into core, so we can write formal tests. I would not personally commit this feature without rigorous and easily repeatable verification.
--
Simon Riggs http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services