Simplify RWBackend result handling

By processing the packets one at a time, the reply state is updated
correctly regardless of how many packets are received. This removes the
need for the clunky code that used modutil_count_signal_packets to detect
the end of the result set.
This commit is contained in:
Markus Mäkelä
2019-04-09 13:59:38 +03:00
parent e6526dd9ea
commit 746bd53668
2 changed files with 213 additions and 99 deletions

View File

@ -28,6 +28,7 @@ enum reply_state_t
REPLY_STATE_START, /**< Query sent to backend */
REPLY_STATE_DONE, /**< Complete reply received */
REPLY_STATE_RSET_COLDEF, /**< Resultset response, waiting for column definitions */
REPLY_STATE_RSET_COLDEF_EOF,/**< Resultset response, waiting for EOF for column definitions */
REPLY_STATE_RSET_ROWS /**< Resultset response, waiting for rows */
};
@ -67,6 +68,9 @@ public:
case REPLY_STATE_RSET_COLDEF:
return "COLDEF";
case REPLY_STATE_RSET_COLDEF_EOF:
return "COLDEF_EOF";
case REPLY_STATE_RSET_ROWS:
return "ROWS";
@ -137,6 +141,8 @@ public:
return m_reply_state == REPLY_STATE_DONE;
}
void process_packets(GWBUF* buffer);
// Controlled by the session
ResponseStat& response_stat();
private:
@ -148,6 +154,7 @@ private:
uint32_t m_expected_rows; /**< Number of rows a COM_STMT_FETCH is retrieving */
bool m_local_infile_requested; /**< Whether a LOCAL INFILE was requested */
ResponseStat m_response_stat;
uint64_t m_num_coldefs = 0;
inline bool is_opening_cursor() const
{