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

mysql ha lock session expires after session wait_timeout #18582

Open
ffkaka opened this issue Jan 3, 2023 · 3 comments
Open

mysql ha lock session expires after session wait_timeout #18582

ffkaka opened this issue Jan 3, 2023 · 3 comments

Comments

@ffkaka
Copy link

ffkaka commented Jan 3, 2023

HA with MySQL physical backend
With the MySQL backend, I can see frequent active node changing at every session wait_timeout. So the active node changing period is depending on the configuration of mysql.

image(wait_timeout=300sec for test, every cross line means active node switching)

but I want to make less active node switching because every active node switching will cause a bad response for some vault requests in our service. Honestly, I don't expect the active node to change unless the active node gets in trouble.

Currently, the session which has been used to acquire the mysql lock will not be used again until it loses the lock. So I think we can use this session for monitoring lock instead of which is doing it using a random session. Therefor the lock session won't get to the wait_timeout and lose lock.
@hsimon-hashicorp
Copy link
Contributor

Can you please provide more information about your configuration? Thanks!

@ffkaka
Copy link
Author

ffkaka commented Jan 9, 2023

Hi this is my configuration for the mysql backend. Thanks.

storage "mysql" {
        address = "a.b.com:3306"
        username = "user"
        password = "password"
        database = "database"
        table = "vault"
        tls_ca_file = "/crtpath/chainca.crt"
        ha_enabled = "true"
        lock_table = "vault_lock"
}

ffkaka added a commit to ffkaka/vault that referenced this issue Jan 18, 2023
…ck lock) hashicorp#18582

* add field "lockConn" which is dedicated for lock

* use "lockConn" for monitoring lock(IS_USED_LOC) as well
@ffkaka
Copy link
Author

ffkaka commented Feb 15, 2023

#18749

hi @hsimon-hashicorp
I made a simple solution for this issue. Could you please have a review of this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants