Move syncscan.c to src/backend/access/common.
authorThomas Munro <tmunro@postgresql.org>
Wed, 29 Jul 2020 04:46:58 +0000 (16:46 +1200)
committerThomas Munro <tmunro@postgresql.org>
Wed, 29 Jul 2020 04:59:33 +0000 (16:59 +1200)
Since the tableam.c code needs to make use of the syncscan.c routines
itself, and since other block-oriented AMs might also want to use it one
day, it didn't make sense for it to live under src/backend/access/heap.

Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/CA%2BhUKGLCnG%3DNEAByg6bk%2BCT9JZD97Y%3DAxKhh27Su9FeGWOKvDg%40mail.gmail.com

src/backend/access/common/Makefile
src/backend/access/common/syncscan.c [moved from src/backend/access/heap/syncscan.c with 98% similarity]
src/backend/access/heap/Makefile
src/backend/access/heap/heapam.c
src/backend/access/heap/heapam_handler.c
src/backend/access/table/tableam.c
src/backend/storage/ipc/ipci.c
src/include/access/heapam.h
src/include/access/syncscan.h [new file with mode: 0644]

index fd74e14024c307d6a3db040741b8bfa3c9ffe3eb..5a007d63f1a95d058526cf9175a7830138cc4f83 100644 (file)
@@ -24,6 +24,7 @@ OBJS = \
        reloptions.o \
        scankey.o \
        session.o \
+       syncscan.o \
        toast_internals.o \
        tupconvert.o \
        tupdesc.o
similarity index 98%
rename from src/backend/access/heap/syncscan.c
rename to src/backend/access/common/syncscan.c
index a32f6836f80c4847ccaa52abd7535e1197911224..c1ce156902bef983d1f9cb4c9bff420178fc3929 100644 (file)
@@ -1,7 +1,7 @@
 /*-------------------------------------------------------------------------
  *
  * syncscan.c
- *       heap scan synchronization support
+ *       scan synchronization support
  *
  * When multiple backends run a sequential scan on the same table, we try
  * to keep them synchronized to reduce the overall I/O needed.  The goal is
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       src/backend/access/heap/syncscan.c
+ *       src/backend/access/common/syncscan.c
  *
  *-------------------------------------------------------------------------
  */
 #include "postgres.h"
 
-#include "access/heapam.h"
+#include "access/syncscan.h"
 #include "miscadmin.h"
 #include "storage/lwlock.h"
 #include "storage/shmem.h"
index 51a7f5e0d01e915e08f4b39e1e2e595c7566c2e1..af0bd1888e53ffd6d250c47c53c289f07fbb0b8c 100644 (file)
@@ -20,7 +20,6 @@ OBJS = \
        hio.o \
        pruneheap.o \
        rewriteheap.o \
-       syncscan.o \
        vacuumlazy.o \
        visibilitymap.o
 
index 2c9bb0c7ee2484a59296bfe361273fc31c39d049..8df2716de46cccb6c0cb2157d83d87e74dfe9064 100644 (file)
@@ -41,6 +41,7 @@
 #include "access/parallel.h"
 #include "access/relscan.h"
 #include "access/subtrans.h"
+#include "access/syncscan.h"
 #include "access/sysattr.h"
 #include "access/tableam.h"
 #include "access/transam.h"
index 8f2e5379210ca328d6e3f0c18bdd0d87be3b112f..267a6ee25a759e07f7bf5d7d004a1374288044a9 100644 (file)
@@ -24,6 +24,7 @@
 #include "access/heaptoast.h"
 #include "access/multixact.h"
 #include "access/rewriteheap.h"
+#include "access/syncscan.h"
 #include "access/tableam.h"
 #include "access/tsmapi.h"
 #include "access/xact.h"
index 4e8553de2afc53500b8d110cb02dd7563d9c3063..3afb63b1fe4db946a798b961be224835d59c47b6 100644 (file)
@@ -21,7 +21,7 @@
 
 #include <math.h>
 
-#include "access/heapam.h"             /* for ss_* */
+#include "access/syncscan.h"
 #include "access/tableam.h"
 #include "access/xact.h"
 #include "optimizer/plancat.h"
index 427b0d59cde2cc02e2aa48ff45186f858cfe038b..e850ebd131e3f81f2422aaf4bc7ee1deb060766d 100644 (file)
@@ -20,6 +20,7 @@
 #include "access/multixact.h"
 #include "access/nbtree.h"
 #include "access/subtrans.h"
+#include "access/syncscan.h"
 #include "access/twophase.h"
 #include "commands/async.h"
 #include "miscadmin.h"
index f279edc47347fd665744aea51dab5eba3cce5915..b31de389106d899a91771eaddc777ee439b0fab5 100644 (file)
@@ -182,12 +182,6 @@ extern void heap_page_prune_execute(Buffer buffer,
                                                                        OffsetNumber *nowunused, int nunused);
 extern void heap_get_root_tuples(Page page, OffsetNumber *root_offsets);
 
-/* in heap/syncscan.c */
-extern void ss_report_location(Relation rel, BlockNumber location);
-extern BlockNumber ss_get_location(Relation rel, BlockNumber relnblocks);
-extern void SyncScanShmemInit(void);
-extern Size SyncScanShmemSize(void);
-
 /* in heap/vacuumlazy.c */
 struct VacuumParams;
 extern void heap_vacuum_rel(Relation onerel,
diff --git a/src/include/access/syncscan.h b/src/include/access/syncscan.h
new file mode 100644 (file)
index 0000000..7cbf63c
--- /dev/null
@@ -0,0 +1,25 @@
+/*-------------------------------------------------------------------------
+ *
+ * syncscan.h
+ *    POSTGRES synchronous scan support functions.
+ *
+ *
+ * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/access/syncscan.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef SYNCSCAN_H
+#define SYNCSCAN_H
+
+#include "storage/block.h"
+#include "utils/relcache.h"
+
+extern void ss_report_location(Relation rel, BlockNumber location);
+extern BlockNumber ss_get_location(Relation rel, BlockNumber relnblocks);
+extern void SyncScanShmemInit(void);
+extern Size SyncScanShmemSize(void);
+
+#endif