Skip to content

Commit 1577b46

Browse files
committed
Split out rmgr rm_desc functions into their own files
This is necessary (but not sufficient) to have them compilable outside of a backend environment.
1 parent dd7353d commit 1577b46

40 files changed

+1346
-1015
lines changed

src/backend/access/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ subdir = src/backend/access
88
top_builddir = ../../..
99
include $(top_builddir)/src/Makefile.global
1010

11-
SUBDIRS = common gist hash heap index nbtree transam gin spgist
11+
SUBDIRS = common gin gist hash heap index nbtree rmgrdesc spgist transam
1212

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

src/backend/access/gin/ginxlog.c

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -766,69 +766,6 @@ gin_redo(XLogRecPtr lsn, XLogRecord *record)
766766
MemoryContextReset(opCtx);
767767
}
768768

769-
static void
770-
desc_node(StringInfo buf, RelFileNode node, BlockNumber blkno)
771-
{
772-
appendStringInfo(buf, "node: %u/%u/%u blkno: %u",
773-
node.spcNode, node.dbNode, node.relNode, blkno);
774-
}
775-
776-
void
777-
gin_desc(StringInfo buf, uint8 xl_info, char *rec)
778-
{
779-
uint8 info = xl_info & ~XLR_INFO_MASK;
780-
781-
switch (info)
782-
{
783-
case XLOG_GIN_CREATE_INDEX:
784-
appendStringInfo(buf, "Create index, ");
785-
desc_node(buf, *(RelFileNode *) rec, GIN_ROOT_BLKNO);
786-
break;
787-
case XLOG_GIN_CREATE_PTREE:
788-
appendStringInfo(buf, "Create posting tree, ");
789-
desc_node(buf, ((ginxlogCreatePostingTree *) rec)->node, ((ginxlogCreatePostingTree *) rec)->blkno);
790-
break;
791-
case XLOG_GIN_INSERT:
792-
appendStringInfo(buf, "Insert item, ");
793-
desc_node(buf, ((ginxlogInsert *) rec)->node, ((ginxlogInsert *) rec)->blkno);
794-
appendStringInfo(buf, " offset: %u nitem: %u isdata: %c isleaf %c isdelete %c updateBlkno:%u",
795-
((ginxlogInsert *) rec)->offset,
796-
((ginxlogInsert *) rec)->nitem,
797-
(((ginxlogInsert *) rec)->isData) ? 'T' : 'F',
798-
(((ginxlogInsert *) rec)->isLeaf) ? 'T' : 'F',
799-
(((ginxlogInsert *) rec)->isDelete) ? 'T' : 'F',
800-
((ginxlogInsert *) rec)->updateBlkno);
801-
break;
802-
case XLOG_GIN_SPLIT:
803-
appendStringInfo(buf, "Page split, ");
804-
desc_node(buf, ((ginxlogSplit *) rec)->node, ((ginxlogSplit *) rec)->lblkno);
805-
appendStringInfo(buf, " isrootsplit: %c", (((ginxlogSplit *) rec)->isRootSplit) ? 'T' : 'F');
806-
break;
807-
case XLOG_GIN_VACUUM_PAGE:
808-
appendStringInfo(buf, "Vacuum page, ");
809-
desc_node(buf, ((ginxlogVacuumPage *) rec)->node, ((ginxlogVacuumPage *) rec)->blkno);
810-
break;
811-
case XLOG_GIN_DELETE_PAGE:
812-
appendStringInfo(buf, "Delete page, ");
813-
desc_node(buf, ((ginxlogDeletePage *) rec)->node, ((ginxlogDeletePage *) rec)->blkno);
814-
break;
815-
case XLOG_GIN_UPDATE_META_PAGE:
816-
appendStringInfo(buf, "Update metapage, ");
817-
desc_node(buf, ((ginxlogUpdateMeta *) rec)->node, GIN_METAPAGE_BLKNO);
818-
break;
819-
case XLOG_GIN_INSERT_LISTPAGE:
820-
appendStringInfo(buf, "Insert new list page, ");
821-
desc_node(buf, ((ginxlogInsertListPage *) rec)->node, ((ginxlogInsertListPage *) rec)->blkno);
822-
break;
823-
case XLOG_GIN_DELETE_LISTPAGE:
824-
appendStringInfo(buf, "Delete list pages (%d), ", ((ginxlogDeleteListPages *) rec)->ndeleted);
825-
desc_node(buf, ((ginxlogDeleteListPages *) rec)->node, GIN_METAPAGE_BLKNO);
826-
break;
827-
default:
828-
elog(PANIC, "gin_desc: unknown op code %u", info);
829-
}
830-
}
831-
832769
void
833770
gin_xlog_startup(void)
834771
{

src/backend/access/gist/gistxlog.c

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -362,55 +362,6 @@ gist_redo(XLogRecPtr lsn, XLogRecord *record)
362362
MemoryContextReset(opCtx);
363363
}
364364

