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

Reuse connections on sql module #16001

Merged
merged 2 commits into from
Feb 3, 2020

Conversation

jsoriano
Copy link
Member

What does this PR do?

Reuse connections between fetches on SQL module.

Why is it important?

Keep a connection open with the database instead of opening and closing connections on each fetch. this is consistent with other specific SQL modules we have, and is usually also prefered by users.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works

How to test this PR locally

Same instructions as in #13257, and then check in the database server that an only connection is created, and it is maintained along the lifetime of the module. This can be checked in MySQL with SHOW PROCESSLIST.

@jsoriano jsoriano added module review Metricbeat Metricbeat needs_backport PR is waiting to be backported to other branches. [zube]: In Review v7.7.0 Team:Services (Deprecated) Label for the former Integrations-Services team labels Jan 31, 2020
@jsoriano jsoriano requested a review from a team as a code owner January 31, 2020 16:17
@jsoriano jsoriano self-assigned this Jan 31, 2020
@ycombinator ycombinator self-assigned this Jan 31, 2020
Copy link
Contributor

@ycombinator ycombinator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Tested with MySQL SHOW PROCESSLIST and verified that only one connection is used during the life of the module. Code LGTM as well.

@jsoriano jsoriano merged commit 583a89c into elastic:master Feb 3, 2020
@jsoriano jsoriano added the test-plan Add this PR to be manual test plan label Feb 3, 2020
jsoriano added a commit to jsoriano/beats that referenced this pull request Feb 3, 2020
Keep a connection open with the database instead of opening
and closing connections on each fetch. this is consistent with
other specific SQL modules we have.

(cherry picked from commit 583a89c)
@jsoriano jsoriano removed the needs_backport PR is waiting to be backported to other branches. label Feb 3, 2020
jsoriano added a commit that referenced this pull request Feb 4, 2020
Keep a connection open with the database instead of opening
and closing connections on each fetch. this is consistent with
other specific SQL modules we have.

(cherry picked from commit 583a89c)
@sayden sayden mentioned this pull request Mar 2, 2020
5 tasks
@jsoriano jsoriano mentioned this pull request Mar 5, 2020
18 tasks
@andresrc andresrc added the test-plan-added This PR has been added to the test plan label Mar 21, 2020
@sayden sayden added the test-plan-ok This PR passed manual testing label Mar 31, 2020
@sayden sayden self-assigned this Mar 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Metricbeat Metricbeat module review Team:Services (Deprecated) Label for the former Integrations-Services team test-plan Add this PR to be manual test plan test-plan-added This PR has been added to the test plan test-plan-ok This PR passed manual testing v7.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants