Conversation
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
|
@rshriram what's the high level plan here for this? Can you provide some context on what this will do before we start thinking about reviewing? Note also that we have the older MySQL HC PR from AirBnb which was never finished. |
|
@mattklein123 this filter by itself is useful for decoding the connection phase of the mysql wire protocol (https://dev.mysql.com/doc/dev/mysql-server/latest/PAGE_PROTOCOL.html#protocol_overview) . It will emit stats like the database accessed (not the tables), the user, active sessions, failed login sessions, etc. So, the current PR by itself carries a decent amount of utility. In order to decode the SQL queries in the command phase (https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_command_phase.html), we need a full fledged SQL parser based on lex/yacc etc. The code we have internally doesn't use such a parser. It extracts only the pieces we want. Thats unlikely to be useful to the rest of the community. The MySQL health check stuff can be written on top of this code. IIRC, the mysql health check stuff was doing some minimal protocol processing just enough to decode the simple mysql ping queries, while this provides a full fledged parser for the connection phase. |
api/envoy/config/filter/network/mysql_proxy/v2/mysql_proxy.proto
Outdated
Show resolved
Hide resolved
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
|
ping.. any comments on this? |
dio
left a comment
There was a problem hiding this comment.
Overall this is very interesting. As @mattklein123 comment, let's have this: #3502 to be built based on this?
Just curious, since it has WIP prefix, do you think you want to add more features in this PR?
test/extensions/filters/network/mysql_proxy/mysql_integration_test.cc
Outdated
Show resolved
Hide resolved
|
@rshriram cool. Apart from what the |
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
|
@mattklein123 / @lizan |
|
/retest |
|
🔨 rebuilding |
dio
left a comment
There was a problem hiding this comment.
Thanks! I'll defer to Lizan and Matt.
|
@rshriram re: empty virtual functions, are they supposed not to be called? If so add NOT_IMPLEMENTED_GCOVR_EXCL_LINE, if not some test should cover them. |
Signed-off-by: Giorgio Valentini <gvalentini@vmware.com>
mattklein123
left a comment
There was a problem hiding this comment.
Thanks, this is super cool. I skimmed the code and it seems fine to go in as an experimental filter.
Some doc requests, otherwise will defer to @lizan on any remaining code changes.
/wait
| @@ -0,0 +1,46 @@ | |||
| .. _config_network_filters_mysql_proxy: | |||
|
|
|||
| MySQL proxy | |||
There was a problem hiding this comment.
Can you add an experimental warning like we do for other new filters? Also, can you add a release note that introduces experimental MySQL support?
Optimally, can you also add a config snippet that shows how to setup the filter? That's typically done now for new filters and it makes it easier on new users.
It would also be super sweet if in a follow up you could add a docker compose example of getting all of this running so that people can use a sample app w/ mysql and actually see this all work.
There was a problem hiding this comment.
I took a look at other filters. There is no mention of experimental in their docs. The proto stuff however has experimental tag. is that what you meant?
There was a problem hiding this comment.
I added proto status experimental to the protos. And added config snippets along with some RBAC examples as well.
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
|
@lizan / @mattklein123 I have added the docs with config samples, version history, and the experimental warning. The docker compose example would have to wait until we have access logging for MySQL. |
mattklein123
left a comment
There was a problem hiding this comment.
LGTM with small version history at nit. Will defer to @lizan for final review and merge. Thank you for working on this! Super cool.
docs/root/intro/version_history.rst
Outdated
| * tls: enabled TLS 1.3 on the server-side (non-FIPS builds). | ||
| * router: added per-route configuration of :ref:`internal redirects <envoy_api_field_route.RouteAction.internal_redirect_action>`. | ||
| * upstream: add hash_function to specify the hash function for :ref:`ring hash<envoy_api_msg_Cluster.RingHashLbConfig>` as either xxHash or `murmurHash2 <https://sites.google.com/site/murmurhash>`_. MurmurHash2 is compatible with std::hash in GNU libstdc++ 3.4.20 or above. This is typically the case when compiled on Linux and not macOS. | ||
| * network filters: added a MySQL proxy filter that is capable of parsing SQL queries over MySQL wire protocol. Refer to ::ref:`MySQL proxy<config_network_filters_mysql_proxy>` for more details. |
There was a problem hiding this comment.
nit: alpha order and also I would call this "mysql:"
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
| // Safety measure just to make sure that if we have a decoding error we keep going and lose stats. | ||
| // This can be removed once we are more confident of this code. | ||
| if (!sniffing_) { | ||
| buffer.drain(buffer.length()); |
There was a problem hiding this comment.
Hi @rshriram. Why does the buffer need draining here ?
I tried out the filter with SSL and it hangs after draining for both onData and onWrite.
Taking out this line altogether results in a build that works as intended.
There was a problem hiding this comment.
I was merely following the logic in mongo filter, that did the same.
void ProxyFilter::doDecode(Buffer::Instance& buffer) {
if (!sniffing_ ||
!runtime_.snapshot().featureEnabled(MongoRuntimeConfig::get().ProxyEnabled, 100)) {
// Safety measure just to make sure that if we have a decoding error we keep going and lose
// stats. This can be removed once we are more confident of this code.
buffer.drain(buffer.length());
return;
}
This filter contains the logic to decode the mysql wire protocol and SQL queries (SQL99 only). The code is based on our internal version at VMware. The SQL parser can be found at https://github.com/rshriram/sql-parser. Its a cleaned up version of Hyrise SQL parser. I am keeping the code as a separate library as importing the sources into envoy will cause a lot of changes to the code. Signed-off-by: Giorgio Valentini <gvalentini@vmware.com> Signed-off-by: Deepa Kalani <dkalani@vmware.com> Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com> Signed-off-by: Venil Noronha <veniln@vmware.com> Signed-off-by: Fred Douglas <fredlas@google.com>
This filter contains the logic to decode the mysql wire protocol and SQL queries (SQL99 only).
The code is based on our internal version at VMware. The SQL parser can be found at https://github.com/rshriram/sql-parser. Its a cleaned up version of Hyrise SQL parser. I am keeping the code as a separate library as importing the sources into envoy will cause a lot of changes to the code.
Signed-off-by: Giorgio Valentini gvalentini@vmware.com
Signed-off-by: Deepa Kalani dkalani@vmware.com
Signed-off-by: Shriram Rajagopalan shriramr@vmware.com
Signed-off-by: Venil Noronha veniln@vmware.com