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

Commit849314b

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

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

‎contrib/postgres_fdw/connection.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -451,19 +451,19 @@ 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

463-
if (IsolationIsSerializable())
464-
sql="START TRANSACTIONISOLATION LEVEL SERIALIZABLE";
465-
else
466-
sql="START TRANSACTION ISOLATION LEVEL REPEATABLE READ";
463+
sprintf(sql,"START TRANSACTION %s; set application_name='pgfdw:%lld:%d';",
464+
IsolationIsSerializable() ?"ISOLATION LEVEL SERIALIZABLE" :
465+
UseRepeatableRead ?"ISOLATION LEVEL REPEATABLE READ" :"",
466+
(long long)GetSystemIdentifier(),MyProcPid);
467467
entry->changing_xact_state= true;
468468
do_sql_command(entry->conn,sql);
469469
entry->xact_depth=1;

‎contrib/postgres_fdw/postgres_fdw.c

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

271271
boolUseGlobalSnapshots;
272+
boolUseRepeatableRead;
272273
void_PG_init(void);
273274

274275
/*
@@ -5806,4 +5807,8 @@ _PG_init(void)
58065807
"Use global snapshots for FDW transactions",NULL,
58075808
&UseGlobalSnapshots, false,PGC_USERSET,0,NULL,
58085809
NULL,NULL);
5810+
DefineCustomBoolVariable("postgres_fdw.use_repeatable_read",
5811+
"Use repeatable read isilation error for remote transactions",NULL,
5812+
&UseRepeatableRead, true,PGC_USERSET,0,NULL,
5813+
NULL,NULL);
58095814
}

‎contrib/postgres_fdw/postgres_fdw.h

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

187+
externboolUseRepeatableRead;
187188
externboolUseGlobalSnapshots;
188189

189190
#endif/* POSTGRES_FDW_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp