After some debugging I found that vac_truncate_clog consumes xid just to produce warning. I wrote simple patch which replaces GetCurrentTransactionId() with ShmemVariableCache->nextXid. That completely fixes this situation for me: ShmemVariableCache was successfully updated.
I found that direct reading of ShmemVariableCache->nextXid is not corrent, it's better to use ReadNewTransactionId() then. Fixed version of patch is attached.
------ Alexander Korotkov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company