diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-03-24 04:32:13 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-03-24 04:32:13 +0000 |
commit | 0a202070603bf38ce2e2fc11a7f897fc06603b80 (patch) | |
tree | a856ccc9da2bf3ec6ec57da03788e27e89c22428 /src/backend/commands | |
parent | 4fb92718be654b38652dfe893d075f3862e84eae (diff) | |
download | postgresql-0a202070603bf38ce2e2fc11a7f897fc06603b80.tar.gz postgresql-0a202070603bf38ce2e2fc11a7f897fc06603b80.zip |
Arrange to emit a description of the current XLOG record as error context
when an error occurs during xlog replay. Also, replace the former risky
'write into a fixed-size buffer with no overflow detection' API for XLOG
record description routines; use an expansible StringInfo instead. (The
latter accounts for most of the patch bulk.)
Qingqing Zhou
Diffstat (limited to 'src/backend/commands')
-rw-r--r-- | src/backend/commands/dbcommands.c | 10 | ||||
-rw-r--r-- | src/backend/commands/sequence.c | 10 | ||||
-rw-r--r-- | src/backend/commands/tablespace.c | 11 |
3 files changed, 15 insertions, 16 deletions
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c index eb1e882f062..a9b19ab89a4 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -15,7 +15,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.177 2006/03/05 15:58:24 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.178 2006/03/24 04:32:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1392,7 +1392,7 @@ dbase_redo(XLogRecPtr lsn, XLogRecord *record) } void -dbase_desc(char *buf, uint8 xl_info, char *rec) +dbase_desc(StringInfo buf, uint8 xl_info, char *rec) { uint8 info = xl_info & ~XLR_INFO_MASK; @@ -1400,7 +1400,7 @@ dbase_desc(char *buf, uint8 xl_info, char *rec) { xl_dbase_create_rec *xlrec = (xl_dbase_create_rec *) rec; - sprintf(buf + strlen(buf), "create db: copy dir %u/%u to %u/%u", + appendStringInfo(buf, "create db: copy dir %u/%u to %u/%u", xlrec->src_db_id, xlrec->src_tablespace_id, xlrec->db_id, xlrec->tablespace_id); } @@ -1408,9 +1408,9 @@ dbase_desc(char *buf, uint8 xl_info, char *rec) { xl_dbase_drop_rec *xlrec = (xl_dbase_drop_rec *) rec; - sprintf(buf + strlen(buf), "drop db: dir %u/%u", + appendStringInfo(buf, "drop db: dir %u/%u", xlrec->db_id, xlrec->tablespace_id); } else - strcat(buf, "UNKNOWN"); + appendStringInfo(buf, "UNKNOWN"); } diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c index 5638f4fe9b7..144cf73c8a4 100644 --- a/src/backend/commands/sequence.c +++ b/src/backend/commands/sequence.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.129 2006/03/14 22:48:18 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.130 2006/03/24 04:32:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1170,19 +1170,19 @@ seq_redo(XLogRecPtr lsn, XLogRecord *record) } void -seq_desc(char *buf, uint8 xl_info, char *rec) +seq_desc(StringInfo buf, uint8 xl_info, char *rec) { uint8 info = xl_info & ~XLR_INFO_MASK; xl_seq_rec *xlrec = (xl_seq_rec *) rec; if (info == XLOG_SEQ_LOG) - strcat(buf, "log: "); + appendStringInfo(buf, "log: "); else { - strcat(buf, "UNKNOWN"); + appendStringInfo(buf, "UNKNOWN"); return; } - sprintf(buf + strlen(buf), "rel %u/%u/%u", + appendStringInfo(buf, "rel %u/%u/%u", xlrec->node.spcNode, xlrec->node.dbNode, xlrec->node.relNode); } diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c index a5d4a7a5f24..026bbf5169f 100644 --- a/src/backend/commands/tablespace.c +++ b/src/backend/commands/tablespace.c @@ -37,7 +37,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.31 2006/03/05 15:58:25 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.32 2006/03/24 04:32:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1042,7 +1042,7 @@ tblspc_redo(XLogRecPtr lsn, XLogRecord *record) } void -tblspc_desc(char *buf, uint8 xl_info, char *rec) +tblspc_desc(StringInfo buf, uint8 xl_info, char *rec) { uint8 info = xl_info & ~XLR_INFO_MASK; @@ -1050,16 +1050,15 @@ tblspc_desc(char *buf, uint8 xl_info, char *rec) { xl_tblspc_create_rec *xlrec = (xl_tblspc_create_rec *) rec; - sprintf(buf + strlen(buf), "create ts: %u \"%s\"", + appendStringInfo(buf, "create ts: %u \"%s\"", xlrec->ts_id, xlrec->ts_path); } else if (info == XLOG_TBLSPC_DROP) { xl_tblspc_drop_rec *xlrec = (xl_tblspc_drop_rec *) rec; - sprintf(buf + strlen(buf), "drop ts: %u", - xlrec->ts_id); + appendStringInfo(buf, "drop ts: %u", xlrec->ts_id); } else - strcat(buf, "UNKNOWN"); + appendStringInfo(buf, "UNKNOWN"); } |