2025.2.4.0-b119
tagged this
11 Jun 16:16
Summary: NOTE: Not clean backport, details at end. This diff fixes one of the regression caused due to e76acc667db58394ff41f3aa762b1500ff7e8914 (Make conn mgr wait for sync packet to get ack) for the COPY Operation. **Problem** In the original commit, the client relay gets pause as soon as SYNC packet is received from client in conn mgr. But if client is executing COPY FROM operation via extended query protocol mode, in which it requires client to send data as part of COPY operation it can lead to hangup. i.e client relay is pause and conn mgr is not forwarding copydata, copydone packets to backend. Consider test case: ``` P(COPY FROM STDIN) -> B -> E(COPY FROM STDIN) -> SYNC ``` Conn mgr forwards these packets without looking into query and pause the client relay on processing SYNC packet. Server responds with: ```COPY_IN_RESPONSE``` and request client to send copydata, copydone. Conn mgr would forward COPY_IN_RESPONSE packet to client but on receiving CopyData, CopyDone it won't be able to read or forward the packets as client relay has been paused. Therefore COPY operation gets hangup in this case. **Fix** Resume the client relay on receiving COPY_IN_RESPONSE, since it requires more data to be forwarded as part of copy operation. This resume is not required for COPY_OUT_RESPONSE, since in that case no data is expected to be sent by client in simple or extended query protocol mode and backend returns RFQ without consuming SYNC packet. So it works as it any other packet. **Follow up issue** Conn mgr didn't knew sync packet sent during execution of `COPY FROM` command that it would get ignored by backend. Infact until client doesn't send CopyDone message backend would keep ignoring the SYNC packet. But this is making conn mgr state stale. Conn mgr would keep on recording SYNC to expect RFQ for them, whereas backend is silently ignoring them and won't send RFQ ever. This issue can be tracked here: https://github.com/yugabyte/yugabyte-db/issues/32120 Original commit: 04f6c1d8490563975ac0c6eb840be171da028793 / D54352 **Merge conflicts** Since 5a0884b15b051b1da03d2bcadcaee1ab3bdb7f9e has not been backported to 2025.2, therefore continue using old method YBTestRunnerYsqlConnMgr to define the test class added in this diff as done for other tests. Test Plan: Jenkins: urgent, all tests Added test case: `./yb_build.sh release --java-test org.yb.ysqlconnmgr.TestCopyCmd` to validate above scenario. Reviewers: skumar, arpit.saxena, vikram.damle, #db-approvers Reviewed By: arpit.saxena, #db-approvers Subscribers: yql Differential Revision: https://phorge.dev.yugabyte.com/D54435