#7 deleting groups does not work

closed-fixed
nobody
None
5
2009-02-26
2009-02-24
Edwin Stang
No

Can reproduce on production server. Works on local server.
Try to rerun the scripts for triggers and procedures on server ... though sometime where noone is online ^^

Heres the snippet from the server bugreport:
24.02.2009 - 17:24:20.378 (IP=87.143.152.166|PID=23|LN=subes|V=0.102.1) IN: CREATE_GROUP [New group]
24.02.2009 - 17:24:20.385 (IP=87.143.152.166|PID=23|LN=subes|V=0.102.1) OUT: GROUP_CREATE_ACKNOWLEDGE [New group]
24.02.2009 - 17:24:23.729 (IP=89.219.14.86|PID=24|LN=J4k3|V=0.102.1) IN: ?
24.02.2009 - 17:24:23.825 (IP=87.143.152.166|PID=23|LN=subes|V=0.102.1) IN: DELETE_GROUP [New group]
24.02.2009 - 17:24:23.839 (IP=87.143.152.166|PID=23|LN=subes|V=0.102.1) OUT: CRIPPLED_SERVER_MODE
24.02.2009 - 17:24:23.839 (IP=87.143.152.166|PID=23|LN=subes|V=0.102.1) ERROR:
class com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`coopnet/contactlists`, CONSTRAINT `fk_contactlists_grouplists` FOREIGN KEY (`contactsgroup`) REFERENCES `grouplists` (`gid`))
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.Util.getInstance(Util.java:381)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1015)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2542)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1734)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1885)
at coopnetserver.utils.Database.executeQuery(Database.java:131)
at coopnetserver.utils.Database.deleteGroup(Database.java:471)
at coopnetserver.data.player.ContactGroup.deleteGroup(ContactGroup.java:35)
at coopnetserver.data.player.ContactList.deleteGroup(ContactList.java:235)
at coopnetserver.protocol.in.CommandHandler.executeCommand(CommandHandler.java:428)
at coopnetserver.TaskProcesser$2.run(TaskProcesser.java:112)

Discussion

  • Edwin Stang
    Edwin Stang
    2009-02-26

    • status: open --> closed-fixed
     
  • Edwin Stang
    Edwin Stang
    2009-02-26

    fixed this, cause was an invalid foreign key which we didn't notice because we didnt use enough testing data during tests

    i couldn't fix the foreign key itself, so i removed it and enforced the constraint via triggers

    you cant add a contact to a group that does not exist
    you cant move a contact to a group that does not exist
    also while being at it, added to both conditions a validation check to ensure that a groupid only exists once per player

    no server update required, this was fixed on the production database
    also, developers have to rerun their db scripts