add doc for session_track_trx_state and refactor little

This commit is contained in:
Dapeng Huang 2018-01-26 10:22:30 +08:00 committed by Markus Mäkelä
parent a56d0f8992
commit a035c91fa6
3 changed files with 17 additions and 3 deletions

1
.gitignore vendored
View File

@ -52,6 +52,7 @@ CMakeFiles/*
*/*/*/*/CMakeFiles/*
Makefile
/.DS_Store
.DS_Store
# Netbeans Project files
nbproject/

View File

@ -1063,6 +1063,19 @@ seconds. The interval is incremented until the value of `max_retry_interval` is
reached at which point the listener attempts to bind to the interface every
`max_retry_interval` seconds.
#### `session_track_trx_state`
Enable or disable getting session transation state via session track mechanism. This
parameter takes a boolean value. Default False.
Get current session transaction state from server side will be more accurate.
Minimum Server version Mariadb 10.3 or MySQL 5.7 is needed and following server
config is also needed.
```
session_track_state_change = ON
session_track_transaction_info = CHARACTERISTICS
```
### Server
Server sections are used to define the backend database servers that can be

View File

@ -1857,7 +1857,7 @@ void mxs_mysql_get_session_track_info(GWBUF *buff, MySQLProtocol *proto)
{
while (gwbuf_copy_data(buff, offset, MYSQL_HEADER_LEN + 1, header_and_command) == (MYSQL_HEADER_LEN + 1))
{
size_t packet_len = gw_mysql_get_byte3(header_and_command);
size_t packet_len = gw_mysql_get_byte3(header_and_command) + MYSQL_HEADER_LEN;
uint8_t cmd = header_and_command[MYSQL_COM_OFFSET];
if (packet_len > MYSQL_OK_PACKET_MIN_LEN &&
@ -1865,7 +1865,7 @@ void mxs_mysql_get_session_track_info(GWBUF *buff, MySQLProtocol *proto)
(proto->num_eof_packets % 2) == 0)
{
buff->gwbuf_type |= GWBUF_TYPE_REPLY_OK;
mxs_mysql_parse_ok_packet(buff, offset, packet_len + MYSQL_HEADER_LEN);
mxs_mysql_parse_ok_packet(buff, offset, packet_len);
}
if ((proto->current_command == MXS_COM_QUERY ||
@ -1875,7 +1875,7 @@ void mxs_mysql_get_session_track_info(GWBUF *buff, MySQLProtocol *proto)
{
proto->num_eof_packets++;
}
offset += (packet_len + MYSQL_HEADER_LEN);
offset += packet_len;
}
}
}