[
https://jira.nuxeo.com/browse/NXP-7124?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Florent Guillaume updated NXP-7124:
-----------------------------------
Tags: rdit-w30
> Make SQL directories with auto-incremented id field robust in multi-threaded
> scenarios
> --------------------------------------------------------------------------------------
>
> Key: NXP-7124
> URL: https://jira.nuxeo.com/browse/NXP-7124
> Project: Nuxeo Enterprise Platform
> Issue Type: Bug
> Components: Core SQL Storage, Directory
> Affects Versions: 5.4
> Reporter: Florent Guillaume
> Assignee: Florent Guillaume
> Priority: Major
> Fix For: 5.4.3
>
>
> The current autoincrementIdField generation does a {{SELECT MAX(id) FROM
> thetable}} and then inserts its value + 1.
> This is not robust in cluster mode or in multi-threaded mode, as two
> different parallel transaction will compute the same max.
> This must be replaced by a proper use of database-backed autoincrement or
> serial columns.
> H2:
> {code}
> CREATE TABLE mytable(myid BIGINT AUTO_INCREMENT PRIMARY KEY, ...);
> {code}
> PostgreSQL:
> {code}
> CREATE TABLE mytable(myid SERIAL, ...);
> {code}
> MySQL:
> {code}
> CREATE TABLE mytable(myid BIGINT AUTO_INCREMENT PRIMARY KEY, ...);
> {code}
> SQL Server:
> {code}
> CREATE TABLE mytable (myid BIGINT IDENTITY PRIMARY KEY, ...);
> {code}
> Oracle:
> {code}
> CREATE TABLE mytable(myid INTEGER PRIMARY KEY, ...);
> /
> CREATE OR REPLACE TRIGGER mytable_seq_trig
> BEFORE INSERT ON mytable
> FOR EACH ROW
> WHEN(NEW.myid IS NULL)
> BEGIN
> SELECT mytable_seq.nextval INTO :NEW.myid FROM dual;
> END;
> /
> {code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
ECM-tickets mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm-tickets