Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2013-03-06 10:04:00 -0500
committerEike Stepper2013-03-07 08:44:57 -0500
commitf80f4be34da8b3290d671676c2d69c13e6180b33 (patch)
tree94c0a5083f8f59a7bf311decc8cd030ed9b14c72
parented8cc36a13e647f7841ee33fb84c8cb3aa309cd2 (diff)
downloadcdo-f80f4be34da8b3290d671676c2d69c13e6180b33.tar.gz
cdo-f80f4be34da8b3290d671676c2d69c13e6180b33.tar.xz
cdo-f80f4be34da8b3290d671676c2d69c13e6180b33.zip
[401763] Make CDO Server more robust against data dictionary changes
https://bugs.eclipse.org/bugs/show_bug.cgi?id=401763
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/CDODBSchema.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DurableLockingManager.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ExternalReferenceManager.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditListTableMappingWithRanges.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingListTableMappingWithRanges.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/ObjectTypeTable.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java18
9 files changed, 34 insertions, 30 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/CDODBSchema.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/CDODBSchema.java
index f03b3cf777..6445d04ab9 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/CDODBSchema.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/CDODBSchema.java
@@ -35,7 +35,7 @@ public class CDODBSchema extends DBSchema
public static final IDBTable PROPERTIES = INSTANCE.addTable("cdo_properties"); //$NON-NLS-1$
public static final IDBField PROPERTIES_NAME = //
- PROPERTIES.addField("name", DBType.VARCHAR, 255); //$NON-NLS-1$
+ PROPERTIES.addField("name", DBType.VARCHAR, 255, true); //$NON-NLS-1$
public static final IDBField PROPERTIES_VALUE = //
PROPERTIES.addField("value", DBType.LONGVARCHAR); //$NON-NLS-1$
@@ -60,7 +60,7 @@ public class CDODBSchema extends DBSchema
public static final IDBTable PACKAGE_UNITS = INSTANCE.addTable("cdo_package_units"); //$NON-NLS-1$
public static final IDBField PACKAGE_UNITS_ID = //
- PACKAGE_UNITS.addField("id", DBType.VARCHAR, 255); //$NON-NLS-1$
+ PACKAGE_UNITS.addField("id", DBType.VARCHAR, 255, true); //$NON-NLS-1$
public static final IDBField PACKAGE_UNITS_ORIGINAL_TYPE = //
PACKAGE_UNITS.addField("original_type", DBType.INTEGER); //$NON-NLS-1$
@@ -80,7 +80,7 @@ public class CDODBSchema extends DBSchema
public static final IDBTable PACKAGE_INFOS = INSTANCE.addTable("cdo_package_infos"); //$NON-NLS-1$
public static final IDBField PACKAGE_INFOS_URI = //
- PACKAGE_INFOS.addField("uri", DBType.VARCHAR, 255); //$NON-NLS-1$
+ PACKAGE_INFOS.addField("uri", DBType.VARCHAR, 255, true); //$NON-NLS-1$
public static final IDBField PACKAGE_INFOS_PARENT = //
PACKAGE_INFOS.addField("parent", DBType.VARCHAR, 255); //$NON-NLS-1$
@@ -103,7 +103,7 @@ public class CDODBSchema extends DBSchema
public static final IDBTable BRANCHES = INSTANCE.addTable("cdo_branches"); //$NON-NLS-1$
public static final IDBField BRANCHES_ID = //
- BRANCHES.addField("id", DBType.INTEGER); //$NON-NLS-1$
+ BRANCHES.addField("id", DBType.INTEGER, true); //$NON-NLS-1$
public static final IDBField BRANCHES_NAME = //
BRANCHES.addField("name", DBType.VARCHAR); //$NON-NLS-1$
@@ -136,7 +136,7 @@ public class CDODBSchema extends DBSchema
public static final IDBTable COMMIT_INFOS = INSTANCE.addTable("cdo_commit_infos"); //$NON-NLS-1$
public static final IDBField COMMIT_INFOS_TIMESTAMP = //
- COMMIT_INFOS.addField("commit_time", DBType.BIGINT); //$NON-NLS-1$
+ COMMIT_INFOS.addField("commit_time", DBType.BIGINT, true); //$NON-NLS-1$
public static final IDBField COMMIT_INFOS_PREVIOUS_TIMESTAMP = //
COMMIT_INFOS.addField("previous_time", DBType.BIGINT); //$NON-NLS-1$
@@ -169,7 +169,7 @@ public class CDODBSchema extends DBSchema
public static final IDBTable LOBS = INSTANCE.addTable("cdo_lobs"); //$NON-NLS-1$
public static final IDBField LOBS_ID = //
- LOBS.addField("id", DBType.VARCHAR, 64); //$NON-NLS-1$
+ LOBS.addField("id", DBType.VARCHAR, 64, true); //$NON-NLS-1$
public static final IDBField LOBS_SIZE = //
LOBS.addField("lsize", DBType.BIGINT); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DurableLockingManager.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DurableLockingManager.java
index f75006b2f2..1bc6582675 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DurableLockingManager.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DurableLockingManager.java
@@ -389,7 +389,7 @@ public class DurableLockingManager extends Lifecycle
// Lock areas
lockAreas = schema.addTable("cdo_lock_areas");
- lockAreasID = lockAreas.addField("id", DBType.VARCHAR);
+ lockAreasID = lockAreas.addField("id", DBType.VARCHAR, true);
lockAreasUser = lockAreas.addField("user_id", DBType.VARCHAR);
lockAreasBranch = lockAreas.addField("view_branch", DBType.INTEGER);
lockAreasTime = lockAreas.addField("view_time", DBType.BIGINT);
@@ -400,8 +400,8 @@ public class DurableLockingManager extends Lifecycle
// Locks
locks = schema.addTable("cdo_locks");
- locksArea = locks.addField("area_id", DBType.VARCHAR);
- locksObject = locks.addField("object_id", idHandler.getDBType(), store.getIDColumnLength());
+ locksArea = locks.addField("area_id", DBType.VARCHAR, true);
+ locksObject = locks.addField("object_id", idHandler.getDBType(), store.getIDColumnLength(), true);
locksGrade = locks.addField("lock_grade", DBType.INTEGER);
locks.addIndex(IDBIndex.Type.PRIMARY_KEY, locksArea, locksObject);
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ExternalReferenceManager.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ExternalReferenceManager.java
index 600214a749..c8034bfbf3 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ExternalReferenceManager.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ExternalReferenceManager.java
@@ -188,7 +188,7 @@ public class ExternalReferenceManager extends Lifecycle
IDBStore store = idHandler.getStore();
table = store.getDBSchema().addTable("cdo_external_refs"); //$NON-NLS-1$
- idField = table.addField("id", idHandler.getDBType(), store.getIDColumnLength()); //$NON-NLS-1$
+ idField = table.addField("id", idHandler.getDBType(), store.getIDColumnLength(), true); //$NON-NLS-1$
uriField = table.addField("uri", DBType.VARCHAR, 1024); //$NON-NLS-1$
timestampField = table.addField("committime", DBType.BIGINT); //$NON-NLS-1$
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 f08844d000..64e219c194 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
@@ -133,11 +133,11 @@ public abstract class AbstractHorizontalClassMapping implements IClassMapping
if (branchField != null)
{
- table.addIndex(IDBIndex.Type.UNIQUE, idField, versionField, branchField);
+ table.addIndex(IDBIndex.Type.PRIMARY_KEY, idField, versionField, branchField);
}
else
{
- table.addIndex(IDBIndex.Type.UNIQUE, idField, versionField);
+ table.addIndex(IDBIndex.Type.PRIMARY_KEY, idField, versionField);
}
table.addIndex(IDBIndex.Type.NON_UNIQUE, idField, revisedField);
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java
index 4e3cb45371..6c7d2e3760 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java
@@ -96,18 +96,18 @@ public abstract class AbstractListTableMapping extends BasicAbstractListTableMap
for (int i = 0; i < fields.length; i++)
{
- dbFields[i] = table.addField(fields[i].getName(), fields[i].getDbType(), fields[i].getPrecision());
+ dbFields[i] = table.addField(fields[i].getName(), fields[i].getDbType(), fields[i].getPrecision(), true);
}
// add field for list index
- dbFields[dbFields.length - 1] = table.addField(CDODBSchema.LIST_IDX, DBType.INTEGER);
+ dbFields[dbFields.length - 1] = table.addField(CDODBSchema.LIST_IDX, DBType.INTEGER, true);
// add field for value
typeMapping = mappingStrategy.createValueMapping(getFeature());
typeMapping.createDBField(table, CDODBSchema.LIST_VALUE);
// add table indexes
- table.addIndex(Type.UNIQUE, dbFields);
+ table.addIndex(Type.PRIMARY_KEY, dbFields);
}
protected abstract FieldInfo[] getKeyFields();
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditListTableMappingWithRanges.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditListTableMappingWithRanges.java
index 22364ac71d..adaca4aac6 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditListTableMappingWithRanges.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditListTableMappingWithRanges.java
@@ -133,10 +133,10 @@ public class AuditListTableMappingWithRanges extends BasicAbstractListTableMappi
table = store.getDBSchema().addTable(tableName);
IDBField[] dbFields = new IDBField[4];
- dbFields[0] = table.addField(CDODBSchema.LIST_REVISION_ID, idType, idLength);
+ dbFields[0] = table.addField(CDODBSchema.LIST_REVISION_ID, idType, idLength, true);
dbFields[1] = table.addField(CDODBSchema.LIST_REVISION_VERSION_ADDED, DBType.INTEGER);
dbFields[2] = table.addField(CDODBSchema.LIST_REVISION_VERSION_REMOVED, DBType.INTEGER);
- dbFields[3] = table.addField(CDODBSchema.LIST_IDX, DBType.INTEGER);
+ dbFields[3] = table.addField(CDODBSchema.LIST_IDX, DBType.INTEGER, true);
// add field for value
typeMapping = getMappingStrategy().createValueMapping(getFeature());
@@ -144,7 +144,7 @@ public class AuditListTableMappingWithRanges extends BasicAbstractListTableMappi
// TODO think about indexes
// add table indexes
- table.addIndex(Type.UNIQUE, dbFields);
+ table.addIndex(Type.NON_UNIQUE, dbFields);
}
public Collection<IDBTable> getDBTables()
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 4cc3ecde1e..eee03722d8 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
@@ -138,11 +138,11 @@ public class BranchingListTableMappingWithRanges extends BasicAbstractListTableM
table = store.getDBSchema().addTable(tableName);
IDBField[] dbFields = new IDBField[5];
- dbFields[0] = table.addField(CDODBSchema.LIST_REVISION_ID, idType, idLength);
- dbFields[1] = table.addField(CDODBSchema.LIST_REVISION_BRANCH, DBType.INTEGER);
+ dbFields[0] = table.addField(CDODBSchema.LIST_REVISION_ID, idType, idLength, true);
+ dbFields[1] = table.addField(CDODBSchema.LIST_REVISION_BRANCH, DBType.INTEGER, true);
dbFields[2] = table.addField(CDODBSchema.LIST_REVISION_VERSION_ADDED, DBType.INTEGER);
dbFields[3] = table.addField(CDODBSchema.LIST_REVISION_VERSION_REMOVED, DBType.INTEGER);
- dbFields[4] = table.addField(CDODBSchema.LIST_IDX, DBType.INTEGER);
+ dbFields[4] = table.addField(CDODBSchema.LIST_IDX, DBType.INTEGER, true);
// add field for value
typeMapping = getMappingStrategy().createValueMapping(getFeature());
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/ObjectTypeTable.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/ObjectTypeTable.java
index d346bab751..4cd4cb37b5 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/ObjectTypeTable.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/ObjectTypeTable.java
@@ -230,10 +230,10 @@ public class ObjectTypeTable extends AbstractObjectTypeMapper
int idLength = store.getIDColumnLength();
table = store.getDBSchema().addTable(CDODBSchema.CDO_OBJECTS);
- idField = table.addField(CDODBSchema.ATTRIBUTES_ID, idType, idLength);
+ idField = table.addField(CDODBSchema.ATTRIBUTES_ID, idType, idLength, true);
typeField = table.addField(CDODBSchema.ATTRIBUTES_CLASS, idType, idLength);
timeField = table.addField(CDODBSchema.ATTRIBUTES_CREATED, DBType.BIGINT);
- table.addIndex(IDBIndex.Type.UNIQUE, idField);
+ table.addIndex(IDBIndex.Type.PRIMARY_KEY, idField);
IDBAdapter dbAdapter = store.getDBAdapter();
IDBStoreAccessor writer = store.getWriter(null);
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java
index cb27d1c802..2454786255 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java
@@ -281,9 +281,10 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf
CDOServerUtil.addRepository(serverContainer, repository);
}
}
- catch (Exception ex)
+ catch (RuntimeException ex)
{
deactivateRepositories();
+ throw ex;
}
}
}
@@ -385,13 +386,16 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf
public void tearDown() throws Exception
{
deactivateServerBrowser();
- if (!isOptimizing() || mustLeaveCleanRepos())
+ if (repositories != null)
{
- deactivateRepositories();
- }
- else
- {
- removeResourcePathChecker();
+ if (!isOptimizing() || mustLeaveCleanRepos())
+ {
+ deactivateRepositories();
+ }
+ else
+ {
+ removeResourcePathChecker();
+ }
}
resourcePathChecker = null;

Back to the top