Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move vacuum_ao.c to src/backend/access/appendonly #1096

Draft
wants to merge 2 commits into
base: adb-7.2.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions src/backend/access/aocs/aocsam_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/
#include "postgres.h"

#include "../appendonly/appendonly_vacuum.h"
#include "access/aomd.h"
#include "access/appendonlywriter.h"
#include "access/heapam.h"
Expand Down Expand Up @@ -1397,21 +1398,6 @@ aoco_relation_copy_data(Relation rel, const RelFileNode *newrnode)
smgrclose(dstrel);
}

static void
aoco_vacuum_rel(Relation onerel, VacuumParams *params,
BufferAccessStrategy bstrategy)
{
/*
* We VACUUM an AO_COLUMN table through multiple phases. vacuum_rel()
* orchestrates the phases and calls itself again for each phase, so we
* get here for every phase. ao_vacuum_rel() is a wrapper of dedicated
* ao_vacuum_rel_*() functions for the specific phases.
*/
ao_vacuum_rel(onerel, params, bstrategy);

return;
}

static void
aoco_relation_add_columns(Relation rel, List *newvals, List *constraints, TupleDesc oldDesc)
{
Expand Down Expand Up @@ -2811,7 +2797,7 @@ static const TableAmRoutine ao_column_methods = {
.relation_copy_for_cluster = aoco_relation_copy_for_cluster,
.relation_add_columns = aoco_relation_add_columns,
.relation_rewrite_columns = aoco_relation_rewrite_columns,
.relation_vacuum = aoco_vacuum_rel,
.relation_vacuum = ao_vacuum_rel,
.scan_analyze_next_block = aoco_scan_analyze_next_block,
.scan_analyze_next_tuple = aoco_scan_analyze_next_tuple,
.relation_acquire_sample_rows = aoco_acquire_sample_rows,
Expand Down
2 changes: 1 addition & 1 deletion src/backend/access/appendonly/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ OBJS = appendonlyam_handler.o appendonlyam.o aosegfiles.o aomd.o \
appendonlyblockdirectory.o appendonly_visimap.o \
appendonly_visimap_entry.o appendonly_visimap_store.o \
appendonly_compaction.o appendonly_visimap_udf.o \
appendonly_blkdir_udf.o aomd_filehandler.o
appendonly_blkdir_udf.o aomd_filehandler.o appendonly_vacuum.o

include $(top_srcdir)/src/backend/common.mk

Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
#include "access/multixact.h"
#include "access/visibilitymap.h"
#include "access/xact.h"
#include "appendonly_vacuum.h"
#include "catalog/pg_appendonly.h"
#include "cdb/cdbappendonlyam.h"
#include "cdb/cdbtm.h"
Expand Down Expand Up @@ -163,6 +164,7 @@ static void ao_vacuum_rel_recycle_dead_segments(Relation onerel, VacuumParams *p
BufferAccessStrategy bstrategy, AOVacuumRelStats *vacrelstats);
static AOVacuumRelStats *init_vacrelstats(void);
static void cleanup_vacrelstats(AOVacuumRelStats **vacrelstatsp);
static void scan_index(Relation indrel, Relation aorel, int elevel, BufferAccessStrategy vac_strategy);

static void
ao_vacuum_rel_pre_cleanup(Relation onerel, VacuumParams *params, BufferAccessStrategy bstrategy, AOVacuumRelStats *vacrelstats)
Expand Down Expand Up @@ -781,7 +783,7 @@ cleanup_vacrelstats(AOVacuumRelStats **vacrelstats)
*
* We use this when we have no deletions to do.
*/
void
static void
scan_index(Relation indrel, Relation aorel, int elevel, BufferAccessStrategy vac_strategy)
{
IndexBulkDeleteResult *stats;
Expand Down
10 changes: 10 additions & 0 deletions src/backend/access/appendonly/appendonly_vacuum.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef APPENDONLY_VACUUM_H
#define APPENDONLY_VACUUM_H

#include <commands/vacuum.h>
#include <utils/relcache.h>
#include <storage/buf.h>

void ao_vacuum_rel(Relation rel, VacuumParams *params, BufferAccessStrategy bstrategy);

#endif /* APPENDONLY_VACUUM_H */
18 changes: 2 additions & 16 deletions src/backend/access/appendonly/appendonlyam_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "access/tsmapi.h"
#include "access/tuptoaster.h"
#include "access/xact.h"
#include "appendonly_vacuum.h"
#include "catalog/aoseg.h"
#include "catalog/catalog.h"
#include "catalog/heap.h"
Expand Down Expand Up @@ -1161,21 +1162,6 @@ appendonly_relation_copy_data(Relation rel, const RelFileNode *newrnode)
smgrclose(dstrel);
}

static void
appendonly_vacuum_rel(Relation onerel, VacuumParams *params,
BufferAccessStrategy bstrategy)
{
/*
* We VACUUM an AO_ROW table through multiple phases. vacuum_rel()
* orchestrates the phases and calls itself again for each phase, so we
* get here for every phase. ao_vacuum_rel() is a wrapper of dedicated
* ao_vacuum_rel_*() functions for the specific phases.
*/
ao_vacuum_rel(onerel, params, bstrategy);

return;
}

static void
appendonly_relation_add_columns(Relation rel, List *newvals, List *constraints, TupleDesc oldDesc)
{
Expand Down Expand Up @@ -2455,7 +2441,7 @@ static const TableAmRoutine ao_row_methods = {
.relation_copy_for_cluster = appendonly_relation_copy_for_cluster,
.relation_add_columns = appendonly_relation_add_columns,
.relation_rewrite_columns = appendonly_relation_rewrite_columns,
.relation_vacuum = appendonly_vacuum_rel,
.relation_vacuum = ao_vacuum_rel,
.scan_analyze_next_block = appendonly_scan_analyze_next_block,
.scan_analyze_next_tuple = appendonly_scan_analyze_next_tuple,
.relation_acquire_sample_rows = appendonly_acquire_sample_rows,
Expand Down
2 changes: 1 addition & 1 deletion src/backend/commands/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ OBJS = amcmds.o aggregatecmds.o alter.o analyze.o async.o cluster.o comment.o \
vacuum.o variable.o view.o

OBJS += analyzefuncs.o analyzeutils.o extprotocolcmds.o exttablecmds.o queue.o
OBJS += resgroupcmds.o tablecmds_gp.o vacuum_ao.o
OBJS += resgroupcmds.o tablecmds_gp.o

include $(top_srcdir)/src/backend/common.mk
4 changes: 0 additions & 4 deletions src/include/commands/vacuum.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,6 @@ extern int gp_acquire_sample_rows_func(Relation onerel, int elevel,
/* in commands/vacuumlazy.c */
extern void lazy_vacuum_rel_heap(Relation onerel,
VacuumParams *params, BufferAccessStrategy bstrategy);
extern void scan_index(Relation indrel, Relation aorel, int elevel, BufferAccessStrategy bstrategy);

/* in commands/vacuum_ao.c */
extern void ao_vacuum_rel(Relation rel, VacuumParams *params, BufferAccessStrategy bstrategy);

extern bool std_typanalyze(VacAttrStats *stats);

Expand Down
Loading