* notify_modified_relations_to_QD * Send modified relation info back to QD through extend libpq protocol. */
| 3805 | * Send modified relation info back to QD through extend libpq protocol. |
| 3806 | */ |
| 3807 | static void |
| 3808 | notify_modified_relations_to_QD(ModifyTableState *node) |
| 3809 | { |
| 3810 | StringInfoData buf; |
| 3811 | HASH_SEQ_STATUS scan; |
| 3812 | ModifiedLeafRelidsData *r; |
| 3813 | List *inserted = NIL; |
| 3814 | List *updated = NIL; |
| 3815 | List *deleted = NIL; |
| 3816 | |
| 3817 | hash_seq_init(&scan, node->modified_leaf_relids); |
| 3818 | |
| 3819 | pq_beginmessage(&buf, PQExtendProtocol); |
| 3820 | |
| 3821 | while ((r = (ModifiedLeafRelidsData *) hash_seq_search(&scan)) != NULL) |
| 3822 | { |
| 3823 | switch (r->key.cmd) |
| 3824 | { |
| 3825 | case CMD_INSERT: |
| 3826 | inserted = lappend_oid(inserted, r->key.relid); |
| 3827 | break; |
| 3828 | case CMD_UPDATE: |
| 3829 | updated = lappend_oid(updated, r->key.relid); |
| 3830 | break; |
| 3831 | case CMD_DELETE: |
| 3832 | deleted = lappend_oid(deleted, r->key.relid); |
| 3833 | break; |
| 3834 | default: |
| 3835 | Assert(false); |
| 3836 | break; |
| 3837 | } |
| 3838 | } |
| 3839 | |
| 3840 | if (inserted != NIL) |
| 3841 | { |
| 3842 | send_subtag(&buf, EP_TAG_I, inserted); |
| 3843 | pfree(inserted); |
| 3844 | } |
| 3845 | |
| 3846 | if (updated != NIL) |
| 3847 | { |
| 3848 | send_subtag(&buf, EP_TAG_U, updated); |
| 3849 | pfree(updated); |
| 3850 | } |
| 3851 | |
| 3852 | if (deleted != NIL) |
| 3853 | { |
| 3854 | send_subtag(&buf, EP_TAG_D, deleted); |
| 3855 | pfree(deleted); |
| 3856 | } |
| 3857 | |
| 3858 | pq_sendint32(&buf, EP_TAG_MAX); /* Finish this run. */ |
| 3859 | pq_endmessage(&buf); |
| 3860 | pq_flush(); /* Flush to notify QD in time. */ |
| 3861 | } |
| 3862 | |
| 3863 | /* |
| 3864 | * send_subtag |
no test coverage detected