Skip to content

Commit cb04ad4

Browse files
committed
Move syncscan.c to src/backend/access/common.
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
1 parent c49c74d commit cb04ad4

File tree

9 files changed

+33
-11
lines changed

9 files changed

+33
-11
lines changed

src/backend/access/common/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ OBJS = \
2424
reloptions.o \
2525
scankey.o \
2626
session.o \
27+
syncscan.o \
2728
toast_internals.o \
2829
tupconvert.o \
2930
tupdesc.o

src/backend/access/heap/syncscan.c renamed to src/backend/access/common/syncscan.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*-------------------------------------------------------------------------
22
*
33
* syncscan.c
4-
* heap scan synchronization support
4+
* scan synchronization support
55
*
66
* When multiple backends run a sequential scan on the same table, we try
77
* to keep them synchronized to reduce the overall I/O needed. The goal is
@@ -40,13 +40,13 @@
4040
* Portions Copyright (c) 1994, Regents of the University of California
4141
*
4242
* IDENTIFICATION
43-
* src/backend/access/heap/syncscan.c
43+
* src/backend/access/common/syncscan.c
4444
*
4545
*-------------------------------------------------------------------------
4646
*/
4747
#include "postgres.h"
4848

49-
#include "access/heapam.h"
49+
#include "access/syncscan.h"
5050
#include "miscadmin.h"
5151
#include "storage/lwlock.h"
5252
#include "storage/shmem.h"

src/backend/access/heap/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ OBJS = \
2020
hio.o \
2121
pruneheap.o \
2222
rewriteheap.o \
23-
syncscan.o \
2423
vacuumlazy.o \
2524
visibilitymap.o
2625

src/backend/access/heap/heapam.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include "access/parallel.h"
4242
#include "access/relscan.h"
4343
#include "access/subtrans.h"
44+
#include "access/syncscan.h"
4445
#include "access/sysattr.h"
4546
#include "access/tableam.h"
4647
#include "access/transam.h"

src/backend/access/heap/heapam_handler.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "access/heaptoast.h"
2525
#include "access/multixact.h"
2626
#include "access/rewriteheap.h"
27+
#include "access/syncscan.h"
2728
#include "access/tableam.h"
2829
#include "access/tsmapi.h"
2930
#include "access/xact.h"

src/backend/access/table/tableam.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
#include <math.h>
2323

24-
#include "access/heapam.h" /* for ss_* */
24+
#include "access/syncscan.h"
2525
#include "access/tableam.h"
2626
#include "access/xact.h"
2727
#include "optimizer/plancat.h"

src/backend/storage/ipc/ipci.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "access/multixact.h"
2121
#include "access/nbtree.h"
2222
#include "access/subtrans.h"
23+
#include "access/syncscan.h"
2324
#include "access/twophase.h"
2425
#include "commands/async.h"
2526
#include "miscadmin.h"

src/include/access/heapam.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,6 @@ extern void heap_page_prune_execute(Buffer buffer,
182182
OffsetNumber *nowunused, int nunused);
183183
extern void heap_get_root_tuples(Page page, OffsetNumber *root_offsets);
184184

185-
/* in heap/syncscan.c */
186-
extern void ss_report_location(Relation rel, BlockNumber location);
187-
extern BlockNumber ss_get_location(Relation rel, BlockNumber relnblocks);
188-
extern void SyncScanShmemInit(void);
189-
extern Size SyncScanShmemSize(void);
190-
191185
/* in heap/vacuumlazy.c */
192186
struct VacuumParams;
193187
extern void heap_vacuum_rel(Relation onerel,

src/include/access/syncscan.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* syncscan.h
4+
* POSTGRES synchronous scan support functions.
5+
*
6+
*
7+
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
8+
* Portions Copyright (c) 1994, Regents of the University of California
9+
*
10+
* src/include/access/syncscan.h
11+
*
12+
*-------------------------------------------------------------------------
13+
*/
14+
#ifndef SYNCSCAN_H
15+
#define SYNCSCAN_H
16+
17+
#include "storage/block.h"
18+
#include "utils/relcache.h"
19+
20+
extern void ss_report_location(Relation rel, BlockNumber location);
21+
extern BlockNumber ss_get_location(Relation rel, BlockNumber relnblocks);
22+
extern void SyncScanShmemInit(void);
23+
extern Size SyncScanShmemSize(void);
24+
25+
#endif

0 commit comments

Comments
 (0)