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

Remove storage manager for AO tables #1104

Draft
wants to merge 1 commit 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
10 changes: 5 additions & 5 deletions src/backend/access/aocs/aocsam_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,7 @@ aoco_relation_set_new_filenode(Relation rel,
*
* Segment files will be created when / if needed.
*/
srel = RelationCreateStorage(*newrnode, persistence, SMGR_AO);
srel = RelationCreateStorage(*newrnode, persistence, SMGR_MD);

/*
* If required, set up an init fork for an unlogged table so that it can
Expand All @@ -1309,7 +1309,7 @@ aoco_relation_set_new_filenode(Relation rel,
rel->rd_rel->relkind == RELKIND_MATVIEW ||
rel->rd_rel->relkind == RELKIND_TOASTVALUE);
smgrcreate(srel, INIT_FORKNUM, false);
log_smgrcreate(newrnode, INIT_FORKNUM, SMGR_AO);
log_smgrcreate(newrnode, INIT_FORKNUM, SMGR_MD);
smgrimmedsync(srel, INIT_FORKNUM);
}

Expand Down Expand Up @@ -1360,7 +1360,7 @@ aoco_relation_copy_data(Relation rel, const RelFileNode *newrnode)
* Use the "AO-specific" (non-shared buffers backed storage) SMGR
* implementation
*/
dstrel = smgropen(*newrnode, rel->rd_backend, SMGR_AO);
dstrel = smgropen(*newrnode, rel->rd_backend, SMGR_MD);
RelationOpenSmgr(rel);

/*
Expand All @@ -1370,7 +1370,7 @@ aoco_relation_copy_data(Relation rel, const RelFileNode *newrnode)
* NOTE: any conflict in relfilenode value will be caught in
* RelationCreateStorage().
*/
RelationCreateStorage(*newrnode, rel->rd_rel->relpersistence, SMGR_AO);
RelationCreateStorage(*newrnode, rel->rd_rel->relpersistence, SMGR_MD);

copy_append_only_data(rel->rd_node, *newrnode, rel->rd_backend, rel->rd_rel->relpersistence);

Expand All @@ -1389,7 +1389,7 @@ aoco_relation_copy_data(Relation rel, const RelFileNode *newrnode)
*/
smgrcreate(dstrel, INIT_FORKNUM, false);

log_smgrcreate(newrnode, INIT_FORKNUM, SMGR_AO);
log_smgrcreate(newrnode, INIT_FORKNUM, SMGR_MD);
}

/* drop old relation, and close new one */
Expand Down
10 changes: 5 additions & 5 deletions src/backend/access/appendonly/appendonlyam_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,7 @@ appendonly_relation_set_new_filenode(Relation rel,
*
* Segment files will be created when / if needed.
*/
srel = RelationCreateStorage(*newrnode, persistence, SMGR_AO);
srel = RelationCreateStorage(*newrnode, persistence, SMGR_MD);

/*
* If required, set up an init fork for an unlogged table so that it can
Expand All @@ -1082,7 +1082,7 @@ appendonly_relation_set_new_filenode(Relation rel,
rel->rd_rel->relkind == RELKIND_MATVIEW ||
rel->rd_rel->relkind == RELKIND_TOASTVALUE);
smgrcreate(srel, INIT_FORKNUM, false);
log_smgrcreate(newrnode, INIT_FORKNUM, SMGR_AO);
log_smgrcreate(newrnode, INIT_FORKNUM, SMGR_MD);
smgrimmedsync(srel, INIT_FORKNUM);
}

Expand Down Expand Up @@ -1124,7 +1124,7 @@ appendonly_relation_copy_data(Relation rel, const RelFileNode *newrnode)
* Use the "AO-specific" (non-shared buffers backed storage) SMGR
* implementation
*/
dstrel = smgropen(*newrnode, rel->rd_backend, SMGR_AO);
dstrel = smgropen(*newrnode, rel->rd_backend, SMGR_MD);
RelationOpenSmgr(rel);

/*
Expand All @@ -1134,7 +1134,7 @@ appendonly_relation_copy_data(Relation rel, const RelFileNode *newrnode)
* NOTE: any conflict in relfilenode value will be caught in
* RelationCreateStorage().
*/
RelationCreateStorage(*newrnode, rel->rd_rel->relpersistence, SMGR_AO);
RelationCreateStorage(*newrnode, rel->rd_rel->relpersistence, SMGR_MD);

copy_append_only_data(rel->rd_node, *newrnode, rel->rd_backend, rel->rd_rel->relpersistence);

Expand All @@ -1153,7 +1153,7 @@ appendonly_relation_copy_data(Relation rel, const RelFileNode *newrnode)
*/
smgrcreate(dstrel, INIT_FORKNUM, false);

log_smgrcreate(newrnode, INIT_FORKNUM, SMGR_AO);
log_smgrcreate(newrnode, INIT_FORKNUM, SMGR_MD);
}

/* drop old relation, and close new one */
Expand Down
3 changes: 1 addition & 2 deletions src/backend/catalog/storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,7 @@ RelationDropStorage(Relation rel)
pending->relnode.isTempRelation = rel->rd_backend == TempRelBackendId;
pending->atCommit = true; /* delete if commit */
pending->nestLevel = GetCurrentTransactionNestLevel();
pending->relnode.smgr_which =
RelationIsAppendOptimized(rel) ? SMGR_AO : SMGR_MD;
pending->relnode.smgr_which = SMGR_MD;
pending->next = pendingDeletes;
pendingDeletes = pending;

Expand Down
2 changes: 1 addition & 1 deletion src/backend/commands/tablecmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -15834,7 +15834,7 @@ index_copy_data(Relation rel, RelFileNode newrnode)
{
SMgrRelation dstrel;

SMgrImpl smgr_which = RelationIsAppendOptimized(rel) ? SMGR_AO : SMGR_MD;
SMgrImpl smgr_which = SMGR_MD;

dstrel = smgropen(newrnode, rel->rd_backend, smgr_which);

Expand Down
25 changes: 1 addition & 24 deletions src/backend/storage/smgr/smgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,29 +62,6 @@ static const f_smgr smgrsw[] = {
.smgr_nblocks = mdnblocks,
.smgr_truncate = mdtruncate,
.smgr_immedsync = mdimmedsync,
},
/*
* Relation files that are different from heap, characterised by:
* 1. variable blocksize
* 2. block numbers are not consecutive
* 3. shared buffers are not used
* Append-optimized relation files currently fall in this category.
*/
{
.smgr_init = NULL,
.smgr_shutdown = NULL,
.smgr_close = mdclose,
.smgr_create = mdcreate,
.smgr_exists = mdexists,
.smgr_unlink = mdunlink_ao,
.smgr_extend = mdextend,
.smgr_prefetch = mdprefetch,
.smgr_read = mdread,
.smgr_write = mdwrite,
.smgr_writeback = mdwriteback,
.smgr_nblocks = mdnblocks,
.smgr_truncate = mdtruncate,
.smgr_immedsync = mdimmedsync,
}
};

Expand Down Expand Up @@ -167,7 +144,7 @@ const f_smgr *
smgr_standard(BackendId backend, RelFileNode rnode, SMgrImpl which)
{
// for md.c
return &smgrsw[which];
return &smgrsw[0];
}

const f_smgr *
Expand Down
3 changes: 1 addition & 2 deletions src/include/storage/smgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@

typedef enum SMgrImplementation
{
SMGR_MD = 0,
SMGR_AO = 1
SMGR_MD = 0
} SMgrImpl;


Expand Down
2 changes: 1 addition & 1 deletion src/include/utils/rel.h
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ typedef struct ViewOptions
smgrsetowner(&((relation)->rd_smgr), \
smgropen((relation)->rd_node, \
(relation)->rd_backend, \
RelationStorageIsAO(relation)?SMGR_AO:SMGR_MD)); \
SMGR_MD)); \
} while (0)

/*
Expand Down
Loading