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

Commitdf68923

Browse files
committed
Add a lock graph dumping function to multimaster sql api.
1 parentb1937fb commitdf68923

File tree

4 files changed

+34
-4
lines changed

4 files changed

+34
-4
lines changed

‎contrib/mmts/multimaster--1.0.sql‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ CREATE FUNCTION mtm.make_table_local(relation regclass) RETURNS void
4040
AS'MODULE_PATHNAME','mtm_make_table_local'
4141
LANGUAGE C;
4242

43+
CREATEFUNCTIONmtm.dump_lock_graph() RETURNStext
44+
AS'MODULE_PATHNAME','mtm_dump_lock_graph'
45+
LANGUAGE C;
46+
4347
CREATETABLEIF NOT EXISTSmtm.ddl_log (issuedtimestamp with time zonenot null, querytext);
4448

4549
CREATETABLEIF NOT EXISTSmtm.local_tables(rel_schematext, rel_nametext,primary key(rel_schema, rel_name));

‎contrib/mmts/multimaster.c‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ PG_FUNCTION_INFO_V1(mtm_get_snapshot);
108108
PG_FUNCTION_INFO_V1(mtm_get_nodes_state);
109109
PG_FUNCTION_INFO_V1(mtm_get_cluster_state);
110110
PG_FUNCTION_INFO_V1(mtm_make_table_local);
111+
PG_FUNCTION_INFO_V1(mtm_dump_lock_graph);
111112

112113
staticSnapshotMtmGetSnapshot(Snapshotsnapshot);
113114
staticvoidMtmInitialize(void);
@@ -2154,6 +2155,31 @@ Datum mtm_make_table_local(PG_FUNCTION_ARGS)
21542155
return false;
21552156
}
21562157

2158+
Datummtm_dump_lock_graph(PG_FUNCTION_ARGS)
2159+
{
2160+
StringInfos=makeStringInfo();
2161+
inti;
2162+
for (i=0;i<MtmNodes;i++)
2163+
{
2164+
size_tsize;
2165+
char*data=RaftableGet(psprintf("lock-graph-%d",i+1),&size,NULL, true);
2166+
if (!data)continue;
2167+
GlobalTransactionId*gtid= (GlobalTransactionId*)data;
2168+
GlobalTransactionId*last= (GlobalTransactionId*)(data+size);
2169+
appendStringInfo(s,"node-%d lock graph: ",i+1);
2170+
while (gtid!=last) {
2171+
GlobalTransactionId*src=gtid++;
2172+
appendStringInfo(s,"%d:%d -> ",src->node,src->xid);
2173+
while (gtid->node!=0) {
2174+
GlobalTransactionId*dst=gtid++;
2175+
appendStringInfo(s,"%d:%d, ",dst->node,dst->xid);
2176+
}
2177+
gtid+=1;
2178+
}
2179+
appendStringInfo(s,"\n");
2180+
}
2181+
returnCStringGetTextDatum(s->data);
2182+
}
21572183

21582184
/*
21592185
* -------------------------------------------

‎contrib/mmts/t/002_dtmbench.pl‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ sub allocate_ports
6060
listen_addresses = '$host'
6161
unix_socket_directories = ''
6262
port =$pgport
63-
max_prepared_transactions =10
63+
max_prepared_transactions =1000
6464
max_worker_processes = 10
6565
wal_level = logical
6666
fsync = off
@@ -103,13 +103,13 @@ sub allocate_ports
103103
push(@argv,'-n', 1000,'-a', 1000,'-w', 10,'-r', 1);
104104

105105
diag("running dtmbench -i");
106-
if (TestLib::run_log([@argv,'-i']))
106+
if (!TestLib::run_log([@argv,'-i']))
107107
{
108108
BAIL_OUT("dtmbench -i failed");
109109
}
110110

111111
diag("running dtmbench");
112-
if (TestLib::run_log(\@argv,'>', \$out))
112+
if (!TestLib::run_log(\@argv,'>', \$out))
113113
{
114114
fail("dtmbench failed");
115115
}

‎contrib/mmts/t/003_pgbench.pl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ sub allocate_ports
6262
listen_addresses = '$host'
6363
unix_socket_directories = ''
6464
port =$pgport
65-
max_prepared_transactions =10
65+
max_prepared_transactions =1000
6666
max_worker_processes = 10
6767
wal_level = logical
6868
fsync = off

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp