Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 292146

Summary: [DB] create unique constraints on table PKs to prevent data corruption
Product: [Modeling] EMF Reporter: Stefan Winkler <stefan>
Component: cdo.dbAssignee: Stefan Winkler <stefan>
Status: CLOSED FIXED QA Contact: Eike Stepper <stepper>
Severity: enhancement    
Priority: P3 CC: caspar_d, saulius.tvarijonas
Version: 2.0Flags: stefan: galileo+
stepper: review+
Target Milestone: SR2   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 292137    
Attachments:
Description Flags
Patch-v1
none
Patch-v2 none

Description Stefan Winkler CLA 2009-10-13 09:29:04 EDT
See Bug 292137.
Comment 1 Stefan Winkler CLA 2009-10-13 09:55:39 EDT
Created attachment 149439 [details]
Patch-v1

Added UNIQUE index creation commands for class and list mappings.
(Only affect newly created repositories, migration path for existing repositories would be to create the indexes manually)

Still have to run testsuites to check if they have any unwanted impact.
Comment 2 Stefan Winkler CLA 2009-10-14 06:13:54 EDT
Created attachment 149509 [details]
Patch-v2

I missed the cdo_index field in the first patch.

This one is ok and testcases for HSQL and H2 run without errors in both audit and non-audit modes.

Should be ok to apply.
Comment 3 Caspar D. CLA 2009-10-14 07:28:47 EDT
(In reply to comment #2)

Stefan,

Thanks for your quick help. I've patched our CDO, we'll try it out.

Regards
/Caspar
Comment 4 Stefan Winkler CLA 2009-10-14 07:43:48 EDT
Just in case it's not already clear: this patch won't make the inherent problem of Bug 292137 go away.
Most likely you will get TransactionExceptions because you concurrently modify revisions or something.
This patch should just prevent data corruption in such a case (i.e., by throwing the exception at commit time).
Comment 5 Caspar D. CLA 2009-10-21 00:25:58 EDT
Patch works. Can this be committed to HEAD and 2.0-maintenance?
Comment 6 Eike Stepper CLA 2009-10-21 11:32:58 EDT
Committed to R2_0_maintenance