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 IDO prematurely logs "Finished reconnecting" #10327

Open
Al2Klimov opened this issue Jan 27, 2025 · 0 comments
Open

MySQL IDO prematurely logs "Finished reconnecting" #10327

Al2Klimov opened this issue Jan 27, 2025 · 0 comments
Labels
area/db-ido Database output area/log Logging related

Comments

@Al2Klimov
Copy link
Member

Describe the bug

At least IdoMysqlConnection#Reconnect():

  1. calls UpdateAllObjects()
    • UpdateAllObjects() puts lots of stuff in m_QueryQueue
  2. puts a callback in m_QueryQueue
    • that callback logs "Finished reconnecting"

So at least the MySQL IDO fires all initial queries and then logs "Finished reconnecting" – right? Wrong!

The MySQL IDO indeed TRIES to fire those queries before logging "Finished reconnecting". But if any of them yet misses an ID of a parent object (which is to be inserted by a query not fired yet), it lands again in m_QueryQueue AFTER logging "Finished reconnecting".

To Reproduce

  • Kick off a full dump (empty DB) of a bunch of hosts + services + notifications, etc.
  • Watch number of pending queries and "Finished reconnecting"

Expected behavior

Either – or:

  • (Simple solution) IdoMysqlConnection#Reconnect() puts a callback in m_QueryQueue which puts a callback in m_QueryQueue which logs "Finished reconnecting"
  • (Less simple solution) "Finished reconnecting" callback checks whether all items from DbConnection#UpdateAllObjects() are done (atomic counter needed), otherwise it re-enqueues itself
  • (Least simple solution) Putting a callback in m_QueryQueue which logs "Finished reconnecting" happens not directly in IdoMysqlConnection#Reconnect(), but in a Shared<Defer> – all m_QueryQueue items from DbConnection#UpdateAllObjects() hold pointers to that Defer

Your Environment

  • Version used (icinga2 --version): fe85bf1
  • Operating System and version: any
  • Enabled features (icinga2 feature list): ido-mysql

Additional context

One shouldn't need the above insider knowledge to know when the IDO actually "Finished reconnecting".

@Al2Klimov Al2Klimov added area/db-ido Database output area/log Logging related labels Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/db-ido Database output area/log Logging related
Projects
None yet
Development

No branches or pull requests

1 participant