Skip to main content



      Home
Home » Modeling » EMF » [CDO] - Migrating from 4.6 to 4.10 - DB Exception on server restart
[CDO] - Migrating from 4.6 to 4.10 - DB Exception on server restart [message #1835876] Tue, 15 December 2020 10:31 Go to next message
Eclipse UserFriend
Hi,
I'm currently migrating CDO from 4.6 to 4.10.
On server restart a db exception occured :
Quote:

Unique index or primary key violation: {0}; SQL statement:
INSERT INTO CDO_PACKAGE_UNITS (ID, ORIGINAL_TYPE, TIME_STAMP, PACKAGE_DATA) VALUES (?, ?, ?, ?) [23505-197]


In CDO 4.10, the server try to insert data in CDO_PACKAGE_UNITS twice. Then a primary key violation occured.

Between 4.6 and 4.10 the code change in org.eclipse.emf.cdo.internal.server.Repository#doActivate()

In 4.6 :
Quote:

if (store.isFirstStart())
{
initSystemPackages(true);
initRootResource();
}
else
{
readPackageUnits();
initSystemPackages(false);

readRootResource();
}


In 4.10
Quote:

if (store.isFirstStart())
{
initSystemPackages(true);
initRootResource();
}
else
{
initSystemPackages(false);
readPackageUnits();
readRootResource();
}



In 4.10 call to readPackageUnits(); is after initSystemPackages(false);
then in initSystemPackages(false);
packageRegistry is empty and the call to writePackageUnits occured twice.
In this second call, the aptemp to insert data in CDO_PACKAGE_UNITS failed.

Thanks
--
Philippe

[Updated on: Tue, 15 December 2020 11:12] by Moderator

Re: [CDO] - Migrating from 4.6 to 4.10 - DB Exception on server restart [message #1835880 is a reply to message #1835876] Tue, 15 December 2020 12:08 Go to previous messageGo to next message
Eclipse UserFriend
Hi Philippe,

To be able to understand what's going on in your specific case I need to know a bit more about the actual data that's involved:

1) What package unit causes the primary key violation? You may have to use the debugger or enable tracing of SQL statements (org.eclipse.net4j.db/debug.sql = true)

2) What's in your CDO_PACKAGE_UNITS table? If you have the DB Browser enabled you can look at http://localhost:7777/tables?table=CDO_PACKAGE_UNITS

3) Do you use the <initialPackage .../> element in the cdo-server.xml? If so, what are the nsURIs?
Re: [CDO] - Migrating from 4.6 to 4.10 - DB Exception on server restart [message #1835903 is a reply to message #1835880] Wed, 16 December 2020 03:34 Go to previous messageGo to next message
Eclipse UserFriend
Hi Eike,
Thanks for reply.
I forgot an important information. I work with an EmbeddedServer like this : https://wiki.eclipse.org/CDO/Embedded whithout cdo-server.xml.

In my code I initialize the initial list of packages with nsURi like this :
http://fr.xxxxxx.xxxxxx/xxxxxxxx/xxxxxx/1.0.4/

I active tracing of sql statements and i post result here.

[Updated on: Wed, 16 December 2020 03:37] by Moderator

Re: [CDO] - Migrating from 4.6 to 4.10 - DB Exception on server restart [message #1835906 is a reply to message #1835903] Wed, 16 December 2020 04:36 Go to previous messageGo to next message
Eclipse UserFriend
After the first start the content of the CDO_PACKAGE_UNITS table is :

Quote:

http://fr.xxxxx.xxx/first/uri/1.0.4/
http://fr.xxxxx.xxx/xxxxx/xxxxx/execution/1.0.4/
http://fr.xxxxx.xxx/xxxxx/xxxxx/variant/1.0.4/
http://fr.xxxxx.xxx/xxxxx/xxxxx/variant/chain/1.0.4/
http://fr.xxxxx.xxx/xxxxx/xxxxx/variant/connection/1.0.4/
http://www.eclipse.org/emf/CDO/Eresource/4.0.0
http://www.eclipse.org/emf/CDO/Etypes/4.0.0
fr.xxxxx.xxx.connector.generic.connectionparameters.2.0.2
fr.xxxxx.xxx.connector.generic.connectionparameters.adapter.2.0.2
fr.xxxxx.xxx.connector.generic.connectionparameters.adapter.video.2.0.2
fr.xxxxx.xxx.connector.generic.connectionparameters.docker.2.0.2
fr.xxxxx.xxx.connector.generic.connectionparameters.exe.2.0.2
fr.xxxxx.xxx.connector.generic.connectionparameters.idl.2.0.2
fr.xxxxx.xxx.connector.generic.connectionparameters.lib.2.0.2
fr.xxxxx.xxx.connector.generic.connectionparameters.lib.csharp.2.0.2
fr.xxxxx.xxx.connector.generic.connectionparameters.lib.dll.2.0.2
fr.xxxxx.xxx.connector.generic.connectionparameters.lib.java.2.0.2
fr.xxxxx.xxx.connector.generic.connectionparameters.matlab.2.0.2
fr.xxxxx.xxx.connector.generic.connectionparameters.python.2.0.2
fr.xxxxx.xxx.connector.generic.connectionparameters.pythonlib.2.0.2
fr.xxxxx.xxx.connector.generic.connectionparameters.rcp.2.0.2
fr.xxxxx.xxx.connector.generic.connectionparameters.rcpservice.2.0.2
fr.xxxxx.xxx.connector.generic.connectionparameters.rcpvideo.2.0.2
http://fr.xxxxx.xxx/xxxxx/xxxxx/core/execution/1.0.0/
http://fr.xxxxx.xxx/xxxxx/xxxxx/search/1.0.0/
http://www.eclipse.org/emf/2002/Ecore


At the second start CDO try to insert the first URI again : http://fr.xxxxx.xxx/first/uri/1.0.4/
and then the DB exception occured.

At the restart in the doActivate() method the call of readPackageUnits() is after initSystemPackages(false);
Then packageRegistry is empty

Quote:

if (initialPackages != null)
{
for (EPackage initialPackage : initialPackages)
{
if (!packageRegistry.containsKey(initialPackage.getNsURI()))
{
InternalCDOPackageUnit packageUnit = initPackage(timeStamp, initialPackage);
list.add(packageUnit);
}
}
}


In this code :
initialPackages != null : always true
!packageRegistry.containsKey(initialPackage.getNsURI() : always true

then the server try to insert CDO_PACKAGE_UNIT twice

[Updated on: Wed, 16 December 2020 04:37] by Moderator

Re: [CDO] - Migrating from 4.6 to 4.10 - DB Exception on server restart [message #1835907 is a reply to message #1835906] Wed, 16 December 2020 04:48 Go to previous messageGo to next message
Eclipse UserFriend
I fix this issue in the embedded mode with returning null value for the initialPackages.
Does this mean that from CDO version 4.10 we should no longer use initialPackages in the configuration of the CDO server?

[Updated on: Wed, 16 December 2020 05:09] by Moderator

Re: [CDO] - Migrating from 4.6 to 4.10 - DB Exception on server restart [message #1835908 is a reply to message #1835907] Wed, 16 December 2020 05:15 Go to previous messageGo to next message
Eclipse UserFriend
The problem if I don't initialize the packages, the tables of my models are not created.

I should have over 300 tables, CDO only created 30.
Re: [CDO] - Migrating from 4.6 to 4.10 - DB Exception on server restart [message #1835911 is a reply to message #1835908] Wed, 16 December 2020 05:31 Go to previous messageGo to next message
Eclipse UserFriend
The problem is the same with or withour initializePackages all tables are not created. This is not the same problem, i open a second topic.
Re: [CDO] - Migrating from 4.6 to 4.10 - DB Exception on server restart [message #1835924 is a reply to message #1835911] Wed, 16 December 2020 10:28 Go to previous messageGo to next message
Eclipse UserFriend
I can reproduce your original problem. It's a bug in CDO which is related to the use of IRepository.setInitialPackages(). Can you please open a bugzilla, so that we can track the problem and the fix?

In fact you can work around the problem by not specifying any initial packages. New/missing packages are always created on demand during normal commits. The setInitialPackages() method is mostly required when the repository is replicated (e.g., an OfflineClone or BackupRepository), because EPackages don't participate in the replication mechanism.
Re: [CDO] - Migrating from 4.6 to 4.10 - DB Exception on server restart [message #1835927 is a reply to message #1835924] Wed, 16 December 2020 10:41 Go to previous messageGo to next message
Eclipse UserFriend
Thanks Eike,
I open an Bugzilla.
Yes, i fixed the issue by not specify initialPackages
Re: [CDO] - Migrating from 4.6 to 4.10 - DB Exception on server restart [message #1835965 is a reply to message #1835927] Thu, 17 December 2020 04:59 Go to previous message
Eclipse UserFriend
Issue submitted : https://bugs.eclipse.org/bugs/show_bug.cgi?id=569775
Previous Topic:Mint tool, where can I find it?
Next Topic:EMF - genmodel generate test code option not available
Goto Forum:
  


Current Time: Wed Jul 23 17:57:30 EDT 2025

Powered by FUDForum. Page generated in 0.04439 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top