Re: Duplicate entry '4183884' for key 'PRIMARY'

Kieran Kelleher <[email protected]> Fri, 17 May 2013 18:43:05 -0400
Newsgroups gmane.comp.web.webobjects.wonder-disc
Message-ID <[email protected]>
"lucky" for sure - or you have set up ideal conditions for avoiding EOGeneralAdaptorExceptions such as turning off optimistic lock checking on every attribute or sth like that.

Bottom line is this, and just think about it logically:

Every time an EOEditingContext saveChanges fails, you get NO ROLLBACK with MyISAM. Result is a partially saved set of changes..... if your data is important, you will simply not be happy to accept this risk of data integrity loss. It is what it is. Transactional database engines exist for a reason. EOEditingContext is designed to work with transactional dbs. http://dev.mysql.com/doc/refman/5.5/en/commit.html

Most common symptom of non-rolledback transactions is orphan relationships from what I have seen.

There is no good reason, that I know of, where MyISAM engine is a better choice for WebObjects that InnoDB engine and every reason why InnoDB is better than MyISAM for WebObjects, so why bother trying to justify using MyISAM?

On May 17, 2013, at 6:06 PM, Chuck Hill <[email protected]> wrote:

> The word you are looking for is "lucky".
> 
> 
> On 2013-05-17, at 2:57 PM, Ron X wrote:
> 
>> Hi!
>> We use MyISAM engine with WebObjects about 5 years and have 60GB DB - and did not have this problem at all...
>> So? ^_^
>> 
>> 
>> WebRep
>> 
>> Overall rating
>> 
>> 
>> 
>> 
>> 
>> WebRep
>> 
>> Overall rating
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 2013/5/17 Kieran Kelleher <[email protected]>
>> Your problem is MyISAM ....... MyISAM tables are not transactional and as a rule, should never be used with WebObjects. You will suffer forever and destroy the integrity of your data as long as you use MyISAM.
>> 
>> Write a conversion script (I have a rudimentary one somewhere if needed) and do a test conversion to InnoDB on a copy of your database (from a slave or whatever) and create a good InnoDB configuration (https://github.com/kierankelleher/gic-mysql-tools). test your app. Then once satisfied, convert your live db to InnoDB.
>> 
>> On May 17, 2013, at 2:04 PM, Mark Gowdy <[email protected]> wrote:
>> 
>>> Hi,
>>> 
>>> We have started getting more of these errors recently, now that the system is under a bit more load.
>>> 
>>> ----
>>> EvaluateExpression failed: <com.webobjects.jdbcadaptor._MySQLPlugIn$MySQLExpression: "INSERT INTO queue_item(ITEM_DATE,  ...  etc....)
>>> Duplicate entry '4183884' for key 'PRIMARY'
>>> ----
>>> 
>>> I believe the problem is due to the fact that there is more than one instance trying to write to the 'queue_item' table, and the EO_PK_TABLE mechanism is handing out the same ID more than once.
>>> Probably something to do with locking.
>>> 
>>> Our Database is MySQL, and the EO_PK_TABLE is of type MyISAM.
>>> 
>>> I tried to find the mechanism that allocate the primary key, but I keep bumping up against:
>>> 
>>> EOAdaptorChannel:
>>>      @Deprecated
>>>      public NSDictionary<String, Object> primaryKeyForNewRowWithEntity(EOEntity entity){
>>>              return null;
>>>      }
>>> 
>>> 
>>> Any advise would be appreciated,
>>> 
>>> Thanks,
>>> 
>>> Mark
>>> 
>>> 
>>> ------------------------------------------------------------------------------
>>> AlienVault Unified Security Management (USM) platform delivers complete
>>> security visibility with the essential security capabilities. Easily and
>>> efficiently configure, manage, and operate all of your security controls
>>> from a single console and one unified framework. Download a free trial.
>>> http://p.sf.net/sfu/alienvault_d2d
>>> _______________________________________________
>>> Wonder-disc mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/wonder-disc
>> 
>> 
>> ------------------------------------------------------------------------------
>> AlienVault Unified Security Management (USM) platform delivers complete
>> security visibility with the essential security capabilities. Easily and
>> efficiently configure, manage, and operate all of your security controls
>> from a single console and one unified framework. Download a free trial.
>> http://p.sf.net/sfu/alienvault_d2d
>> _______________________________________________
>> Wonder-disc mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/wonder-disc
>> 
>> ------------------------------------------------------------------------------
>> AlienVault Unified Security Management (USM) platform delivers complete
>> security visibility with the essential security capabilities. Easily and
>> efficiently configure, manage, and operate all of your security controls
>> from a single console and one unified framework. Download a free trial.
>> http://p.sf.net/sfu/alienvault_d2d_______________________________________________
>> Wonder-disc mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/wonder-disc
> 
> -- 
> Chuck Hill             
> Executive Managing Partner, VP Development and Technical Services
> 
> Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.    
> http://www.global-village.net/gvc/practical_webobjects
> 
> Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing Companies in B.C! 
> Global Village Consulting ranks 76th in 24th annual PROFIT 200 ranking of Canada’s Fastest-Growing Companies by PROFIT Magazine!
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 


------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d