icinga2 icon indicating copy to clipboard operation
icinga2 copied to clipboard

Insert into icinga_notifications and icinga_contactnotifications in one transaction

Open Al2Klimov opened this issue 4 years ago • 6 comments

Al2Klimov avatar Aug 18 '21 11:08 Al2Klimov

ref/IP/33683

Al2Klimov avatar Aug 18 '21 11:08 Al2Klimov

I need a second pair of eyes. Why does this one insert notification_id:NULL into icinga_contactnotifications?

Al2Klimov avatar Aug 18 '21 11:08 Al2Klimov

I think we need to insert into icinga_notifications before inserting into icinga_contactnotifcations. The reason for this is our ID cache. It's only getting filled AFTER the queries have been executed. This happens inside the callback of each query (which in all cases is FinishExecuteQuery()).

Setting callback: https://github.com/Icinga/icinga2/blob/e4bfb4898d312097e4c0364d17d31211006138cd/lib/db_ido_mysql/idomysqlconnection.cpp#L1182

Calling callback: https://github.com/Icinga/icinga2/blob/e4bfb4898d312097e4c0364d17d31211006138cd/lib/db_ido_mysql/idomysqlconnection.cpp#L612

Setting ID: https://github.com/Icinga/icinga2/blob/e4bfb4898d312097e4c0364d17d31211006138cd/lib/db_ido_mysql/idomysqlconnection.cpp#L1202

N-o-X avatar Aug 24 '21 11:08 N-o-X

Don’t say... I INSERT icinga_notifications after icinga_contactnotifcations?

Al2Klimov avatar Aug 24 '21 11:08 Al2Klimov

  • Is this obsolete with #10065?

Al2Klimov avatar Feb 04 '25 10:02 Al2Klimov

If this question was directed at me, then it is not. Whatever problem this is supposed to fix should not have been fixed by #10065, as neither the notifications nor contactnotifications IDO table contains a config hash column.

yhabteab avatar Feb 06 '25 10:02 yhabteab