MXS-1891: dealloc named prepare should route to all (#174)

* dealloc named prepare route to all

* add newline

* erase from ps manager too

* little refactor
This commit is contained in:
dapeng huang 2018-06-12 15:45:11 +08:00 committed by Johan Wikman
parent 1a24f0a956
commit cd136b11a7
5 changed files with 10 additions and 2 deletions

View File

@ -84,7 +84,8 @@ typedef enum qc_query_type
QUERY_TYPE_CREATE_TMP_TABLE = 0x080000, /*< Create temporary table:master (could be all) */
QUERY_TYPE_READ_TMP_TABLE = 0x100000, /*< Read temporary table:master (could be any) */
QUERY_TYPE_SHOW_DATABASES = 0x200000, /*< Show list of databases */
QUERY_TYPE_SHOW_TABLES = 0x400000 /*< Show list of tables */
QUERY_TYPE_SHOW_TABLES = 0x400000, /*< Show list of tables */
QUERY_TYPE_DEALLOC_PREPARE = 0x1000000 /*< Dealloc named prepare stmt:all */
} qc_query_type_t;
/**

View File

@ -2136,7 +2136,7 @@ public:
ss_dassert(this_thread.initialized);
m_status = QC_QUERY_PARSED;
m_type_mask = QUERY_TYPE_WRITE;
m_type_mask = QUERY_TYPE_DEALLOC_PREPARE;
// If information is collected in several passes, then we may
// this information already.

View File

@ -23,3 +23,4 @@ QUERY_TYPE_READ|QUERY_TYPE_WRITE
QUERY_TYPE_READ|QUERY_TYPE_WRITE
QUERY_TYPE_READ|QUERY_TYPE_WRITE
QUERY_TYPE_READ|QUERY_TYPE_WRITE
QUERY_TYPE_DEALLOC_PREPARE

View File

@ -23,3 +23,4 @@ SELECT GET_LOCK('lock1',10);
SELECT IS_FREE_LOCK('lock1');
SELECT IS_USED_LOCK('lock1');
SELECT RELEASE_LOCK('lock1');
deallocate prepare select_stmt;

View File

@ -344,6 +344,10 @@ bool route_session_write(RWSplitSession *rses, GWBUF *querybuf,
{
rses->ps_manager.store(querybuf, id);
}
else if (qc_query_is_type(type, QUERY_TYPE_DEALLOC_PREPARE))
{
rses->ps_manager.erase(get_text_ps_id(querybuf));
}
MXS_INFO("Session write, routing to all servers.");
@ -624,6 +628,7 @@ route_target_t get_route_target(RWSplitSession *rses, uint8_t command,
*/
if (qc_query_is_type(qtype, QUERY_TYPE_PREPARE_STMT) ||
qc_query_is_type(qtype, QUERY_TYPE_PREPARE_NAMED_STMT) ||
qc_query_is_type(qtype, QUERY_TYPE_DEALLOC_PREPARE) ||
command == MXS_COM_STMT_CLOSE ||
command == MXS_COM_STMT_RESET)
{