Skip to content

Commit 816bf05

Browse files
committed
Merge branch 'xtm' into xtm-replication
2 parents 66cb813 + 2eeb0f3 commit 816bf05

File tree

14 files changed

+558
-1900
lines changed

14 files changed

+558
-1900
lines changed

contrib/pg_dtm/sockhub/sockhub.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ void ShubLoop(Shub* shub)
469469
if (shub->params->delay != 0) {
470470
continue;
471471
}
472-
}
472+
}
473473
if (shub->in_buffer_used != 0) { /* if buffer is not empty... */
474474
/* ...then send it */
475475
#if SHOW_SENT_STATISTIC
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
---
22
- hosts: nodes[1]
3-
roles:
4-
- role: postgrespro
5-
deploy_dtm: true
3+
# roles:
4+
# - role: postgrespro
5+
# deploy_dtm: true
66

77
- hosts: nodes
88
roles:
99
- role: postgrespro
1010
pg_port: 15432
1111
deploy_postgres: true
1212
pg_dtm_enable: true
13-
pg_dtm_enable: false
14-
# pg_config_role:
15-
# - line: "dtm.buffer_size = 65536"
16-
pg_dtm_host: "{{ groups['nodes'][0] }}"
13+
pg_config_role:
14+
- line: "dtm.vacuum_delay = 1"
15+
# pg_dtm_host: "{{ groups['nodes'][0] }}"
16+
1717

contrib/pg_dtm/tests/deploy_layouts/roles/postgrespro/tasks/postgres.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@
77
- name: remove dtm.so
88
shell: rm -f {{pg_dst}}/lib/pg_dtm.so
99

10-
- name: build dtm extension
11-
shell: make clean && make && make install
12-
args:
13-
chdir: "{{pg_src}}/contrib/pg_dtm"
14-
creates: "{{pg_dst}}/lib/pg_dtm.so"
15-
16-
# - name: build ts-dtm extension
10+
# - name: build dtm extension
1711
# shell: make clean && make && make install
1812
# args:
19-
# chdir: "{{pg_src}}/contrib/pg_tsdtm"
13+
# chdir: "{{pg_src}}/contrib/pg_dtm"
2014
# creates: "{{pg_dst}}/lib/pg_dtm.so"
2115

16+
- name: build ts-dtm extension
17+
shell: make clean && make && make install
18+
args:
19+
chdir: "{{pg_src}}/contrib/pg_tsdtm"
20+
creates: "{{pg_dst}}/lib/pg_dtm.so"
21+
2222
- stat: path={{pg_datadir}}/postmaster.pid
2323
register: pg_pidfile
2424

contrib/pg_dtm/tests/deploy_layouts/single.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
- hosts: nodes[-1]
33
roles:
44

5-
- role: postgrespro
6-
deploy_dtm: true
5+
# - role: postgrespro
6+
# deploy_dtm: true
77

88
- role: postgrespro
99
deploy_postgres: true

contrib/pg_dtm/tests/farms/sai

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
158.250.29.6 ansible_ssh_user=cluster offset=4001
88
158.250.29.8 ansible_ssh_user=cluster offset=2001
99
158.250.29.9 ansible_ssh_user=cluster offset=1001
10-
158.250.29.10 ansible_ssh_user=cluster offset=1
10+
#158.250.29.10 ansible_ssh_user=cluster offset=1
1111

1212
[master]
1313
158.250.29.10 ansible_ssh_user=cluster offset=1

contrib/pg_tsdtm/pg_dtm.c

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939

4040
#define USEC 1000000
4141

42+
#define TRACE_SLEEP_TIME 1
43+
4244
typedef uint64 timestamp_t;
4345

4446
typedef struct DtmTransStatus
@@ -72,7 +74,10 @@ static HTAB* xid2status;
7274
static HTAB* gtid2xid;
7375
static DtmNodeState* local;
7476
static DtmTransState dtm_tx;
75-
77+
static timestamp_t firstReportTime;
78+
static timestamp_t prevReportTime;
79+
static timestamp_t totalSleepTime;
80+
static uint64 totalSleepInterrupts;
7681
static int DtmVacuumDelay;
7782

7883
static Snapshot DtmGetSnapshot(Snapshot snapshot);
@@ -110,12 +115,28 @@ static void dtm_sleep(timestamp_t interval)
110115
{
111116
struct timespec ts;
112117
struct timespec rem;
113-
ts.tv_sec = interval / USEC;
114-
ts.tv_nsec = interval % USEC * 1000;
118+
#if TRACE_SLEEP_TIME
119+
timestamp_t now = dtm_get_current_time();
120+
#endif
121+
ts.tv_sec = 0;
122+
ts.tv_nsec = interval*1000;
123+
115124
while (nanosleep(&ts, &rem) < 0) {
125+
totalSleepInterrupts += 1;
116126
Assert(errno == EINTR);
117127
ts = rem;
118128
}
129+
#if TRACE_SLEEP_TIME
130+
totalSleepTime += dtm_get_current_time() - now;
131+
if (now > prevReportTime + USEC*10) {
132+
prevReportTime = now;
133+
if (firstReportTime == 0) {
134+
firstReportTime = now;
135+
} else {
136+
fprintf(stderr, "Sleep %lu of %lu usec (%f%%)\n", totalSleepTime, now - firstReportTime, totalSleepTime*100.0/(now - firstReportTime));
137+
}
138+
}
139+
#endif
119140
}
120141

121142
static cid_t dtm_get_cid()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy