Open
Description
Describe the bug
At least IdoMysqlConnection#Reconnect():
- calls UpdateAllObjects()
- UpdateAllObjects() puts lots of stuff in m_QueryQueue
- 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".
Activity