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

Commit863471e

Browse files
committed
Set application_name to make shardman deadlock detector happy.
Also port postgres_fdw.use_repeatable_read guc.
1 parent50caa58 commit863471e

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

‎contrib/postgres_fdw/connection.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -451,23 +451,24 @@ static void
451451
begin_remote_xact(ConnCacheEntry*entry)
452452
{
453453
intcurlevel=GetCurrentTransactionNestLevel();
454+
charsql[128];
455+
454456

455457
/* Start main transaction if we haven't yet */
456458
if (entry->xact_depth <=0)
457459
{
458-
constchar*sql;
459-
460460
elog(DEBUG3,"starting remote transaction on connection %p",
461461
entry->conn);
462462

463463
if (UseGlobalSnapshots&& (!IsolationUsesXactSnapshot()||
464464
IsolationIsSerializable()))
465465
elog(ERROR,"Global snapshots support only REPEATABLE READ");
466466

467-
if (IsolationIsSerializable())
468-
sql="START TRANSACTION ISOLATION LEVEL SERIALIZABLE";
469-
else
470-
sql="START TRANSACTION ISOLATION LEVEL REPEATABLE READ";
467+
468+
sprintf(sql,"START TRANSACTION %s; set application_name='pgfdw:%lld:%d';",
469+
IsolationIsSerializable() ?"ISOLATION LEVEL SERIALIZABLE" :
470+
UseRepeatableRead ?"ISOLATION LEVEL REPEATABLE READ" :"",
471+
(long long)GetSystemIdentifier(),MyProcPid);
471472

472473
entry->changing_xact_state= true;
473474
do_sql_command(entry->conn,sql);

‎contrib/postgres_fdw/postgres_fdw.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ typedef struct
273273
}ec_member_foreign_arg;
274274

275275
boolUseGlobalSnapshots;
276+
boolUseRepeatableRead;
276277
void_PG_init(void);
277278

278279
/*
@@ -5911,4 +5912,8 @@ _PG_init(void)
59115912
"Use global snapshots for FDW transactions",NULL,
59125913
&UseGlobalSnapshots, false,PGC_USERSET,0,NULL,
59135914
NULL,NULL);
5915+
DefineCustomBoolVariable("postgres_fdw.use_repeatable_read",
5916+
"Use repeatable read isilation error for remote transactions",NULL,
5917+
&UseRepeatableRead, true,PGC_USERSET,0,NULL,
5918+
NULL,NULL);
59145919
}

‎contrib/postgres_fdw/postgres_fdw.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ extern const char *get_jointype_name(JoinType jointype);
187187
externboolis_builtin(OidobjectId);
188188
externboolis_shippable(OidobjectId,OidclassId,PgFdwRelationInfo*fpinfo);
189189

190+
externboolUseRepeatableRead;
190191
externboolUseGlobalSnapshots;
191192

192193
#endif/* POSTGRES_FDW_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp