Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vtgate does not report autocommit system variable and SERVER_STATUS_IN_TRANS flag correctly #5825

Closed
aquarapid opened this issue Feb 18, 2020 · 1 comment
Milestone

Comments

@aquarapid
Copy link
Contributor

aquarapid commented Feb 18, 2020

Logging these together, since they're both session related, although they may be addressed separately. Both these issues are problematic for more advanced MySQL drivers (e.g. the MySQL JDBC driver), since they can use these signals to determine things like: whether a commit statement can be elided because the session is already in autocommit mode.

autocommit:

  • vtgate does not reflect the status of the autocommit system variable properly when it's been changed, e.g.:
mysql> select @@autocommit;
+--------------+
| @@autocommit |
+--------------+
|            1 |
+--------------+
1 row in set (0.00 sec)
mysql> set autocommit=0;
Query OK, 0 rows affected (0.00 sec)
mysql> select @@autocommit;
+--------------+
| @@autocommit |
+--------------+
|            1 |
+--------------+
1 row in set (0.00 sec)

However, it does recognize that a transaction has started, since it will reject a follow-up statement if the transaction timeout (default 30 secs in OLTP mode) has expired.

SERVER_STATUS_IN_TRANS and SERVER_STATUS_AUTOCOMMIT flags:

  • Even when in a transaction, a result will be returned to the client via vtgate without the SERVER_STATUS_IN_TRANS flag set . This can be seen in a network dump (screenshot attached) as the "In transaction" field.
  • The SERVER_STATUS_AUTOCOMMIT flag is also always just returned as 0, regardless of the status of autocommit.
    SERVER_STATUS_IN_TRANS_unset
aquarapid added a commit to planetscale/vitess that referenced this issue Jul 29, 2020
…_AUTOCOMMIT

flags correctly for queries.

Signed-off-by: Jacques Grove <aquarapid@gmail.com>
@aquarapid
Copy link
Contributor Author

Fixed by #6551

@askdba askdba added this to the v8.0 milestone Oct 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants