Bug #27616 MySQLIntegrityConstraintViolationException: Duplicate entry '...' for key 2

Submitted: 3 Apr 2007 13:45 Modified: 17 Apr 2007 13:41
Reporter: Carsten Segieth Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Enterprise Monitor: Server Severity:S2 (Serious)
Version:1.1.0.4973 OS:Windows (Windows XP)
Assigned to: Darren Oldag CPU Architecture:Any
Tags: server-name

[3 Apr 2007 13:45] Carsten Segieth
Description:
Agent.log shows

2007-04-03 14:25:10: (critical) exception received from server: E0001: Internal Error: com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Duplicate entry 'merlin agent long name:3307' for key 2

after starting an agent with a similar, but different server-name. The difference in the server-name between the already running and the new started agent was only the case of the first letter of the service-name:

 server-name   = merlin agent long name
 server-name   = Merlin agent long name

from AgentTasks Logs:
---------------------
Warning  	03.04.2007 15:30  	com.mysql.util.jdbctemplate.SQLRuntimeException: com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Duplicate entry 'merlin agent long name:3307' for key 2 <m_agent><utc><![CDATA[2007-04-03T13:30:32.184Z]]></utc><utcDate></utcDate><id>11</id><sessionId><![CDATA[31de36a8-28b5-4cac-9487-c10290624e17]]></sessionId><hostname><![CDATA[merlin agent long name]]></hostname><uuid><![CDATA[4d8ba81c-9004-3300-9905-4d075c239ac7]]></uuid><version><![CDATA[1.1.0.4973]]></version><heartbeatInterval>-1</heartbeatInterval><shutdown>false</shutdown><ver><major>1</major><minor>1</minor><build>0</build><revision>4973</revision></ver></m_agent><m_task_id>591</m_task_id><m_command><![CDATA[list_inventory]]></m_command><m_utc></m_utc><m_payload><hostname><![CDATA[merlin agent long name]]></hostname><port><![CDATA[3307]]></port><version><![CDATA[5.0.24-community-nt]]></version><serverId>0</serverId><databases><database><name><![CDATA[test]]></name><tables></tables></database><database><name><![CDATA[pino_vmxp_3307]]></name><tables></tables></database><database><name><![CDATA[mysql]]></name><tables><table><name><![CDATA[columns_priv]]></name></table><table><name><![CDATA[db]]></name></table><table><name><![CDATA[func]]></name></table><table><name><![CDATA[help_category]]></name></table><table><name><![CDATA[help_keyword]]></name></table><table><name><![CDATA[help_relation]]></name></table><table><name><![CDATA[help_topic]]></name></table><table><name><![CDATA[host]]></name></table><table><name><![CDATA[proc]]></name></table><table><name><![CDATA[procs_priv]]></name></table><table><name><![CDATA[tables_priv]]></name></table><table><name><![CDATA[time_zone]]></name></table><table><name><![CDATA[time_zone_leap_second]]></name></table><table><name><![CDATA[time_zone_name]]></name></table><table><name><![CDATA[time_zone_transition]]></name></table><table><name><![CDATA[time_zone_transition_type]]></name></table><table><name><![CDATA[user]]></name></table></tables></database><database><name><![CDATA[information_schema]]></name><tables><table><name><![CDATA[CHARACTER_SETS]]></name></table><table><name><![CDATA[COLLATIONS]]></name></table><table><name><![CDATA[COLLATION_CHARACTER_SET_APPLICABILITY]]></name></table><table><name><![CDATA[COLUMNS]]></name></table><table><name><![CDATA[COLUMN_PRIVILEGES]]></name></table><table><name><![CDATA[KEY_COLUMN_USAGE]]></name></table><table><name><![CDATA[ROUTINES]]></name></table><table><name><![CDATA[SCHEMATA]]></name></table><table><name><![CDATA[SCHEMA_PRIVILEGES]]></name></table><table><name><![CDATA[STATISTICS]]></name></table><table><name><![CDATA[TABLES]]></name></table><table><name><![CDATA[TABLE_CONSTRAINTS]]></name></table><table><name><![CDATA[TABLE_PRIVILEGES]]></name></table><table><name><![CDATA[TRIGGERS]]></name></table><table><name><![CDATA[USER_PRIVILEGES]]></name></table><table><name><![CDATA[VIEWS]]></name></table></tables></database></databases></m_payload>

How to repeat:
- start 1st agent, see it on dashboard
- copy .ini file
  - modify server-name as shown above
  - set new file names
  - set new UUID
- start 2nd agent
- see that you don't see the 2nd agent on dashboard
- see error message in agent log and in server logs  

Suggested fix:
- send 'kill' command to agent as it's done when two server-names are "really" identical
[10 Apr 2007 14:40] Darren Oldag
fixed in trunk.  marked 'patch pending' as a candidate for 1.1.1 release.
[13 Apr 2007 12:56] Carsten Segieth
1.1.1.5099 - exception no longer occurs, the 2nd agent is stopped with a message

...: (critical) exception received from server: E1403:  Server name "..." is in use by another agent with uuid "e95e3abd-aa6b-42f1-3300-3300c3303300".
...: (critical) server asked us to shutdown
...: (message) stopping Agent Version: 1.1.1.5099

It should be well documented that for unique servernames the check does not respect the case of the server-names, so 'Merlin' is seen "equal" to 'merLIN'.

And for later the wish is to be able to use whatever is wanted as server-name.
[17 Apr 2007 13:41] Peter Lavin
Added to the changelog.
Warnings added to the body of the documentation.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.043 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.