Skip to content

Commit adbcd44

Browse files
committed
Add switching to next host:port to DTMD.
1 parent 4aa6a83 commit adbcd44

File tree

5 files changed

+133
-118
lines changed

5 files changed

+133
-118
lines changed

contrib/pg_dtm/libdtm.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,9 @@ static bool DtmConnect(DTMConn conn)
113113

114114
if (conn->host == NULL)
115115
{
116-
perror("unix socket not supported yet");
117-
*(int*)0 = 0;
118-
/*
119116
// use a UNIX socket
120117
struct sockaddr sock;
121-
int len = offsetof(struct sockaddr, sa_data) + snprintf(sock.sa_data, sizeof(sock.sa_data), "%s/p%u", dtm_unix_sock_dir, port);
118+
int len = offsetof(struct sockaddr, sa_data) + snprintf(sock.sa_data, sizeof(sock.sa_data), "%s/sh.unix", dtm_unix_sock_dir);
122119
sock.sa_family = AF_UNIX;
123120

124121
sd = socket(AF_UNIX, SOCK_STREAM, 0);
@@ -137,7 +134,6 @@ static bool DtmConnect(DTMConn conn)
137134
}
138135
conn->sock = sd;
139136
return (connected = true);
140-
*/
141137
}
142138
else
143139
{

contrib/pg_dtm/pg_dtm.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -948,27 +948,20 @@ Datum dtm_join_transaction(PG_FUNCTION_ARGS)
948948

949949
void DtmBackgroundWorker(Datum arg)
950950
{
951-
elog(ERROR, "unix socket not supported yet");
952-
// FIXME: implement switching between multiple connections
953-
*(int*)0 = 0;
954-
955-
/*
956951
Shub shub;
957952
ShubParams params;
958953
char unix_sock_path[MAXPGPATH];
959954

960-
snprintf(unix_sock_path, sizeof(unix_sock_path), "%s/p%d", Unix_socket_directories, DtmPort);
955+
snprintf(unix_sock_path, sizeof(unix_sock_path), "%s/sh.unix", Unix_socket_directories);
961956

962957
ShubInitParams(&params);
963958

964-
params.host = DtmHost;
965-
params.port = DtmPort;
959+
params.hosts = DtmServers;
966960
params.file = unix_sock_path;
967961
params.buffer_size = DtmBufferSize;
968962

969963
ShubInitialize(&shub, &params);
970964
ShubLoop(&shub);
971-
*/
972965
}
973966

974967
static void ByteBufferAlloc(ByteBuffer* buf)

0 commit comments

Comments
 (0)