The select eventid, r_eventid from event_recovery order by r_eventid, eventid desc query (patch #3030030) may cause an issue during Zabbix DB upgrade.
Steps to reproduce:
- Set up CentOS or Debian server with (512MB - 1GB RAM)
- Don't enable swap (or disable it)
- Create DB for Zabbix 3.2
- Generate problems to increase "event_recovery" table size to 1-2GB
- Start upgrade to 3.4 version
Result CentOS 7:
The "select eventid, r_eventid from event_recovery order by r_eventid, eventid desc" query will cause recurring "Out Of Memory" events for MySQL. At some point, the server may stack at all (if oom-killer score was adjusted for MySQL).
Result Debian 8:
The upgrade is running... forever? No visible issues from Zabbix server or MySQL side.
At the same time, Zabbix will stack at "3030030" patch and will continuously run "select eventid, r_eventid from event_recovery order by r_eventid, eventid desc" query. You will see "can't allocate enough memory" error on inspection with "strace".
Zabbix should add database upgrade failed error to log (with details about issue) and stop upgrade after several attempts if server has no enough memory.