Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] CDO server throws exception after migrating to M6 (MySQL)
[CDO] CDO server throws exception after migrating to M6 (MySQL) [message #1031596] Tue, 02 April 2013 01:00 Go to next message
Lothar Werzinger is currently offline Lothar WerzingerFriend
Messages: 153
Registered: July 2009
Location: Bay Area
Senior Member
After upgrading to M6 the CDO server prints exceptions to the log / console and I can no longer access the data stored in CDO

!ENTRY org.eclipse.equinox.app 4 0 2013-04-01 17:02:52.112
!MESSAGE Index field is nullable: ID
!STACK 0
org.eclipse.net4j.db.DBException: Index field is nullable: ID
        at org.eclipse.net4j.internal.db.ddl.DBIndex.addIndexField(DBIndex.java:118)
        at org.eclipse.net4j.internal.db.ddl.DBIndex.<init>(DBIndex.java:56)
        at org.eclipse.net4j.internal.db.ddl.DBTable.addIndex(DBTable.java:209)
        at org.eclipse.net4j.spi.db.DBAdapter.addIndex(DBAdapter.java:303)
        at org.eclipse.net4j.spi.db.DBAdapter.readIndices(DBAdapter.java:271)
        at org.eclipse.net4j.spi.db.DBAdapter.readIndices(DBAdapter.java:227)
        at org.eclipse.net4j.spi.db.DBAdapter.readSchema(DBAdapter.java:168)
        at org.eclipse.net4j.db.DBUtil.readSchema(DBUtil.java:240)
        at org.eclipse.net4j.db.DBUtil.readSchema(DBUtil.java:231)
        at org.eclipse.net4j.spi.db.DBAdapter.readSchema(DBAdapter.java:141)
        at org.eclipse.net4j.internal.db.DBDatabase$1.run(DBDatabase.java:59)
        at org.eclipse.net4j.internal.db.DBDatabase$1.run(DBDatabase.java:1)
        at org.eclipse.net4j.db.DBUtil.execute(DBUtil.java:651)
        at org.eclipse.net4j.internal.db.DBDatabase.<init>(DBDatabase.java:55)
        at org.eclipse.net4j.db.DBUtil.openDatabase(DBUtil.java:173)
        at org.eclipse.emf.cdo.server.internal.db.DBStore.doActivate(DBStore.java:621)
        at org.eclipse.net4j.util.lifecycle.Lifecycle.internalActivate(Lifecycle.java:76)
        at org.eclipse.net4j.util.lifecycle.Lifecycle.activate(Lifecycle.java:162)
        at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(LifecycleUtil.java:114)
        at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(LifecycleUtil.java:104)
        at org.eclipse.emf.cdo.internal.server.Repository.doActivate(Repository.java:1874)
        at org.eclipse.net4j.util.lifecycle.Lifecycle.internalActivate(Lifecycle.java:76)
        at org.eclipse.net4j.util.lifecycle.ShareableLifecycle.internalActivate(ShareableLifecycle.java:43)
        at org.eclipse.net4j.util.lifecycle.Lifecycle.activate(Lifecycle.java:162)
        at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(LifecycleUtil.java:114)
        at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(LifecycleUtil.java:104)
        at org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOServerUtil.java:291)
        at org.eclipse.emf.cdo.spi.server.RepositoryConfigurator.configure(RepositoryConfigurator.java:116)
        at org.eclipse.emf.cdo.internal.server.bundle.CDOServerApplication.doStart(CDOServerApplication.java:61)
        at org.eclipse.net4j.util.om.OSGiApplication.start(OSGiApplication.java:63)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
        at org.eclipse.equinox.internal.app.AnyThreadAppLauncher.run(AnyThreadAppLauncher.java:26)
        at java.lang.Thread.run(Thread.java:679)
Caused by: java.lang.Exception: The field ID has been constructed here:
        at org.eclipse.net4j.internal.db.ddl.DBField.<init>(DBField.java:88)
        at org.eclipse.net4j.internal.db.ddl.DBTable.addField(DBTable.java:112)
        at org.eclipse.net4j.spi.db.DBAdapter.readFields(DBAdapter.java:205)
        at org.eclipse.net4j.spi.db.DBAdapter.readSchema(DBAdapter.java:167)
        ... 26 more



I think it stems from the fact that CDO used to create the table for cdo_branches and cdo_external_refs with a NULLABLE id. cdo_commit_infos has a NULLABLE commit_time

Here's a snippet from mysqdump:


CREATE TABLE `cdo_branches` (
  `id` int(11) DEFAULT NULL,
  `name` longtext COLLATE utf8_unicode_ci,
  `base_id` int(11) DEFAULT NULL,
  `base_time` bigint(20) DEFAULT NULL,
  UNIQUE KEY `cdo_branches_idx0` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `cdo_external_refs` (
  `id` bigint(20) DEFAULT NULL,
  `uri` longtext COLLATE utf8_unicode_ci,
  `committime` bigint(20) DEFAULT NULL,
  UNIQUE KEY `cdo_external_refs_idx0` (`id`),
  KEY `cdo_external_refs_idx1` (`uri`(255))
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `cdo_commit_infos` (
  `commit_time` bigint(20) DEFAULT NULL,
  `previous_time` bigint(20) DEFAULT NULL,
  `branch_id` int(11) DEFAULT NULL,
  `user_id` longtext COLLATE utf8_unicode_ci,
  `commit_comment` longtext COLLATE utf8_unicode_ci,
  UNIQUE KEY `cdo_commit_infos_idx0` (`commit_time`),
  KEY `cdo_commit_infos_idx1` (`branch_id`),
  KEY `cdo_commit_infos_idx2` (`user_id`(255))
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;



I tried to patch my mysqdump files and restore the DB, but it did not get rid of the error for me so far.

It would be nice if CDO handled the schema upgrade that was introduced in M6 gracefully.
Re: [CDO] CDO server throws exception after migrating to M6 (MySQL) [message #1034328 is a reply to message #1031596] Fri, 05 April 2013 09:58 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Hi Lothar,

I fear that a DB-specific, automatic migration of the nullable attribute of the column definitions is too much effort
for me. But it seems that most DBs have never complained about the indexes on nullable columns, so I've added the
runtime option "org.eclipse.net4j.db.DisableNullableCheck", which you can set to "true" to skip the new check.

The easiest way to adjust your schema is to use CDOServerExporter / Importer. Is that okay for you?

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper



Am 02.04.2013 03:00, schrieb Lothar Werzinger:
> After upgrading to M6 the CDO server prints exceptions to the log / console and I can no longer access the data stored
> in CDO
>
>
> !ENTRY org.eclipse.equinox.app 4 0 2013-04-01 17:02:52.112
> !MESSAGE Index field is nullable: ID
> !STACK 0
> org.eclipse.net4j.db.DBException: Index field is nullable: ID
> at org.eclipse.net4j.internal.db.ddl.DBIndex.addIndexField(DBIndex.java:118)
> at org.eclipse.net4j.internal.db.ddl.DBIndex.<init>(DBIndex.java:56)
> at org.eclipse.net4j.internal.db.ddl.DBTable.addIndex(DBTable.java:209)
> at org.eclipse.net4j.spi.db.DBAdapter.addIndex(DBAdapter.java:303)
> at org.eclipse.net4j.spi.db.DBAdapter.readIndices(DBAdapter.java:271)
> at org.eclipse.net4j.spi.db.DBAdapter.readIndices(DBAdapter.java:227)
> at org.eclipse.net4j.spi.db.DBAdapter.readSchema(DBAdapter.java:168)
> at org.eclipse.net4j.db.DBUtil.readSchema(DBUtil.java:240)
> at org.eclipse.net4j.db.DBUtil.readSchema(DBUtil.java:231)
> at org.eclipse.net4j.spi.db.DBAdapter.readSchema(DBAdapter.java:141)
> at org.eclipse.net4j.internal.db.DBDatabase$1.run(DBDatabase.java:59)
> at org.eclipse.net4j.internal.db.DBDatabase$1.run(DBDatabase.java:1)
> at org.eclipse.net4j.db.DBUtil.execute(DBUtil.java:651)
> at org.eclipse.net4j.internal.db.DBDatabase.<init>(DBDatabase.java:55)
> at org.eclipse.net4j.db.DBUtil.openDatabase(DBUtil.java:173)
> at org.eclipse.emf.cdo.server.internal.db.DBStore.doActivate(DBStore.java:621)
> at org.eclipse.net4j.util.lifecycle.Lifecycle.internalActivate(Lifecycle.java:76)
> at org.eclipse.net4j.util.lifecycle.Lifecycle.activate(Lifecycle.java:162)
> at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(LifecycleUtil.java:114)
> at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(LifecycleUtil.java:104)
> at org.eclipse.emf.cdo.internal.server.Repository.doActivate(Repository.java:1874)
> at org.eclipse.net4j.util.lifecycle.Lifecycle.internalActivate(Lifecycle.java:76)
> at org.eclipse.net4j.util.lifecycle.ShareableLifecycle.internalActivate(ShareableLifecycle.java:43)
> at org.eclipse.net4j.util.lifecycle.Lifecycle.activate(Lifecycle.java:162)
> at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(LifecycleUtil.java:114)
> at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(LifecycleUtil.java:104)
> at org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOServerUtil.java:291)
> at org.eclipse.emf.cdo.spi.server.RepositoryConfigurator.configure(RepositoryConfigurator.java:116)
> at org.eclipse.emf.cdo.internal.server.bundle.CDOServerApplication.doStart(CDOServerApplication.java:61)
> at org.eclipse.net4j.util.om.OSGiApplication.start(OSGiApplication.java:63)
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
> at org.eclipse.equinox.internal.app.AnyThreadAppLauncher.run(AnyThreadAppLauncher.java:26)
> at java.lang.Thread.run(Thread.java:679)
> Caused by: java.lang.Exception: The field ID has been constructed here:
> at org.eclipse.net4j.internal.db.ddl.DBField.<init>(DBField.java:88)
> at org.eclipse.net4j.internal.db.ddl.DBTable.addField(DBTable.java:112)
> at org.eclipse.net4j.spi.db.DBAdapter.readFields(DBAdapter.java:205)
> at org.eclipse.net4j.spi.db.DBAdapter.readSchema(DBAdapter.java:167)
> ... 26 more
>
>
>
> I think it stems from the fact that CDO used to create the table for cdo_branches and cdo_external_refs with a
> NULLABLE id. cdo_commit_infos has a NULLABLE commit_time
>
> Here's a snippet from mysqdump:
>
>
>
> CREATE TABLE `cdo_branches` (
> `id` int(11) DEFAULT NULL,
> `name` longtext COLLATE utf8_unicode_ci,
> `base_id` int(11) DEFAULT NULL,
> `base_time` bigint(20) DEFAULT NULL,
> UNIQUE KEY `cdo_branches_idx0` (`id`)
> ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
>
> CREATE TABLE `cdo_external_refs` (
> `id` bigint(20) DEFAULT NULL,
> `uri` longtext COLLATE utf8_unicode_ci,
> `committime` bigint(20) DEFAULT NULL,
> UNIQUE KEY `cdo_external_refs_idx0` (`id`),
> KEY `cdo_external_refs_idx1` (`uri`(255))
> ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
>
> CREATE TABLE `cdo_commit_infos` (
> `commit_time` bigint(20) DEFAULT NULL,
> `previous_time` bigint(20) DEFAULT NULL,
> `branch_id` int(11) DEFAULT NULL,
> `user_id` longtext COLLATE utf8_unicode_ci,
> `commit_comment` longtext COLLATE utf8_unicode_ci,
> UNIQUE KEY `cdo_commit_infos_idx0` (`commit_time`),
> KEY `cdo_commit_infos_idx1` (`branch_id`),
> KEY `cdo_commit_infos_idx2` (`user_id`(255))
> ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
>
>
>
> I tried to patch my mysqdump files and restore the DB, but it did not get rid of the error for me so far.
>
> It would be nice if CDO handled the schema upgrade that was introduced in M6 gracefully.


Re: [CDO] CDO server throws exception after migrating to M6 (MySQL) [message #1034613 is a reply to message #1034328] Fri, 05 April 2013 17:05 Go to previous messageGo to next message
Lothar Werzinger is currently offline Lothar WerzingerFriend
Messages: 153
Registered: July 2009
Location: Bay Area
Senior Member
I found a way to fix-up my sql backups with the script below.

#!/bin/bash

cat >sedscript << @@@END@@@
/CREATE TABLE/{
N
s|\(CREATE TABLE.*\n.*\`id\`.*\),|\1 NOT NULL,|
s|\(CREATE TABLE.*\n.*\`cdo_id\`.*\),|\1 NOT NULL,|
s|\(CREATE TABLE.*\n.*\`area_id\`.*\),|\1 NOT NULL,|
s|\(CREATE TABLE.*\n.*\`commit_time\`.*\),|\1 NOT NULL,|
s|\(CREATE TABLE.*\n.*\`cdo_source\`.*\),|\1 NOT NULL,|
s|\(CREATE TABLE.*\n.*\`name\`.*\),|\1 NOT NULL,|
s|\(CREATE TABLE.*\n.*\`uri\`.*\),|\1 NOT NULL,|
s|DEFAULT NULL NOT NULL|NOT NULL|
s|NOT NULL NOT NULL|NOT NULL|
}
/object_id/{
s|\(\`object_id\`.*\) DEFAULT NULL,|\1 NOT NULL,|
}
@@@END@@@


for f in *.sql ; do
  echo $f
  sed -i -f sedscript $f
done



P.S.
We use the lowercase names feature of MySQL, so that we can transfer backups between Windows and Linux systems.
Re: [CDO] CDO server throws exception after migrating to M6 (MySQL) [message #1035019 is a reply to message #1034328] Sat, 06 April 2013 07:19 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 05.04.2013 11:58, schrieb Eike Stepper:
> Hi Lothar,
>
> I fear that a DB-specific, automatic migration of the nullable attribute of the column definitions is too much effort
> for me.
Update: I reopened this bug and want to find a way to migrate automatically:

404047: DB-Migration from 4.1 to 4.2 failed
https://bugs.eclipse.org/bugs/show_bug.cgi?id=404047

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Previous Topic:Update Site for EMF Validation
Next Topic:CDO MappingStrategy example and CDO Questions.
Goto Forum:
  


Current Time: Fri Apr 19 00:07:31 GMT 2024

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

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

Back to the top