On 7/16/13 11:18 PM, "Chip Childers" <chip.child...@sungard.com> wrote:
>I'd suggest shortening your event type literals. > +1 > >On Tue, Jul 16, 2013 at 1:45 PM, Soheil Eizadi <seiz...@infoblox.com> >wrote: > >> I have code to delete the Plugin device from the system, when I try to >> execute this code I get an exception before my Command gets invoked in >> system code that tries to create an event. I debugged this to the event >> table underlying SQL definition. I wanted to know what the best practice >> was for CloudStack: >> >> * Update the Event Table definition to accommodate a longer Type >>Field >> * Limit my choice of naming to fit the existing 32 byte Event Field >> >> Ideally I wanted to change the event definition, but the change will >> impact database upgrade as we go from one release to another. >> -Soheil >> >> mysql> describe event; >> >> >>+-------------+---------------------+------+-----+-----------+----------- >>-----+ >> | Field | Type | Null | Key | Default | Extra >> | >> >> >>+-------------+---------------------+------+-----+-----------+----------- >>-----+ >> | id | bigint(20) unsigned | NO | PRI | NULL | >> auto_increment | >> ..... >> | type | varchar(32) | NO | MUL | NULL | >> | >> ..... >> >> >>+-------------+---------------------+------+-----+-----------+----------- >>-----+ >> ------- >> >> >> @Entity >> >> @Table(name="event") >> >> public class EventVO implements Event { >> >> >> .... >> >> @Column(name="type") >> >> private String type; >> >> >> ------ >> >> ERROR [cloud.api.ApiServer] (183551903@qtp-729770861-5:) unhandled >> exception executing api command: deleteInfobloxDevice >> com.cloud.utils.exception.CloudRuntimeException: DB Exception on: >> com.mysql.jdbc.JDBC4PreparedStatement@59c7f05d: INSERT INTO event >> (event.type, event.state, event.description, event.created, >>event.user_id, >> event.account_id, event.domain_id, event.level, event.start_id, >> event.parameters, event.uuid, event.archived) VALUES >> (_binary'PHYSICAL.INFOBLOXCONTROLLER.DELETE', 'Scheduled', >>_binary'Deleting >> Infoblox Controller', '2013-07-16 04:11:58', 2, 2, 1, _binary'INFO', 0, >> null, _binary'eefc03f0-f60b-4450-a43a-319e66c15e94', 0) >> at com.cloud.utils.db.GenericDaoBase.persist(GenericDaoBase.java:1342) >> ...... >> at >> >>org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java: >>582) >> Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too >> long for column 'type' at row 1 >> at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4072) >>