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
Try setting wsrep_sync_wait
for mysql connections
#711
Conversation
534fe0f
to
bb74479
Compare
bb74479
to
8ec605d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before I go too deep into implementation details: @lippserd Do you see any issue in removing registering the named drivers in the sql
package?
Apart from that, just one comment of something I found strange so far.
f80bdce
to
e9d187a
Compare
Nope, removing them is fine. |
089bef9
to
7b3f0ed
Compare
7b3f0ed
to
12909f9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you drop my unit tests during cherry pick?
What does exactly cover your unit tests? It's somewhat exaggerated just to test error cases that are ultimately triggered by the underlying driver, which does not lie within the responsibility of Icinga DB. |
12909f9
to
4a6e3a3
Compare
f3222c6
to
ea54295
Compare
In Galera clusters wsrep_sync_wait=7 lets statements catch up all pending sync between nodes first. This way new child rows await fresh parent ones from other nodes not to run into foreign key errors. MySQL single nodes will reject this with error 1193 "Unknown system variable" which is OK.
Conflicts with the `timeout` variable in `ha.go` file.
ea54295
to
a8075ea
Compare
I just have rebased this and resolved some conflicts! |
It is our responsibility to swallow the correct error. |
You're probably referring to this test file from #665: https://github.com/Icinga/icingadb/blob/error-1452-foreign-key-577/pkg/driver/mysql_test.go To be honest, I haven't looked at it in detail and it's not immediately obvious to me what this actually tests. So please explain them. The current implementation isn't really ideal for testability. Maybe we could improve that by replacing |
When writing this, I missed that this would add dependencies between As we plan to move that database code to The tests proposed in#665 seem to mainly test that one error handling condition is there with quite a bit of complexity in the test cases that seems unnecessary for what it's supposed to test. Restructuring the tests within this project when the corresponding implementation is supposed to be moved to another project soon anyways, feels like unnecessary work, so I'd actually postpone the proper automatic testing of this function until it has reached its new home. Apart from that, the existing integration tests already cover that this PR isn't fundamentally breaking anything and automatically testing that Icinga DB works with a Galera cluster as part of this PR is out of scope in any way. |
This PR is an alternative version of #665 and utilises what is described in #665 (comment).
Using this PR avoids the need for custom driver registration and also eliminates the need for any other custom connectors/drivers that aren't of type
driver.RetryConnector
. This PR also adds an option todriver.RetryConnector
to post initialise a connection afterConnector#Connect()
.closes #665