Enable trx boundary detection using regexes

Transaction boundaries can now be detected using regexes.
All else being equal, it gives a 10% performance improvement
compared to qc-based detection.

In a subsequent change, mysql_client.c will be modified to use
qc_get_trx_type_mask() instead of qc_get_type_mask().

Currently the use of regex matching is turned on using an
environment variable. That will change.
This commit is contained in:
Johan Wikman
2017-03-10 15:34:57 +02:00
parent 0985a18a7e
commit 8e81941058
6 changed files with 672 additions and 13 deletions

View File

@ -645,6 +645,30 @@ char** qc_get_table_names(GWBUF* stmt, int* size, bool fullnames);
*/
uint32_t qc_get_type_mask(GWBUF* stmt);
/**
* Returns the type bitmask of transaction related statements.
*
* If the statement starts a transaction, ends a transaction or
* changes the autocommit state, the returned bitmap will be a
* combination of:
*
* QUERY_TYPE_BEGIN_TRX
* QUERY_TYPE_COMMIT
* QUERY_TYPE_ROLLBACK
* QUERY_TYPE_ENABLE_AUTOCOMMIT
* QUERY_TYPE_DISABLE_AUTOCOMMIT
* QUERY_TYPE_READ (explicitly read only transaction)
* QUERY_TYPE_WRITE (explicitly read write transaction)
*
* Otherwise the result will be 0.
*
* @param stmt A COM_QUERY or COM_STMT_PREPARE packet.
*
* @return The relevant type bits if the statement is transaction
* related, otherwise 0.
*/
uint32_t qc_get_trx_type_mask(GWBUF* stmt);
/**
* Returns whether the statement is a DROP TABLE statement.
*