[ZBX-9738] SQL error when deleting host group attached to action Created: 2015 Jul 29  Updated: 2017 May 30  Resolved: 2015 Sep 08

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 2.0.14, 2.2.9, 2.4.5, 2.5.0
Fix Version/s: 2.0.16rc1, 2.2.11rc1, 2.4.7rc1, 3.0.0alpha2

Type: Incident report Priority: Major
Reporter: Ivo Kurzemnieks Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: actionoperations, hostgroup, sql
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Steps to reproduce:
1. create new host group and action;
2. in Actions -> Operations tab -> Operation type select Run remote command;
3. assign that host group in target list;
4. save and then try to delete host group.

This results in SQL error message:

Error in query [DELETE FROM groups WHERE groupid='162'] [Cannot delete or update a parent row: a foreign key constraint fails (`ivo_zabbix_2_4/opcommand_grp`, CONSTRAINT `c_opcommand_grp_2` FOREIGN KEY (`groupid`) REFERENCES `groups` (`groupid`))]
    SQL statement execution has failed "DELETE FROM groups WHERE groupid='162'" [hostgroups.php:240 ? CFrontendApiWrapper->delete() ? CApiWrapper->__call() ? CFrontendApiWrapper->callMethod() ? CApiWrapper->callMethod() ? CFrontendApiWrapper->callClientMethod() ? CLocalApiClient->callMethod() ? call_user_func_array() ? CHostGroup->delete() ? DB::delete() ? DB::exception() in C:\Development\zabbix-2.4\frontends\php\include\classes\db\DB.php:818]



 Comments   
Comment by Gunars Pujats (Inactive) [ 2015 Aug 10 ]

(1) No translation strings changed.

iivs CLOSED.

Comment by Gunars Pujats (Inactive) [ 2015 Aug 10 ]

RESOLVED in svn://svn.zabbix.com/branches/dev/ZBX-9738

Comment by Ivo Kurzemnieks [ 2015 Sep 01 ]

(2) Empty operations should be deleted from the table.

gunarspujats RESOLVED in r55340.

iivs CLOSED.

Comment by Ivo Kurzemnieks [ 2015 Sep 01 ]

(3) Action stays enabled after host group is deleted.

gunarspujats RESOLVED in r55340.

iivs

  • If discovery action has operation to add/remove host to group that is deleted, action stays enabled. Trigger actions work fine.
  • Remove empty spaces between commas from SQL querry in CHostGroup.php: 808
  • You can simply write query in DBselect(), no need for extra variable $sql CHostGroup.php: 846

REOPENED.

gunarspujats RESOLVED in r55347.

iivs Since UNION selects distinct values, the DISTINCT is not necessary in query. There were several other ways of writing query (two separate queries, using subqueries with EXISTS etc., but after few discussions, we decided to stay with current query using UNION, since there is very little data in the table. Please, see my minor changes in r55373

gunarspujats CLOSED.

Comment by Ivo Kurzemnieks [ 2015 Sep 03 ]

TESTED, but close (3) before merging.

Comment by Gunars Pujats (Inactive) [ 2015 Sep 03 ]

Fixed in:

  • pre-2.0.16 r55375
  • pre-2.2.11 r55377
  • pre-2.4.7 r55379
  • pre-3.0.0alpha2 (trunk) r55380
Comment by Gunars Pujats (Inactive) [ 2015 Sep 03 ]

(4) API documentation:

Please review.

iivs I fixed grammar. Other than that, looks good.
CLOSED.

Comment by Ivo Kurzemnieks [ 2015 Sep 03 ]

(5) The fix was in API, not frontend. I fixed change log entries and added same message which was in docs:

  • pre-2.0.16 r55382
  • pre-2.2.11 r55383
  • pre-2.4.7 r55384
  • pre-3.0.0alpha2 (trunk) r55385

Changes in changelog entries should not be in one commit. Should those changes be reverted, must be discussed.

gunarspujats Discussed with sasha, changelog entries for same branch can be done in one commit.

iivs Thanks.
CLOSED.

Comment by Ivo Kurzemnieks [ 2015 Sep 03 ]

(6) 2.5.1 (trunk) CHostGroup.php: 663 old coding style array()

gunarspujats RESOLVED in r55392.

iivs CLOSED.

Comment by richlv [ 2015 Sep 04 ]

(7) please check how did this development affect ZBX-6701

gunarspujats Issue in ZBX-6701 is much wider, this developement is related only to deleting host group. WONT FIX.

Generated at Thu Apr 25 16:18:30 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.