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

V2.x deprecate eof fixes and tests #4041

Merged
merged 9 commits into from
Dec 12, 2022
Merged

Conversation

javsanpar
Copy link
Contributor

@javsanpar javsanpar commented Dec 6, 2022

This PR adds fixes and tests related to 'CLIENT_DEPRECATE_EOF':

  • Fix sequence id in EOF to OK packet conversion Invalid resultset when using query cache and mixing clients using and not using CLIENT_DEPRECATE_EOF #3698
  • Fix warnings and status position in EOF to OK package conversion
  • Fix unaligned memory access in OK to EOF package conversion
  • Fix offset in deprecate_eof_cache_t iterating through inserted values
  • Refactor deprecate_eof_cache-t to compare against inserted values
  • Add tests for warnings and status flags for deprecate_eof_cache-t
  • Remove unused utils.h include from fwd_eof_query.cpp
  • Compile fwd_eof_query.cpp with libmysqlclient to test sequence id sanity

@mirostauder
Copy link
Collaborator

Automated message: PR pending admin approval for build testing

Fix invalid resultset when using query cache and mixing clients using
and not using CLIENT_DEPRECATE_EOF.

If a client connects to ProxySQL not using CLIENT_DEPRECATE_EOF and it
caches a resultset, when a client using CLIENT_DEPRECATE_EOF executes
the same query it will get an invalid resultset and the client will
disconnect. The data in the resultset is correct, but proxysql skips a
sequence id thus the client assumes it is corrupted.
If a client connects to ProxySQL not using CLIENT_DEPRECATE_EOF and it
caches a resultset, when a client using CLIENT_DEPRECATE_EOF executes
the same query it will get a resultset with wrong warnings and status
flags.

This is because warnings and status flags position must be swapped when
converting an EOF packet to an OK packet.

More info about warnings and status flags position in EOF and OK
packets:
https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_basic_eof_packet.html
https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_basic_ok_packet.html
Fix unaligned memory access in ok_to_eof_packet() when copying warnings
and status flags from OK to EOF packages.
Use the vector which contains inserted data to validate received data
from ProxySQL.
Tests if warnings and status flags from OK packets converted to EOF
packets, and the other way around, are the same.
libmariadbclient do not cares about sequence id sanity, so it can not be
used to test it.
@javsanpar javsanpar force-pushed the v2.x-deprecate_eof_fixes_and_tests branch from 57a8150 to 081ef66 Compare December 7, 2022 12:02
@JavierJF
Copy link
Collaborator

JavierJF commented Dec 9, 2022

Retest this please

@renecannao renecannao marked this pull request as ready for review December 12, 2022 03:47
@renecannao renecannao merged commit 8fff0f3 into v2.x Dec 12, 2022
@renecannao renecannao deleted the v2.x-deprecate_eof_fixes_and_tests branch January 11, 2023 10:46
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.

4 participants