Skip to content

Commit d62fa70

Browse files
committed
Do Shuffle Hash Joins.
For simplicity, contains many limits. For example, it is utilizes hash partitioning only and sequental scan of relations. In this version we do not calculate cost of shuffle paths, use fixed values. And so on.
1 parent e8f78cc commit d62fa70

File tree

11 files changed

+413
-341
lines changed

11 files changed

+413
-341
lines changed

contrib/pg_exchange/dmq.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,6 @@
6262
#define DMQ_CONNSTR_MAX_LEN 1024
6363

6464
#define DMQ_MAX_SUBS_PER_BACKEND 100
65-
#define DMQ_MAX_DESTINATIONS 127
66-
#define DMQ_MAX_RECEIVERS 100
67-
68-
typedef enum
69-
{
70-
Idle, /* upon init or falure */
71-
Connecting, /* upon PQconnectStart */
72-
Negotiating, /* upon PQconnectPoll == OK */
73-
Active, /* upon dmq_receiver_loop() response */
74-
} DmqConnState;
7565

7666
typedef struct {
7767
bool active;
@@ -1676,12 +1666,13 @@ DmqConnState
16761666
dmq_get_destination_status(DmqDestinationId dest_id)
16771667
{
16781668
DmqConnState state;
1669+
DmqDestination *dest;
16791670

16801671
if ((dest_id < 0) || (dest_id >= DMQ_MAX_DESTINATIONS))
16811672
return -2;
16821673

16831674
LWLockAcquire(dmq_state->lock, LW_EXCLUSIVE);
1684-
DmqDestination *dest = &(dmq_state->destinations[dest_id]);
1675+
dest = &(dmq_state->destinations[dest_id]);
16851676
if (!dest->active)
16861677
{
16871678
LWLockRelease(dmq_state->lock);

contrib/pg_exchange/dmq.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,26 @@
44
#include "libpq-fe.h"
55
#include "lib/stringinfo.h"
66

7+
typedef enum
8+
{
9+
Idle, /* upon init or falure */
10+
Connecting, /* upon PQconnectStart */
11+
Negotiating, /* upon PQconnectPoll == OK */
12+
Active, /* upon dmq_receiver_loop() response */
13+
} DmqConnState;
14+
715
typedef int8 DmqDestinationId;
816
typedef int8 DmqSenderId;
917

1018
#define DMQ_NAME_MAXLEN 32
19+
#define DMQ_MAX_DESTINATIONS 127
20+
#define DMQ_MAX_RECEIVERS 100
1121

1222
extern void dmq_init(const char *library_name);
1323

1424
extern DmqDestinationId dmq_destination_add(char *connstr, char *sender_name,
1525
char *receiver_name, int ping_period);
26+
extern DmqConnState dmq_get_destination_status(DmqDestinationId dest_id);
1627
extern void dmq_destination_drop(char *receiver_name);
1728

1829
extern DmqSenderId dmq_attach_receiver(const char *sender_name, int mask_pos);

0 commit comments

Comments
 (0)