diff options
author | Andres Freund <andres@anarazel.de> | 2014-09-19 15:17:12 +0200 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2014-09-19 16:20:29 +0200 |
commit | 728f152e07f998d2cb4fe5f24ec8da2c3bda98f2 (patch) | |
tree | 3d7f2d8a04764a093a340af3f82b0cd15f44a6c1 /src/backend/access/rmgrdesc/dbasedesc.c | |
parent | 7e3f728353fa9b36c7f98b6ec447d3f1b8deec14 (diff) | |
download | postgresql-728f152e07f998d2cb4fe5f24ec8da2c3bda98f2.tar.gz postgresql-728f152e07f998d2cb4fe5f24ec8da2c3bda98f2.zip |
Add rmgr callback to name xlog record types for display purposes.
This is primarily useful for the upcoming pg_xlogdump --stats feature,
but also allows to remove some duplicated code in the rmgr_desc
routines.
Due to the separation and harmonization, the output of dipsplayed
records changes somewhat. But since this isn't enduser oriented
content that's ok.
It's potentially desirable to further change pg_xlogdump's display of
records. It previously wasn't possible to show the record type
separately from the description forcing it to be in the last
column. But that's better done in a separate commit.
Author: Abhijit Menon-Sen, slightly editorialized by me
Reviewed-By: Álvaro Herrera, Andres Freund, and Heikki Linnakangas
Discussion: 20140604104716.GA3989@toroid.org
Diffstat (limited to 'src/backend/access/rmgrdesc/dbasedesc.c')
-rw-r--r-- | src/backend/access/rmgrdesc/dbasedesc.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/backend/access/rmgrdesc/dbasedesc.c b/src/backend/access/rmgrdesc/dbasedesc.c index 0230716509f..e36988a736f 100644 --- a/src/backend/access/rmgrdesc/dbasedesc.c +++ b/src/backend/access/rmgrdesc/dbasedesc.c @@ -28,7 +28,7 @@ dbase_desc(StringInfo buf, XLogRecord *record) { xl_dbase_create_rec *xlrec = (xl_dbase_create_rec *) rec; - appendStringInfo(buf, "create db: copy dir %u/%u to %u/%u", + appendStringInfo(buf, "copy dir %u/%u to %u/%u", xlrec->src_db_id, xlrec->src_tablespace_id, xlrec->db_id, xlrec->tablespace_id); } @@ -36,9 +36,25 @@ dbase_desc(StringInfo buf, XLogRecord *record) { xl_dbase_drop_rec *xlrec = (xl_dbase_drop_rec *) rec; - appendStringInfo(buf, "drop db: dir %u/%u", + appendStringInfo(buf, "dir %u/%u", xlrec->db_id, xlrec->tablespace_id); } - else - appendStringInfoString(buf, "UNKNOWN"); +} + +const char * +dbase_identify(uint8 info) +{ + const char *id = NULL; + + switch (info) + { + case XLOG_DBASE_CREATE: + id = "CREATE"; + break; + case XLOG_DBASE_DROP: + id = "DROP"; + break; + } + + return id; } |