Attached patch removes xl_heap_lock_updated/XLOG_HEAP2_LOCK_UPDATED, which allows us to throw out about a hundred lines of duplicative (though hairy) code, net total. The patch also reclaims some Heap2 info bit space, which seems quite useful.
The patch teaches heap_lock_updated_tuple_rec() to make use of the generic xl_heap_lock/XLOG_HEAP_LOCK record type, rather than using the now-removed custom record type. My guess is that commit 0ac5ad5134 (where xl_heap_lock_updated originated) simply missed the opportunity to consolidate the two records into one, perhaps because the patch evolved a lot during development. Note that xl_heap_lock is already used by several heapam routines besides heap_lock_tuple (e.g. heap_update uses it). Testing with wal_consistency_checking did not demonstrate any problems with the patch. It's not completely trivial, though. It seems that there are steps in the REDO routines that shouldn't be performed in the locked-updated-tuple case -- I had to invent XLH_LOCK_UPDATED to deal with the issue. There may be a better approach there, but I haven't thought about it in enough detail to feel confident either way. -- Peter Geoghegan
v1-0001-Remove-xl_heap_lock_updated-WAL-record.patch
Description: Binary data