diff --git a/include/maxscale/query_classifier.h b/include/maxscale/query_classifier.h index 116e59a1b..5ae2b5731 100644 --- a/include/maxscale/query_classifier.h +++ b/include/maxscale/query_classifier.h @@ -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; /** diff --git a/query_classifier/qc_sqlite/qc_sqlite.cc b/query_classifier/qc_sqlite/qc_sqlite.cc index a71e501e2..30b6c0195 100644 --- a/query_classifier/qc_sqlite/qc_sqlite.cc +++ b/query_classifier/qc_sqlite/qc_sqlite.cc @@ -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. diff --git a/query_classifier/test/expected.sql b/query_classifier/test/expected.sql index f57402db2..b3ef5061f 100644 --- a/query_classifier/test/expected.sql +++ b/query_classifier/test/expected.sql @@ -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 diff --git a/query_classifier/test/input.sql b/query_classifier/test/input.sql index 643e2c2d0..1ddd21a60 100644 --- a/query_classifier/test/input.sql +++ b/query_classifier/test/input.sql @@ -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; diff --git a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc index 3b2059e8e..75e2cdc81 100644 --- a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc +++ b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc @@ -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) {