mirror of
https://github.com/postgres/postgres.git
synced 2026-05-28 04:35:45 -04:00
Avoid performing encoding conversion on command tag strings during EndCommand.
Since all current and foreseeable future command tags will be pure ASCII, there is no need to do conversion on them. This saves a few cycles and also avoids polluting otherwise-pristine subtransaction memory contexts, which is the cause of the backend memory leak exhibited in bug #5302. (Someday we'll probably want to have a better method of determining whether subtransaction contexts need to be kept around, but today is not that day.) Backpatch to 8.0. The cycle-shaving aspect of this would work in 7.4 too, but without subtransactions the memory-leak aspect doesn't apply, so it doesn't seem worth touching 7.4.
This commit is contained in:
parent
c4c29e0d15
commit
3255ea0230
1 changed files with 7 additions and 3 deletions
|
|
@ -8,7 +8,7 @@
|
|||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/tcop/dest.c,v 1.64 2004/12/31 22:01:16 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/tcop/dest.c,v 1.64.4.1 2010/01/30 20:10:22 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
@ -141,7 +141,11 @@ EndCommand(const char *commandTag, CommandDest dest)
|
|||
{
|
||||
case Remote:
|
||||
case RemoteExecute:
|
||||
pq_puttextmessage('C', commandTag);
|
||||
/*
|
||||
* We assume the commandTag is plain ASCII and therefore
|
||||
* requires no encoding conversion.
|
||||
*/
|
||||
pq_putmessage('C', commandTag, strlen(commandTag) + 1);
|
||||
break;
|
||||
|
||||
case None:
|
||||
|
|
@ -180,7 +184,7 @@ NullCommand(CommandDest dest)
|
|||
if (PG_PROTOCOL_MAJOR(FrontendProtocol) >= 3)
|
||||
pq_putemptymessage('I');
|
||||
else
|
||||
pq_puttextmessage('I', "");
|
||||
pq_putmessage('I', "", 1);
|
||||
break;
|
||||
|
||||
case None:
|
||||
|
|
|
|||
Loading…
Reference in a new issue