Hi,

While resuming the work on [1] I noticed that:

- there is an unused parameter in log_heap_visible()
- the comment associated to the function is not in "sync" with the current implementation (referring a "block" that is not involved anymore)

Attached a tiny patch as an attempt to address the above remarks.


[1]: https://commitfest.postgresql.org/39/3740/

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index 75b214824d..7465334a83 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -8188,17 +8188,17 @@ log_heap_freeze(Relation reln, Buffer buffer, 
TransactionId cutoff_xid,
 }
 
 /*
- * Perform XLogInsert for a heap-visible operation.  'block' is the block
- * being marked all-visible, and vm_buffer is the buffer containing the
- * corresponding visibility map block.  Both should have already been modified
- * and dirtied.
+ * Perform XLogInsert for a heap-visible operation. heap_buffer is the buffer
+ * containing the block being marked all-visible, and vm_buffer is the buffer
+ * containing the corresponding visibility map block. Both should have already
+ * been modified and dirtied.
  *
  * If checksums are enabled, we also generate a full-page image of
  * heap_buffer, if necessary.
  */
 XLogRecPtr
-log_heap_visible(RelFileLocator rlocator, Buffer heap_buffer, Buffer vm_buffer,
-                                TransactionId cutoff_xid, uint8 vmflags)
+log_heap_visible(Buffer heap_buffer, Buffer vm_buffer, TransactionId 
cutoff_xid,
+                                uint8 vmflags)
 {
        xl_heap_visible xlrec;
        XLogRecPtr      recptr;
diff --git a/src/backend/access/heap/visibilitymap.c 
b/src/backend/access/heap/visibilitymap.c
index d62761728b..ccc97e3b09 100644
--- a/src/backend/access/heap/visibilitymap.c
+++ b/src/backend/access/heap/visibilitymap.c
@@ -283,8 +283,7 @@ visibilitymap_set(Relation rel, BlockNumber heapBlk, Buffer 
heapBuf,
                        if (XLogRecPtrIsInvalid(recptr))
                        {
                                Assert(!InRecovery);
-                               recptr = log_heap_visible(rel->rd_locator, 
heapBuf, vmBuf,
-                                                                               
  cutoff_xid, flags);
+                               recptr = log_heap_visible(heapBuf, vmBuf, 
cutoff_xid, flags);
 
                                /*
                                 * If data checksums are enabled (or 
wal_log_hints=on), we
diff --git a/src/include/access/heapam_xlog.h b/src/include/access/heapam_xlog.h
index 34220d93cf..4b6bdf6955 100644
--- a/src/include/access/heapam_xlog.h
+++ b/src/include/access/heapam_xlog.h
@@ -415,7 +415,7 @@ extern bool heap_prepare_freeze_tuple(HeapTupleHeader tuple,
                                                                          
MultiXactId *relminmxid_out);
 extern void heap_execute_freeze_tuple(HeapTupleHeader tuple,
                                                                          
xl_heap_freeze_tuple *frz);
-extern XLogRecPtr log_heap_visible(RelFileLocator rlocator, Buffer heap_buffer,
-                                                                  Buffer 
vm_buffer, TransactionId cutoff_xid, uint8 vmflags);
+extern XLogRecPtr log_heap_visible(Buffer heap_buffer, Buffer vm_buffer,
+                                                                  
TransactionId cutoff_xid, uint8 vmflags);
 
 #endif                                                 /* HEAPAM_XLOG_H */

Reply via email to