openGauss使用gRPC实现主备之间通信,但是这种reqest-response的方式,不适合我们的架构,因为我们的merge需要各节点主动发出。所以我们ZeroMQ来实现通信,并使用protobuf来序列化数据。merge消息的报文设计如下:
message MergeRequest {
message Row{
required uint64 tableExId = 1;
//获取row的tableExId
Row->GetTable()-> GetTableExId()//uint64_t
//根据tableExId获取表
fdwState = (MOTFdwStateSt*)palloc0(sizeof(MOTFdwStateSt));
fdwState->m_txnId = GetCurrentTransactionIdIfAny();
fdwState->m_currTxn = GetSafeTxn(/*fdwState->txnId*/);
fdwState->m_table = fdwState->m_currTxn->GetTableByExternalId(tableExId);
unit8 type=2;//暂时先不用
string key = 3;
bytes data= 4;
uint8_t* Row.GetData()
uint32_t Row.GetTupleSize()
uint64 startts=5;
uint64_t Row.GetStartTS()
unit64 committs=6;
uint64_t Row.GetCommitTS()
}
repeated Row row= 1;
string request_address = 2;
}
网友评论