diff options
author | Eike Stepper | 2013-03-12 07:48:24 +0000 |
---|---|---|
committer | Eike Stepper | 2013-03-12 08:11:57 +0000 |
commit | 077d8780066f74d02b2716d329ef55afbd1d41ee (patch) | |
tree | 5db9211b8ced79ded9eb6a2ae7da70800c6ab1cd /plugins/org.eclipse.emf.cdo.server.db | |
parent | f86cc1a1116425a9bc0ace0dfc1aa1b354f51cca (diff) | |
download | cdo-077d8780066f74d02b2716d329ef55afbd1d41ee.tar.gz cdo-077d8780066f74d02b2716d329ef55afbd1d41ee.tar.xz cdo-077d8780066f74d02b2716d329ef55afbd1d41ee.zip |
[401763] Make CDO Server more robust against data dictionary changes
https://bugs.eclipse.org/bugs/show_bug.cgi?id=401763
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.server.db')
5 files changed, 18 insertions, 18 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java index 0e94199c24..5320675c9e 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java @@ -780,7 +780,7 @@ public class DBStoreAccessor extends StoreAccessor implements IDBStoreAccessor, connectionKeepAliveTask.cancel(); connectionKeepAliveTask = null; - ObjectUtil.close(connection); + DBUtil.close(connection); connection = null; } diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/AbstractMappingStrategy.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/AbstractMappingStrategy.java index be8da39a9d..3f6f07172b 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/AbstractMappingStrategy.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/AbstractMappingStrategy.java @@ -46,7 +46,6 @@ import org.eclipse.net4j.db.IDBSchemaTransaction; import org.eclipse.net4j.db.ddl.IDBSchema; import org.eclipse.net4j.db.ddl.IDBTable; import org.eclipse.net4j.util.ImplementationError; -import org.eclipse.net4j.util.ObjectUtil; import org.eclipse.net4j.util.StringUtil; import org.eclipse.net4j.util.collection.CloseableIterator; import org.eclipse.net4j.util.lifecycle.Lifecycle; @@ -424,17 +423,16 @@ public abstract class AbstractMappingStrategy extends Lifecycle implements IMapp try { async = monitor.forkAsync(); - IDBSchemaTransaction schemaTransaction = null; + IDBSchemaTransaction schemaTransaction = store.getDatabase().openSchemaTransaction(); try { - schemaTransaction = store.getDatabase().openSchemaTransaction(); mapPackageUnits(packageUnits, connection, false); schemaTransaction.commit(); } finally { - ObjectUtil.close(schemaTransaction); + schemaTransaction.close(); if (async != null) { async.stop(); @@ -449,7 +447,17 @@ public abstract class AbstractMappingStrategy extends Lifecycle implements IMapp public void removeMapping(Connection connection, InternalCDOPackageUnit[] packageUnits) { - mapPackageUnits(packageUnits, connection, true); + IDBSchemaTransaction schemaTransaction = store.getDatabase().openSchemaTransaction(); + + try + { + mapPackageUnits(packageUnits, connection, true); + schemaTransaction.commit(); + } + finally + { + schemaTransaction.close(); + } } private void mapPackageUnits(InternalCDOPackageUnit[] packageUnits, Connection connection, boolean unmap) @@ -492,17 +500,11 @@ public abstract class AbstractMappingStrategy extends Lifecycle implements IMapp if (unmap) { - int todo; - // IClassMapping mapping = removeClassMapping(eClass); - // getStore().getDBAdapter().dropTables(mapping.getDBTables(), connection); + removeClassMapping(eClass); } else { createClassMapping(eClass); - - // TODO Bug 296087: Before we go ahead with creation, we should check if it's already there - // IClassMapping mapping = createClassMapping(eClass); - // getStore().getDBAdapter().createTables(mapping.getDBTables(), connection); } } } diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java index df97a1d1bb..fb144a7d25 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java @@ -445,7 +445,7 @@ public abstract class AbstractHorizontalClassMapping implements IClassMapping, I CDOID existingID = accessor.readResourceID(folderID, name, revision.getBranch().getHead()); if (existingID != null && !existingID.equals(revision.getID())) { - throw new IllegalStateException("Duplicate resource or folder: " + name + " in folder " + folderID); //$NON-NLS-1$ //$NON-NLS-2$ + throw new IllegalStateException("Duplicate resource node in folder " + folderID + ": " + name); //$NON-NLS-1$ //$NON-NLS-2$ } } diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingFeatureMapTableMappingWithRanges.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingFeatureMapTableMappingWithRanges.java index 3d2aa629c4..1568f455f8 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingFeatureMapTableMappingWithRanges.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingFeatureMapTableMappingWithRanges.java @@ -1486,8 +1486,7 @@ public class BranchingFeatureMapTableMappingWithRanges extends AbstractBasicList CDOBranchPoint base = branch.getBase(); if (base.getBranch() == null) { - // Branch is main branch! - throw new IllegalArgumentException("Base of main branch is null"); + throw new IllegalArgumentException("Base branch is null: " + branch); } InternalCDORevisionManager revisionManager = repository.getRevisionManager(); diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingListTableMappingWithRanges.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingListTableMappingWithRanges.java index 5baa748f4b..e6e0ecedff 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingListTableMappingWithRanges.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingListTableMappingWithRanges.java @@ -1367,8 +1367,7 @@ public class BranchingListTableMappingWithRanges extends AbstractBasicListTableM CDOBranchPoint base = branch.getBase(); if (base.getBranch() == null) { - // Branch is main branch! - throw new IllegalArgumentException("Base of main branch is null"); + throw new IllegalArgumentException("Base branch is null: " + branch); } InternalCDORevisionManager revisionManager = repository.getRevisionManager(); |