365-
static void
366-
out_target(StringInfo buf, RelFileNode node)
367-
{
368-
appendStringInfo(buf, "rel %u/%u/%u",
369-
node.spcNode, node.dbNode, node.relNode);
370-
}
371-
372-
static void
373-
out_gistxlogPageUpdate(StringInfo buf, gistxlogPageUpdate *xlrec)
374-
{
375-
out_target(buf, xlrec->node);
376-
appendStringInfo(buf, "; block number %u", xlrec->blkno);
377-
}
378-
379-
static void
380-
out_gistxlogPageSplit(StringInfo buf, gistxlogPageSplit *xlrec)
381-
{
382-
appendStringInfo(buf, "page_split: ");
383-
out_target(buf, xlrec->node);
384-
appendStringInfo(buf, "; block number %u splits to %d pages",
385-
xlrec->origblkno, xlrec->npage);
386-
}
387-
388-
void
389-
gist_desc(StringInfo buf, uint8 xl_info, char *rec)
390-
{
391-
uint8 info = xl_info & ~XLR_INFO_MASK;
392-
393-
switch (info)
394-
{
395-
case XLOG_GIST_PAGE_UPDATE:
396-
appendStringInfo(buf, "page_update: ");
397-
out_gistxlogPageUpdate(buf, (gistxlogPageUpdate *) rec);
398-
break;
399-
case XLOG_GIST_PAGE_SPLIT:
400-
out_gistxlogPageSplit(buf, (gistxlogPageSplit *) rec);
401-
break;
402-
case XLOG_GIST_CREATE_INDEX:
403-
appendStringInfo(buf, "create_index: rel %u/%u/%u",
404-
((RelFileNode *) rec)->spcNode,
405-
((RelFileNode *) rec)->dbNode,
406-
((RelFileNode *) rec)->relNode);
407-
break;
408-
default:
409-
appendStringInfo(buf, "unknown gist op code %u", info);
410-
break;
411-
}
412-
}
413-
414365
void
415366
gist_xlog_startup(void)
416367
{

src/backend/access/hash/hash.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -712,8 +712,3 @@ hash_redo(XLogRecPtr lsn, XLogRecord *record)
712712
{
713713
elog(PANIC, "hash_redo: unimplemented");
714714
}
715-
716-
void
717-
hash_desc(StringInfo buf, uint8 xl_info, char *rec)
718-
{
719-
}

src/backend/access/heap/heapam.c

Lines changed: 0 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -5678,154 +5678,6 @@ heap2_redo(XLogRecPtr lsn, XLogRecord *record)
56785678
}
56795679
}
56805680

