[API] Hgset hash doesn't clear from DB when hosts are deleted via parallel execution

XMLWordPrintable

    • Sprint candidates

      Steps to reproduce:

      • Create Host A and host B both linked to host group AB
      • Delete both hosts via parallel API execution. E.g. python script => host_delete.py
      • Try to delete host group AB

      Result: Error related to hgset hash appears:

      Error in query [DELETE FROM hstgrp WHERE groupid=22] [Cannot delete or update a parent row: a foreign key constraint fails (`master-mysql`.`hgset_group`, CONSTRAINT `c_hgset_group_2` FOREIGN KEY (`groupid`) REFERENCES `hstgrp` (`groupid`))] [zabbix.php:17 → require_once() → ZBase->run() → ZBase->processRequest() → CController->run() → CControllerHostGroupDelete->doAction() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → CHostGroup->delete() → CHostGroup->deleteForce() → DB::delete() → DB::deleteByPkIds() → DB::deleteByIdField() → DBexecute() → trigger_error() → CConfigFile->{closure:/home/zabbix/workspace/master-mysql/ui/conf/zabbix.conf.php:83}() in conf/zabbix.conf.php:89]
      SQL statement execution has failed "DELETE FROM hstgrp WHERE groupid=22"
      


      Hgset hash related to group id 22 stays in DB =>

      Expected: host group should be deleted without any errors.

        1. host_delete.py
          1 kB
          Kirils Seve
        2. image-2026-01-29-10-06-17-362.png
          86 kB
          Kirils Seve
        3. image-2026-01-29-10-09-30-144.png
          12 kB
          Kirils Seve
        4. image-2026-01-29-10-10-37-418.png
          14 kB
          Kirils Seve

            Assignee:
            Janis Freibergs
            Reporter:
            Kirils Seve
            Team C
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - Not Specified
                Not Specified
                Logged:
                Time Spent - 1h
                1h