Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion contrib/interconnect/ic_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,15 @@ typedef struct ChunkTransportStateEntry
int motNodeId;
bool valid;

/* Connection array */
/* Connection array
*
* MUST pay attention: use getMotionConn to get MotionConn.
* must not use `->conns[index]` to get MotionConn. Because the struct
* MotionConn is a base structure for MotionConnTCP and
* MotionConnUDP. After connection setup, the `conns` will be fill
* with MotionConnUDP/MotionConnTCP, but the pointer still is
* MotionConn which should use `CONTAINER_OF` to get the real object.
*/
MotionConn *conns;
int numConns;

Expand Down
7 changes: 5 additions & 2 deletions contrib/interconnect/udp/ic_udpifc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3413,10 +3413,13 @@ static bool
chunkTransportStateEntryInitialized(ChunkTransportState *transportStates,
int16 motNodeID)
{
if (motNodeID > transportStates->size || !transportStates->states[motNodeID - 1].valid)
ChunkTransportStateEntry *pEntry = NULL;
if (motNodeID > transportStates->size) {
return false;
}

return true;
getChunkTransportStateNoValid(transportStates, motNodeID, &pEntry);
return pEntry->valid;
}

/*
Expand Down
11 changes: 10 additions & 1 deletion src/include/cdb/cdbinterconnect.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,16 @@ typedef struct MotionConnSentRecordTypmodEnt

typedef struct ChunkTransportState
{
/* array of per-motion-node chunk transport state */
/* array of per-motion-node chunk transport state
*
* MUST pay attention: use getChunkTransportStateNoValid/getChunkTransportState
* to get ChunkTransportStateEntry.
* must not use `->states[index]` to get ChunkTransportStateEntry. Because the struct
* ChunkTransportStateEntry is a base structure for ChunkTransportStateEntryTCP and
* ChunkTransportStateEntryUDP. After interconnect setup, the `states` will be fill
* with EntryUDP/EntryTCP, but the pointer still is ChunkTransportStateEntry which
* should use `CONTAINER_OF` to get the real object.
*/
int size;
struct ChunkTransportStateEntry *states;

Expand Down