5681-
static void
5682-
out_target(StringInfo buf, xl_heaptid *target)
5683-
{
5684-
appendStringInfo(buf, "rel %u/%u/%u; tid %u/%u",
5685-
target->node.spcNode, target->node.dbNode, target->node.relNode,
5686-
ItemPointerGetBlockNumber(&(target->tid)),
5687-
ItemPointerGetOffsetNumber(&(target->tid)));
5688-
}
5689-
5690-
void
5691-
heap_desc(StringInfo buf, uint8 xl_info, char *rec)
5692-
{
5693-
uint8 info = xl_info & ~XLR_INFO_MASK;
5694-
5695-
info &= XLOG_HEAP_OPMASK;
5696-
if (info == XLOG_HEAP_INSERT)
5697-
{
5698-
xl_heap_insert *xlrec = (xl_heap_insert *) rec;
5699-
5700-
if (xl_info & XLOG_HEAP_INIT_PAGE)
5701-
appendStringInfo(buf, "insert(init): ");
5702-
else
5703-
appendStringInfo(buf, "insert: ");
5704-
out_target(buf, &(xlrec->target));
5705-
}
5706-
else if (info == XLOG_HEAP_DELETE)
5707-
{
5708-
xl_heap_delete *xlrec = (xl_heap_delete *) rec;
5709-
5710-
appendStringInfo(buf, "delete: ");
5711-
out_target(buf, &(xlrec->target));
5712-
}
5713-
else if (info == XLOG_HEAP_UPDATE)
5714-
{
5715-
xl_heap_update *xlrec = (xl_heap_update *) rec;
5716-
5717-
if (xl_info & XLOG_HEAP_INIT_PAGE)
5718-
appendStringInfo(buf, "update(init): ");
5719-
else
5720-
appendStringInfo(buf, "update: ");
5721-
out_target(buf, &(xlrec->target));
5722-
appendStringInfo(buf, "; new %u/%u",
5723-
ItemPointerGetBlockNumber(&(xlrec->newtid)),
5724-
ItemPointerGetOffsetNumber(&(xlrec->newtid)));
5725-
}
5726-
else if (info == XLOG_HEAP_HOT_UPDATE)
5727-
{
5728-
xl_heap_update *xlrec = (xl_heap_update *) rec;
5729-
5730-
if (xl_info & XLOG_HEAP_INIT_PAGE) /* can this case happen? */
5731-
appendStringInfo(buf, "hot_update(init): ");
5732-
else
5733-
appendStringInfo(buf, "hot_update: ");
5734-
out_target(buf, &(xlrec->target));
5735-
appendStringInfo(buf, "; new %u/%u",
5736-
ItemPointerGetBlockNumber(&(xlrec->newtid)),
5737-
ItemPointerGetOffsetNumber(&(xlrec->newtid)));
5738-
}
5739-
else if (info == XLOG_HEAP_NEWPAGE)
5740-
{
5741-
xl_heap_newpage *xlrec = (xl_heap_newpage *) rec;
5742-
5743-
appendStringInfo(buf, "newpage: rel %u/%u/%u; fork %u, blk %u",
5744-
xlrec->node.spcNode, xlrec->node.dbNode,
5745-
xlrec->node.relNode, xlrec->forknum,
5746-
xlrec->blkno);
5747-
}
5748-
else if (info == XLOG_HEAP_LOCK)
5749-
{
5750-
xl_heap_lock *xlrec = (xl_heap_lock *) rec;
5751-
5752-
if (xlrec->shared_lock)
5753-
appendStringInfo(buf, "shared_lock: ");
5754-
else
5755-
appendStringInfo(buf, "exclusive_lock: ");
5756-
if (xlrec->xid_is_mxact)
5757-
appendStringInfo(buf, "mxid ");
5758-
else
5759-
appendStringInfo(buf, "xid ");
5760-
appendStringInfo(buf, "%u ", xlrec->locking_xid);
5761-
out_target(buf, &(xlrec->target));
5762-
}
5763-
else if (info == XLOG_HEAP_INPLACE)
5764-
{
5765-
xl_heap_inplace *xlrec = (xl_heap_inplace *) rec;
5766-
5767-
appendStringInfo(buf, "inplace: ");
5768-
out_target(buf, &(xlrec->target));
5769-
}
5770-
else
5771-
appendStringInfo(buf, "UNKNOWN");
5772-
}
5773-
5774-
void
5775-
heap2_desc(StringInfo buf, uint8 xl_info, char *rec)
5776-
{
5777-
uint8 info = xl_info & ~XLR_INFO_MASK;
5778-
5779-
info &= XLOG_HEAP_OPMASK;
5780-
if (info == XLOG_HEAP2_FREEZE)
5781-
{
5782-
xl_heap_freeze *xlrec = (xl_heap_freeze *) rec;
5783-
5784-
appendStringInfo(buf, "freeze: rel %u/%u/%u; blk %u; cutoff %u",
5785-
xlrec->node.spcNode, xlrec->node.dbNode,
5786-
xlrec->node.relNode, xlrec->block,
5787-
xlrec->cutoff_xid);
5788-
}
5789-
else if (info == XLOG_HEAP2_CLEAN)
5790-
{
5791-
xl_heap_clean *xlrec = (xl_heap_clean *) rec;
5792-
5793-
appendStringInfo(buf, "clean: rel %u/%u/%u; blk %u remxid %u",
5794-
xlrec->node.spcNode, xlrec->node.dbNode,
5795-
xlrec->node.relNode, xlrec->block,
5796-
xlrec->latestRemovedXid);
5797-
}
5798-
else if (info == XLOG_HEAP2_CLEANUP_INFO)
5799-
{
5800-
xl_heap_cleanup_info *xlrec = (xl_heap_cleanup_info *) rec;
5801-
5802-
appendStringInfo(buf, "cleanup info: remxid %u",
5803-
xlrec->latestRemovedXid);
5804-
}
5805-
else if (info == XLOG_HEAP2_VISIBLE)
5806-
{
5807-
xl_heap_visible *xlrec = (xl_heap_visible *) rec;
5808-
5809-
appendStringInfo(buf, "visible: rel %u/%u/%u; blk %u",
5810-
xlrec->node.spcNode, xlrec->node.dbNode,
5811-
xlrec->node.relNode, xlrec->block);
5812-
}
5813-
else if (info == XLOG_HEAP2_MULTI_INSERT)
5814-
{
5815-
xl_heap_multi_insert *xlrec = (xl_heap_multi_insert *) rec;
5816-
5817-
if (xl_info & XLOG_HEAP_INIT_PAGE)
5818-
appendStringInfo(buf, "multi-insert (init): ");
5819-
else
5820-
appendStringInfo(buf, "multi-insert: ");
5821-
appendStringInfo(buf, "rel %u/%u/%u; blk %u; %d tuples",
5822-
xlrec->node.spcNode, xlrec->node.dbNode, xlrec->node.relNode,
5823-
xlrec->blkno, xlrec->ntuples);
5824-
}
5825-
else
5826-
appendStringInfo(buf, "UNKNOWN");
5827-
}
5828-
58295681
/*
58305682
* heap_sync - sync a heap, for use when no WAL has been written
58315683
*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy