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

Bug 342105

Summary: DB restore, cdo_external_refs is not being restored, External ID -14 not found.
Product: [Modeling] EMF Reporter: Nils Israel <nils.israel>
Component: cdo.coreAssignee: Eike Stepper <stepper>
Status: CLOSED FIXED QA Contact: Eike Stepper <stepper>
Severity: normal    
Priority: P3 CC: stefan
Version: 4.0   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
Stacktrace none

Description Nils Israel CLA 2011-04-07 01:55:24 EDT
Build Identifier: 

After the import of a backup file the server tells me everything went fine but as soon as I connect via CDO Explorer or client-app I get the following error message:

java.lang.IllegalStateException: External ID -14 not found. Database inconsistent!

I think the problem is that the table "cdo_external_refs" (I am using dbstore with mysql btw) is not being restored. After the import there are only 13 entries, all of them cdo classes. As a workaround I can stop the server, fill the table cdo_external_refs from a mysql backup and start the server again.


Reproducible: Always

Steps to Reproduce:
DBStore with MySQL
1. cdo export repo filename
2. cdo import repo filename, restart server
3. connect via cdo-explorer or client app
Comment 1 Nils Israel CLA 2011-04-07 01:57:46 EDT
Created attachment 192697 [details]
Stacktrace
Comment 2 Eike Stepper CLA 2011-04-09 03:58:17 EDT
It's still a miracle to me where the missing ext-ref mappings are gone. I've stepped through it again and again. I can see the correct SQL INSERT statements being executed against the same connection instance that is used for other tables before and after. This connection is correctly committed at the end of the import and all the other tables look correct. Only the ext-ref table is missing the data that I've seen the INSERT statements for.

Stefan do you have a clue? Perhaps we can try this out together?
Comment 3 Eike Stepper CLA 2011-04-09 03:58:21 EDT
It's still a miracle to me where the missing ext-ref mappings are gone. I've stepped through it again and again. I can see the correct SQL INSERT statements being executed against the same connection instance that is used for other tables before and after. This connection is correctly committed at the end of the import and all the other tables look correct. Only the ext-ref table is missing the data that I've seen the INSERT statements for.

Stefan do you have a clue? Perhaps we can try this out together?
Comment 4 Eike Stepper CLA 2011-04-09 04:44:50 EDT
Committed revision 7603:
- trunk/plugins/org.eclipse.emf.cdo.server
- trunk/plugins/org.eclipse.emf.cdo.server.db
- trunk/plugins/org.eclipse.emf.cdo.tests
Comment 5 Eike Stepper CLA 2011-04-09 04:47:22 EDT
I found the problem: The importer created a store accessor but did not register it with StoreThreadLocal. As a consequence ExternalReferenceManager.mapExternalReference(CDOIDExternal, long) used an accessor that never got committed.
Comment 6 Eike Stepper CLA 2011-06-23 03:41:00 EDT
Available in R20110608-1407