avamingli commented on code in PR #1257:
URL: https://github.com/apache/cloudberry/pull/1257#discussion_r2230567455
##########
src/backend/executor/nodeModifyTable.c:
##########
@@ -99,8 +101,43 @@ static TupleTableSlot
*ExecPrepareTupleRouting(ModifyTableState *mtstate,
TupleTableSlot *slot,
ResultRelInfo **partRelInfo);
+typedef struct ModifiedLeafRelidsKey
+{
+ CmdType cmd;
+ Oid relid;
+
+} ModifiedLeafRelidsKey;
+
+typedef struct ModifiedLeafRelidsData
+{
+ ModifiedLeafRelidsKey key;
+} ModifiedLeafRelidsData;
+
+static uint32
+modified_leaf_hash(const void *key, Size keysize)
+{
+ Assert(keysize == sizeof(ModifiedLeafRelidsKey));
+ return DatumGetUInt32(hash_any((const unsigned char*) key,
+
keysize));
+}
+
+static int
+modified_leaf_compare(const void *key1, const void *key2, Size keysize)
+{
+ Assert(keysize == sizeof(ModifiedLeafRelidsKey));
+ ModifiedLeafRelidsKey *k1 = (ModifiedLeafRelidsKey*) key1;
+ ModifiedLeafRelidsKey *k2 = (ModifiedLeafRelidsKey*) key2;
Review Comment:
Good point, done.
##########
src/backend/executor/nodeModifyTable.c:
##########
@@ -3764,16 +3819,51 @@ static void
notify_modified_relations_to_QD(ModifyTableState *node)
{
StringInfoData buf;
+ HASH_SEQ_STATUS scan;
+ ModifiedLeafRelidsData *r;
+ List *inserted = NIL;
+ List *updated = NIL;
+ List *deleted = NIL;
+
+ hash_seq_init(&scan, node->modified_leaf_relids);
+
pq_beginmessage(&buf, PQExtendProtocol);
- if (!bms_is_empty(node->mt_leaf_relids_inserted))
- send_subtag(&buf, EP_TAG_I, node->mt_leaf_relids_inserted);
+ while ((r = (ModifiedLeafRelidsData *) hash_seq_search(&scan)) != NULL)
+ {
+ switch (r->key.cmd)
+ {
+ case CMD_INSERT:
+ inserted = lappend_oid(inserted, r->key.relid);
+ break;
+ case CMD_UPDATE:
+ updated = lappend_oid(updated, r->key.relid);
+ break;
+ case CMD_DELETE:
+ deleted = lappend_oid(deleted, r->key.relid);
+ break;
+ default:
+ break;
Review Comment:
done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]