Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb3721f7

Browse files
committed
Remove dead code and fix comments in fast-path function handling.
HandleFunctionRequest() is no longer responsible for reading the protocolmessage from the client, since commit2b3a8b2. Fix the outdatedcomments.HandleFunctionRequest() now always returns 0, because the code that usedto return EOF was moved in2b3a8b2. Therefore, the caller no longerneeds to check the return value.Reported by Andres Freund. Backpatch to all supported versions, even thoughthis doesn't have any user-visible effect, to make backporting futurepatches in this area easier.Discussion:https://www.postgresql.org/message-id/20170405010525.rt5azbya5fkbhvrx@alap3.anarazel.de
1 parentfd52b88 commitb3721f7

File tree

3 files changed

+7
-31
lines changed

3 files changed

+7
-31
lines changed

‎src/backend/tcop/fastpath.c

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -249,24 +249,15 @@ fetch_fp_info(Oid func_id, struct fp_info * fip)
249249
* This corresponds to the libpq protocol symbol "F".
250250
*
251251
* INPUT:
252-
*In protocol version 3, postgres.c has already read the message body
253-
*and will pass it in msgBuf.
254-
*In old protocol, the passed msgBuf is empty and we must read the
255-
*message here.
256-
*
257-
* RETURNS:
258-
*0 if successful completion, EOF if frontend connection lost.
259-
*
260-
* Note: All ordinary errors result in ereport(ERROR,...). However,
261-
* if we lose the frontend connection there is no one to ereport to,
262-
* and no use in proceeding...
252+
*postgres.c has already read the message body and will pass it in
253+
*msgBuf.
263254
*
264255
* Note: palloc()s done here and in the called function do not need to be
265256
* cleaned up explicitly. We are called from PostgresMain() in the
266257
* MessageContext memory context, which will be automatically reset when
267258
* control returns to PostgresMain.
268259
*/
269-
int
260+
void
270261
HandleFunctionRequest(StringInfomsgBuf)
271262
{
272263
Oidfid;
@@ -281,9 +272,8 @@ HandleFunctionRequest(StringInfo msgBuf)
281272
charmsec_str[32];
282273

283274
/*
284-
* Now that we've eaten the input message, check to see if we actually
285-
* want to do the function call or not. It's now safe to ereport(); we
286-
* won't lose sync with the frontend.
275+
* We only accept COMMIT/ABORT if we are in an aborted transaction, and
276+
* COMMIT/ABORT cannot be executed through the fastpath interface.
287277
*/
288278
if (IsAbortedTransactionBlockState())
289279
ereport(ERROR,
@@ -406,8 +396,6 @@ HandleFunctionRequest(StringInfo msgBuf)
406396
msec_str,fip->fname,fid)));
407397
break;
408398
}
409-
410-
return0;
411399
}
412400

413401
/*

‎src/backend/tcop/postgres.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4165,19 +4165,7 @@ PostgresMain(int argc, char *argv[],
41654165
/* switch back to message context */
41664166
MemoryContextSwitchTo(MessageContext);
41674167

4168-
if (HandleFunctionRequest(&input_message)==EOF)
4169-
{
4170-
/* lost frontend connection during F message input */
4171-
4172-
/*
4173-
* Reset whereToSendOutput to prevent ereport from
4174-
* attempting to send any more messages to client.
4175-
*/
4176-
if (whereToSendOutput==DestRemote)
4177-
whereToSendOutput=DestNone;
4178-
4179-
proc_exit(0);
4180-
}
4168+
HandleFunctionRequest(&input_message);
41814169

41824170
/* commit the function-invocation transaction */
41834171
finish_xact_command();

‎src/include/tcop/fastpath.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
#include"lib/stringinfo.h"
1717

1818
externintGetOldFunctionMessage(StringInfobuf);
19-
externintHandleFunctionRequest(StringInfomsgBuf);
19+
externvoidHandleFunctionRequest(StringInfomsgBuf);
2020

2121
#endif/* FASTPATH_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp