MXS-3121 Expose statement currently being classified

Intended to be used from fatal signal handlers. As the statement will
be returned only while classification is in process, if a statement
is returned, it is an indication that the crash was caused by the
classification.
This commit is contained in:
Johan Wikman
2020-08-20 13:04:02 +03:00
parent bf6ff8a578
commit c5870cbaba
4 changed files with 62 additions and 2 deletions

View File

@ -469,6 +469,19 @@ typedef struct query_classifier
* @return QC_RESULT_OK if @c options is valid, otherwise QC_RESULT_ERROR.
*/
int32_t (* qc_set_options)(uint32_t options);
/**
* Return statement currently being classified.
*
* @param ppStmp Pointer to pointer that on return will point to the
* statement being classified.
* @param pLen Pointer to value that on return will contain the length
* of the returned string.
*
* @return QC_RESULT_OK if a statement was returned (i.e. a statement is being
* classified), QC_RESULT_ERROR otherwise.
*/
int32_t (* qc_get_current_stmt)(const char** ppStmt, size_t* pLen);
} QUERY_CLASSIFIER;
/**
@ -996,4 +1009,21 @@ uint32_t qc_get_options();
*/
bool qc_set_options(uint32_t options);
/**
* Return statement currently being classified.
*
* @param ppStmp Pointer to pointer that on return will point to the
* statement being classified.
* @param pLen Pointer to value that on return will contain the length
* of the returned string.
*
* @return True, if a statement was returned (i.e. a statement is being
* classified), false otherwise.
*
* @note A string /may/ be returned /only/ when this function is called from
* a signal handler that is called due to the classifier causing
* a crash.
*/
bool qc_get_current_stmt(const char** ppStmt, size_t* pLen);
MXS_END_DECLS