Skip to content

Commit 628dad2

Browse files
committed
Add implement for ic interface GetMotionSentRecordTypmod()
1 parent aaf67b8 commit 628dad2

File tree

7 files changed

+71
-0
lines changed

7 files changed

+71
-0
lines changed

contrib/udp2/ic_common/udp2/ic_udp2.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4587,6 +4587,7 @@ UDPConn::UDPConn(TransportEntry *entry)
45874587
this->remoteContentId = -1;
45884588
this->remoteHostAndPort[0] = '\0';
45894589
this->opaque_data = nullptr;
4590+
this->sent_record_typmod = 0;
45904591

45914592
/* the field of UDPConn */
45924593
this->capacity = -1;
@@ -4621,6 +4622,7 @@ UDPConn::UDPConn(TransportEntry *entry)
46214622
this->stopRequested = false;
46224623
this->cdbProc = NULL;
46234624
this->opaque_data = NULL;
4625+
this->sent_record_typmod = 0;
46244626

46254627
/*
46264628
* "UDPConn dummyconn(NULL)" will be called by handleMismatch() in rx thread,
@@ -6500,6 +6502,14 @@ CChunkTransportStateImpl::GetOpaqueDataInConn(int16 motNodeID, int16 targetRoute
65006502
return conn->opaque_data;
65016503
}
65026504

6505+
int32*
6506+
CChunkTransportStateImpl::GetSentRecordTypmodInConn(int16 motNodeID, int16 targetRoute)
6507+
{
6508+
TransportEntry *pEntry = this->GetEntry(motNodeID, true);
6509+
UDPConn *conn = pEntry->GetConn(targetRoute);
6510+
return &conn->sent_record_typmod;
6511+
}
6512+
65036513
int
65046514
CChunkTransportStateImpl::GetConnNum(int motNodeID) {
65056515
TransportEntry *pEntry = this->GetEntry(motNodeID, true);
@@ -6587,6 +6597,11 @@ CChunkTransportState::GetOpaqueDataInConn(int16 motNodeID, int16 targetRoute) {
65876597
return ToDerived(this)->GetOpaqueDataInConn(motNodeID, targetRoute);
65886598
}
65896599

6600+
int32*
6601+
CChunkTransportState::GetSentRecordTypmodInConn(int16 motNodeID, int16 targetRoute) {
6602+
return ToDerived(this)->GetSentRecordTypmodInConn(motNodeID, targetRoute);
6603+
}
6604+
65906605
int
65916606
CChunkTransportState::GetConnNum(int motNodeID) {
65926607
return ToDerived(this)->GetConnNum(motNodeID);
@@ -6848,6 +6863,23 @@ UDP2_GetOpaqueDataInConn(ICChunkTransportState *transportStates,
68486863
return NULL;
68496864
}
68506865

6866+
int32*
6867+
UDP2_GetSentRecordTypmodInConn(ICChunkTransportState *transportStates,
6868+
int16 motNodeID,
6869+
int16 targetRoute)
6870+
{
6871+
Assert(transportStates);
6872+
6873+
try {
6874+
CChunkTransportState *cstate = static_cast<CChunkTransportState*>(transportStates);
6875+
return cstate->GetSentRecordTypmodInConn(motNodeID, targetRoute);
6876+
} catch (...) {
6877+
handleException();
6878+
}
6879+
6880+
return NULL;
6881+
}
6882+
68516883
void
68526884
UDP2_InitUDPIFC(GlobalMotionLayerIPCParam *param)
68536885
{

contrib/udp2/ic_common/udp2/ic_udp2.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ extern void UDP2_ReduceFreeSpace(ICChunkTransportState *transportStates,
7373
extern void* UDP2_GetOpaqueDataInConn(ICChunkTransportState *transportStates,
7474
int16 motNodeID,
7575
int16 targetRoute);
76+
extern int32* UDP2_GetSentRecordTypmodInConn(ICChunkTransportState *transportStates,
77+
int16 motNodeID,
78+
int16 targetRoute);
7679

7780
extern uint32 UDP2_GetActiveConns(void);
7881
extern int UDP2_GetICHeaderSizeUDP(void);

contrib/udp2/ic_common/udp2/ic_udp2.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ struct CChunkTransportState : public ICChunkTransportState
4040
void ReduceFreeSpace(int16 motNodeID, int16 targetRoute, int length);
4141

4242
void* GetOpaqueDataInConn(int16 motNodeID, int16 targetRoute);
43+
int32* GetSentRecordTypmodInConn(int16 motNodeID, int16 targetRoute);
44+
4345
int GetConnNum(int motNodeID);
4446

4547
static CChunkTransportState** GetTransportState();

contrib/udp2/ic_common/udp2/ic_udp2_internal.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ typedef struct MotionConn
114114
* play it safe */
115115

116116
void *opaque_data;
117+
int32 sent_record_typmod;
117118

118119
} MotionConn;
119120

@@ -1159,6 +1160,8 @@ class CChunkTransportStateImpl : public CChunkTransportState
11591160
void ReduceFreeSpace(int16 motNodeID, int16 targetRoute, int length);
11601161

11611162
void* GetOpaqueDataInConn(int16 motNodeID, int16 targetRoute);
1163+
int32* GetSentRecordTypmodInConn(int16 motNodeID, int16 targetRoute);
1164+
11621165
int GetConnNum(int motNodeID);
11631166

11641167
TransportEntry* GetEntry(int motNodeID, bool checkValid);

contrib/udp2/ic_modules.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ MotionIPCLayer udp2_ipc_layer = {
5454
#endif
5555

5656
.GetMotionConnTupleRemapper = GetMotionConnTupleRemapperUDPIFC2,
57+
.GetMotionSentRecordTypmod = GetMotionSentRecordTypmodUDPIFC2,
5758
};
5859

5960
void

contrib/udp2/ic_udp2.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,32 @@ GetMotionConnTupleRemapperUDPIFC2(ChunkTransportState * transportStates,
508508
return remapper;
509509
}
510510

511+
int32*
512+
GetMotionSentRecordTypmodUDPIFC2(ChunkTransportState * transportStates,
513+
int16 motNodeID,
514+
int16 targetRoute)
515+
{
516+
int32 *rs = NULL;
517+
518+
if (!transportStates)
519+
{
520+
elog(FATAL, "GetMotionConnTupleRemapper: no transport states");
521+
}
522+
523+
if (!transportStates->activated)
524+
{
525+
elog(FATAL, "GetMotionConnTupleRemapper: inactive transport states");
526+
}
527+
528+
ResetLastError();
529+
ICChunkTransportState *udp2_state =
530+
(ICChunkTransportState *)transportStates->implement_state;
531+
rs = UDP2_GetSentRecordTypmodInConn(udp2_state, motNodeID, targetRoute);
532+
HandleLastError();
533+
534+
return rs;
535+
}
536+
511537
static void
512538
SetupGlobalMotionLayerIPCParam(GlobalMotionLayerIPCParam *param)
513539
{

contrib/udp2/ic_udp2.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ extern TupleRemapper* GetMotionConnTupleRemapperUDPIFC2(ChunkTransportState *tra
6262
int16 motNodeID,
6363
int16 targetRoute);
6464

65+
extern int32* GetMotionSentRecordTypmodUDPIFC2(ChunkTransportState * transportStates,
66+
int16 motNodeID,
67+
int16 targetRoute);
68+
6569
extern int ic_proxy_server_main(void);
6670

6771
#endif // IC_UDP_H

0 commit comments

Comments
 (0)