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

Raise exact mysql error when the packet is an error packet #975

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

xiaoxinw
Copy link

@xiaoxinw xiaoxinw commented Jan 11, 2024

Raise more exact mysql error when the packet is an error packet.

Add logic in _read_packet method to check the packet's first bytes, if it's error packet then raise the exact mysql error returned from server.

I run int to this issue #971 , the message is "InternalError: Packet sequence number wrong...", when I debug more, I find out the packet is an error packet and the packet number is 1 when it is expected to be 2, this case happens when the network is bad, and read data timeout when connect, the real error message is (1159, Got timeout reading communication packets). I think its better to return the exact mysql error, so we can find out what is wrong really.

#971

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes

Copy link

codecov bot commented Jan 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.75%. Comparing base (83aa96e) to head (773e714).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #975      +/-   ##
==========================================
+ Coverage   93.68%   93.75%   +0.07%     
==========================================
  Files          36       36              
  Lines        5538     5553      +15     
  Branches      895      899       +4     
==========================================
+ Hits         5188     5206      +18     
+ Misses        260      258       -2     
+ Partials       90       89       -1     
Flag Coverage Δ
CI-GHA 93.35% <100.00%> (+0.07%) ⬆️
DB-mariadb-10.10 90.29% <61.11%> (+<0.01%) ⬆️
DB-mariadb-10.11 90.29% <61.11%> (+<0.01%) ⬆️
DB-mariadb-10.4 90.31% <61.11%> (+<0.01%) ⬆️
DB-mariadb-10.5 90.29% <61.11%> (+<0.01%) ⬆️
DB-mariadb-10.6 90.29% <61.11%> (+<0.01%) ⬆️
DB-mariadb-10.9 90.29% <61.11%> (+<0.01%) ⬆️
DB-mysql-5.7 90.99% <61.11%> (+<0.01%) ⬆️
DB-mysql-8.0 92.43% <100.00%> (+0.02%) ⬆️
OS-Linux 93.35% <100.00%> (+0.07%) ⬆️
Py-3.10.11 ?
Py-3.10.13 93.26% <100.00%> (?)
Py-3.11.3 ?
Py-3.11.8 93.26% <100.00%> (?)
Py-3.7.16 ?
Py-3.7.17 92.90% <100.00%> (?)
Py-3.8.16 ?
Py-3.8.18 93.29% <100.00%> (?)
Py-3.9.16 ?
Py-3.9.18 93.13% <100.00%> (?)
VM-ubuntu-latest 93.35% <100.00%> (+0.07%) ⬆️
ubuntu-latest_3.10_mariadb-10.10 90.20% <61.11%> (+<0.01%) ⬆️
ubuntu-latest_3.10_mariadb-10.11 90.20% <61.11%> (+<0.01%) ⬆️
ubuntu-latest_3.10_mariadb-10.4 90.22% <61.11%> (+<0.01%) ⬆️
ubuntu-latest_3.10_mariadb-10.5 90.20% <61.11%> (+<0.01%) ⬆️
ubuntu-latest_3.10_mariadb-10.6 90.20% <61.11%> (+<0.01%) ⬆️
ubuntu-latest_3.10_mariadb-10.9 90.20% <61.11%> (+<0.01%) ⬆️
ubuntu-latest_3.10_mysql-5.7 90.90% <61.11%> (+<0.01%) ⬆️
ubuntu-latest_3.10_mysql-8.0 92.34% <100.00%> (+0.05%) ⬆️
ubuntu-latest_3.11_mariadb-10.10 90.20% <61.11%> (+<0.01%) ⬆️
ubuntu-latest_3.11_mariadb-10.11 90.20% <61.11%> (+<0.01%) ⬆️
ubuntu-latest_3.11_mariadb-10.4 90.22% <61.11%> (+<0.01%) ⬆️
ubuntu-latest_3.11_mariadb-10.5 90.20% <61.11%> (+<0.01%) ⬆️
ubuntu-latest_3.11_mariadb-10.6 90.20% <61.11%> (+<0.01%) ⬆️
ubuntu-latest_3.11_mariadb-10.9 90.20% <61.11%> (+<0.01%) ⬆️
ubuntu-latest_3.11_mysql-5.7 90.90% <61.11%> (+<0.01%) ⬆️
ubuntu-latest_3.11_mysql-8.0 92.34% <100.00%> (+0.02%) ⬆️
ubuntu-latest_3.7_mariadb-10.10 89.65% <58.82%> (+<0.01%) ⬆️
ubuntu-latest_3.7_mariadb-10.11 89.65% <58.82%> (+<0.01%) ⬆️
ubuntu-latest_3.7_mariadb-10.4 89.67% <58.82%> (+<0.01%) ⬆️
ubuntu-latest_3.7_mariadb-10.5 89.65% <58.82%> (+<0.01%) ⬆️
ubuntu-latest_3.7_mariadb-10.6 89.65% <58.82%> (+<0.01%) ⬆️
ubuntu-latest_3.7_mariadb-10.9 89.65% <58.82%> (+<0.01%) ⬆️
ubuntu-latest_3.7_mysql-5.7 90.39% <58.82%> (+<0.01%) ⬆️
ubuntu-latest_3.7_mysql-8.0 91.92% <100.00%> (+0.06%) ⬆️
ubuntu-latest_3.8_mariadb-10.10 90.24% <61.11%> (+<0.01%) ⬆️
ubuntu-latest_3.8_mariadb-10.11 90.24% <61.11%> (+<0.01%) ⬆️
ubuntu-latest_3.8_mariadb-10.4 90.26% <61.11%> (+<0.01%) ⬆️
ubuntu-latest_3.8_mariadb-10.5 90.24% <61.11%> (+<0.01%) ⬆️
ubuntu-latest_3.8_mariadb-10.6 90.24% <61.11%> (+<0.01%) ⬆️
ubuntu-latest_3.8_mariadb-10.9 90.24% <61.11%> (+<0.01%) ⬆️
ubuntu-latest_3.8_mysql-5.7 90.94% <61.11%> (+<0.01%) ⬆️
ubuntu-latest_3.8_mysql-8.0 92.37% <100.00%> (+0.05%) ⬆️
ubuntu-latest_3.9_mariadb-10.10 90.08% <61.11%> (+<0.01%) ⬆️
ubuntu-latest_3.9_mariadb-10.11 90.08% <61.11%> (+<0.01%) ⬆️
ubuntu-latest_3.9_mariadb-10.4 90.10% <61.11%> (+<0.01%) ⬆️
ubuntu-latest_3.9_mariadb-10.5 90.08% <61.11%> (+<0.01%) ⬆️
ubuntu-latest_3.9_mariadb-10.6 90.08% <61.11%> (+<0.01%) ⬆️
ubuntu-latest_3.9_mariadb-10.9 90.08% <61.11%> (+<0.01%) ⬆️
ubuntu-latest_3.9_mysql-5.7 90.78% <61.11%> (+<0.01%) ⬆️
ubuntu-latest_3.9_mysql-8.0 92.21% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Successfully merging this pull request may close these issues.

1 participant