Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 342105 - DB restore, cdo_external_refs is not being restored, External ID -14 not found.
Summary: DB restore, cdo_external_refs is not being restored, External ID -14 not found.
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 4.0   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Eike Stepper CLA
QA Contact: Eike Stepper CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-07 01:55 EDT by Nils Israel CLA
Modified: 2011-06-23 03:41 EDT (History)
1 user (show)

See Also:


Attachments
Stacktrace (2.84 KB, text/plain)
2011-04-07 01:57 EDT, Nils Israel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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