Move vacuumlazy.c into access/heap.
authorAndres Freund <[email protected]>
Tue, 15 Jan 2019 20:06:19 +0000 (12:06 -0800)
committerAndres Freund <[email protected]>
Tue, 15 Jan 2019 20:06:19 +0000 (12:06 -0800)
It's heap table storage specific code that can't realistically be
generalized into table AM agnostic code.

Author: Andres Freund
Discussion: https://postgr.es/m/20180703070645[email protected]

src/backend/access/heap/Makefile
src/backend/access/heap/vacuumlazy.c [moved from src/backend/commands/vacuumlazy.c with 99% similarity]
src/backend/commands/Makefile
src/backend/commands/vacuum.c
src/include/access/heapam.h
src/include/commands/vacuum.h

index b83d496bcd73e73ad775c40f8fa9c9342f391243..7e7324a9166f330f2d87c44f27d6890f86ad2cdb 100644 (file)
@@ -12,6 +12,7 @@ subdir = src/backend/access/heap
 top_builddir = ../../../..
 include $(top_builddir)/src/Makefile.global
 
-OBJS = heapam.o hio.o pruneheap.o rewriteheap.o syncscan.o tuptoaster.o visibilitymap.o
+OBJS = heapam.o hio.o pruneheap.o rewriteheap.o syncscan.o tuptoaster.o \
+       vacuumlazy.o visibilitymap.o
 
 include $(top_srcdir)/src/backend/common.mk
similarity index 99%
rename from src/backend/commands/vacuumlazy.c
rename to src/backend/access/heap/vacuumlazy.c
index b67267fbab5d33ca712c29c04bc51e5863a5b4a7..2d317a94620845413ef3aa777cfccc43b36c066b 100644 (file)
@@ -28,7 +28,7 @@
  *
  *
  * IDENTIFICATION
- *       src/backend/commands/vacuumlazy.c
+ *       src/backend/access/heap/vacuumlazy.c
  *
  *-------------------------------------------------------------------------
  */
@@ -178,7 +178,7 @@ static bool heap_page_is_all_visible(Relation rel, Buffer buf,
 
 
 /*
- *     lazy_vacuum_rel() -- perform LAZY VACUUM for one heap relation
+ *     vacuum_heap_rel() -- perform VACUUM for one heap relation
  *
  *             This routine vacuums a single heap, cleans out its indexes, and
  *             updates its relpages and reltuples statistics.
@@ -187,7 +187,7 @@ static bool heap_page_is_all_visible(Relation rel, Buffer buf,
  *             and locked the relation.
  */
 void
-lazy_vacuum_rel(Relation onerel, int options, VacuumParams *params,
+heap_vacuum_rel(Relation onerel, int options, VacuumParams *params,
                                BufferAccessStrategy bstrategy)
 {
        LVRelStats *vacrelstats;
index 4a6c99e09081a533f099d5f175f0806048b6ae9c..d64628566d361af728b629c5ca4492e53cec0321 100644 (file)
@@ -20,6 +20,6 @@ OBJS = amcmds.o aggregatecmds.o alter.o analyze.o async.o cluster.o comment.o \
        policy.o portalcmds.o prepare.o proclang.o publicationcmds.o \
        schemacmds.o seclabel.o sequence.o statscmds.o subscriptioncmds.o \
        tablecmds.o tablespace.o trigger.o tsearchcmds.o typecmds.o user.o \
-       vacuum.o vacuumlazy.o variable.o view.o
+       vacuum.o variable.o view.o
 
 include $(top_srcdir)/src/backend/common.mk
index ff1e178bc34c7b9936e766f33957be63fa78c186..c4522cdc080fce515225f46f127b2d29663495e9 100644 (file)
@@ -1711,7 +1711,7 @@ vacuum_rel(Oid relid, RangeVar *relation, int options, VacuumParams *params)
                cluster_rel(relid, InvalidOid, cluster_options);
        }
        else
-               lazy_vacuum_rel(onerel, options, params, vac_strategy);
+               heap_vacuum_rel(onerel, options, params, vac_strategy);
 
        /* Roll back any GUC changes executed by index functions */
        AtEOXact_GUC(false, save_nestlevel);
index cf2ac151241f701efbfb0117de61cb093128bee4..4b7815033054bd0a0f03f7605459591e6476e22b 100644 (file)
@@ -186,4 +186,8 @@ 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, int options,
+                               struct VacuumParams *params, BufferAccessStrategy bstrategy);
 #endif                                                 /* HEAPAM_H */
index 0588139b25d885f5dbca3f5e7406b6f2cb22747c..0a051ec06e2badcc157663da7564c96a4b848af2 100644 (file)
@@ -196,10 +196,6 @@ extern bool vacuum_is_relation_owner(Oid relid, Form_pg_class reltuple,
 extern Relation vacuum_open_relation(Oid relid, RangeVar *relation,
                                         VacuumParams *params, int options, LOCKMODE lmode);
 
-/* in commands/vacuumlazy.c */
-extern void lazy_vacuum_rel(Relation onerel, int options,
-                               VacuumParams *params, BufferAccessStrategy bstrategy);
-
 /* in commands/analyze.c */
 extern void analyze_rel(Oid relid, RangeVar *relation, int options,
                        VacuumParams *params, List *va_cols, bool in_outer_xact,