Skip to content

Commit df36fe2

Browse files
committed
Merge branch 'xtm' of gitlab.postgrespro.ru:pgpro-dev/postgrespro into xtm
2 parents 74ff316 + 523a7bc commit df36fe2

File tree

14 files changed

+318
-116
lines changed

14 files changed

+318
-116
lines changed

contrib/pg_gtm/dtmd/bin/dtmd

5.2 KB
Binary file not shown.

contrib/pg_gtm/tests/transfers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import (
99
)
1010

1111
const (
12-
TRANSFER_CONNECTIONS = 4
12+
TRANSFER_CONNECTIONS = 8
1313
INIT_AMOUNT = 10000
1414
N_ITERATIONS = 10000
15-
N_ACCOUNTS = 1//100000
15+
N_ACCOUNTS = 8//100000
1616
)
1717

1818

contrib/pg_xtm/dtmd/src/main.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,14 +350,17 @@ static char *onabort(void *stream, void *clientdata, cmd_t *cmd) {
350350
static void gen_snapshot(Snapshot *s, int node) {
351351
s->nactive = 0;
352352
s->xmin = xmax[node];
353-
s->xmax = s->xmin + 1;
353+
s->xmax = 0;
354354
int i;
355355
for (i = 0; i < transactions_count; i++) {
356356
Transaction *t = transactions[i].participants + node;
357357
if (t->active) {
358358
if (t->xid < s->xmin) {
359359
s->xmin = t->xid;
360360
}
361+
if (t->xid >= s->xmax) {
362+
s->xmax = t->xid + 1;
363+
}
361364
s->active[s->nactive++] = t->xid;
362365
}
363366
}

contrib/pg_xtm/libdtm.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,12 @@ DTMConn DtmConnect(char *host, int port) {
9191

9292
for (a = addrs; a != NULL; a = a->ai_next) {
9393
DTMConn dtm;
94+
int one = 1;
9495
int sock = socket(a->ai_family, a->ai_socktype, a->ai_protocol);
9596
if (sock == -1) {
9697
perror("failed to create a socket");
9798
continue;
9899
}
99-
100-
int one = 1;
101100
setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, &one, sizeof(one));
102101

103102
if (connect(sock, a->ai_addr, a->ai_addrlen) == -1) {

contrib/pg_xtm/pg_dtm--1.0.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,11 @@
44
CREATE FUNCTION dtm_begin_transaction(nodes integer[], xids integer[]) RETURNS void
55
AS 'MODULE_PATHNAME','dtm_begin_transaction'
66
LANGUAGE C;
7+
8+
CREATE FUNCTION dtm_get_current_snapshot_xmin() RETURNS bigint
9+
AS 'MODULE_PATHNAME','dtm_get_current_snapshot_xmin'
10+
LANGUAGE C;
11+
12+
CREATE FUNCTION dtm_get_current_snapshot_xmax() RETURNS bigint
13+
AS 'MODULE_PATHNAME','dtm_get_current_snapshot_xmax'
14+
LANGUAGE C;

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