Skip to content

Commit 2ec3827

Browse files
committed
2 parents b8bd65f + 85d8e72 commit 2ec3827

File tree

5 files changed

+20
-3
lines changed

5 files changed

+20
-3
lines changed

contrib/multimaster/dtmd/include/limits.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
#define BUFFER_SIZE (256 * 1024)
77
#define LISTEN_QUEUE_SIZE 100
88
#define MAX_STREAMS 4096
9+
#define SOCKET_BUFFER_SIZE (1024*1024)
910

1011
#endif

contrib/multimaster/dtmd/src/server.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ static int create_listening_socket(const char *host, int port) {
8181
int optval = 1;
8282
setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char const*)&optval, sizeof(optval));
8383
setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char const*)&optval, sizeof(optval));
84+
optval = SOCKET_BUFFER_SIZE;
85+
setsockopt(s, SOL_SOCKET, SO_SNDBUF, (const char*) &optval, sizeof(int));
86+
optval = SOCKET_BUFFER_SIZE;
87+
setsockopt(s, SOL_SOCKET, SO_RCVBUF, (const char*) &optval, sizeof(int));
8488

8589
struct sockaddr_in addr;
8690
addr.sin_family = AF_INET;

contrib/multimaster/multimaster.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,13 @@ static bool TransactionIdIsInDoubt(TransactionId xid)
211211
LWLockAcquire(dtm->hashLock, LW_SHARED);
212212
inDoubt = hash_search(xid_in_doubt, &xid, HASH_FIND, NULL) != NULL;
213213
LWLockRelease(dtm->hashLock);
214+
#if 0 /* We do not need to wait until transaction locks are released, do we? */
214215
if (!inDoubt)
215216
{
216217
XLogRecPtr lsn;
217218
inDoubt = DtmGetTransactionStatus(xid, &lsn) != TRANSACTION_STATUS_IN_PROGRESS;
218219
}
220+
#endif
219221
if (inDoubt)
220222
{
221223
XTM_INFO("Wait for transaction %d to complete\n", xid);
@@ -1200,7 +1202,11 @@ mm_stop_replication(PG_FUNCTION_ARGS)
12001202
static bool MMRunUtilityStmt(PGconn* conn, char const* sql)
12011203
{
12021204
PGresult *result = PQexec(conn, sql);
1203-
bool ret = PQresultStatus(result) == PGRES_COMMAND_OK;
1205+
int status = PQresultStatus(result);
1206+
bool ret = status == PGRES_COMMAND_OK;
1207+
if (!ret) {
1208+
elog(WARNING, "Command '%s' failed with status %d", sql, status);
1209+
}
12041210
PQclear(result);
12051211
return ret;
12061212
}

contrib/multimaster/sockhub/sockhub.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
#include "sockhub.h"
2121

22+
#define SOCKHUB_BUFFER_SIZE (1024*1024)
23+
2224
void ShubAddSocket(Shub* shub, int fd);
2325

2426
inline void ShubAddSocket(Shub* shub, int fd)
@@ -189,6 +191,10 @@ static void reconnect(Shub* shub)
189191
} else {
190192
int optval = 1;
191193
setsockopt(shub->output, IPPROTO_TCP, TCP_NODELAY, (char const*)&optval, sizeof(optval));
194+
optval = SOCKHUB_BUFFER_SIZE;
195+
setsockopt(shub->output, SOL_SOCKET, SO_SNDBUF, (const char*) &optval, sizeof(int));
196+
optval = SOCKHUB_BUFFER_SIZE;
197+
setsockopt(shub->output, SOL_SOCKET, SO_RCVBUF, (const char*) &optval, sizeof(int));
192198

193199
ShubAddSocket(shub, shub->output);
194200
if (sep != NULL) {

contrib/multimaster/tests/deploy_layouts/roles/postgres/tasks/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@
6060
when: (pg_copydist is undefined) and pg_sources.changed
6161

6262
- name: build and install
63-
shell: ./configure --prefix={{pg_dst}} --without-zlib && make clean && make -j {{makejobs}} && make install
63+
shell: ./configure --prefix={{pg_dst}} --enable-debug --without-zlib && make clean && make -j {{makejobs}} && make install
6464
args:
6565
chdir: "{{pg_src}}"
6666
creates: "{{pg_dst}}/bin/postgres"
67-
when: pg_copydist is undefined
67+
# when: pg_copydist is undefined
6868

6969
#############################################################################
7070

0 commit comments

Comments
 (0)