Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2018-04-24 06:20:57 -0400
committerEike Stepper2018-04-24 06:20:57 -0400
commit4a379557a82538f7688666d156f1814e7f37feb7 (patch)
treedcaa0709ba091535ecca6791123d5fe7d4101716
parent3b9bf918e6e6029c6165bead0c4222dd6ff13fea (diff)
downloadcdo-4a379557a82538f7688666d156f1814e7f37feb7.tar.gz
cdo-4a379557a82538f7688666d156f1814e7f37feb7.tar.xz
cdo-4a379557a82538f7688666d156f1814e7f37feb7.zip
[430528] CDO Server Exporter doesn't handle DetachedRevisions
https://bugs.eclipse.org/bugs/show_bug.cgi?id=430528
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java26
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingClassMapping.java26
3 files changed, 47 insertions, 12 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 39a8c36597..01d50f44b3 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
@@ -1300,13 +1300,14 @@ public class DBStoreAccessor extends StoreAccessor implements IDBStoreAccessor,
public void rawStore(InternalCDORevision revision, OMMonitor monitor)
{
CDOID id = revision.getID();
+ EClass eClass = revision.getEClass();
- CDOClassifierRef classifierRef = getStore().getMappingStrategy().readObjectType(this, id);
- boolean isFirstRevision = classifierRef == null;
+ IMappingStrategy mappingStrategy = getStore().getMappingStrategy();
+ CDOClassifierRef classifierRef = mappingStrategy.readObjectType(this, id);
+ boolean isFirstRevision = classifierRef == null;
if (!isFirstRevision)
{
- EClass eClass = revision.getEClass();
boolean namesMatch = classifierRef.getClassifierName().equals(eClass.getName());
boolean packagesMatch = classifierRef.getPackageURI().equals(eClass.getEPackage().getNsURI());
if (!namesMatch || !packagesMatch)
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 b342745cdb..97d49c19b6 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
@@ -42,6 +42,7 @@ import org.eclipse.emf.cdo.server.db.mapping.ITypeMapping;
import org.eclipse.emf.cdo.server.internal.db.DBIndexAnnotation;
import org.eclipse.emf.cdo.server.internal.db.bundle.OM;
import org.eclipse.emf.cdo.server.internal.db.mapping.AbstractMappingStrategy;
+import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranch;
import org.eclipse.emf.cdo.spi.common.commit.CDOChangeSetSegment;
import org.eclipse.emf.cdo.spi.common.revision.DetachedCDORevision;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDOList;
@@ -609,6 +610,25 @@ public abstract class AbstractHorizontalClassMapping implements IClassMapping, I
public void writeRevision(IDBStoreAccessor accessor, InternalCDORevision revision, boolean mapType, boolean revise, OMMonitor monitor)
{
+ CDOID id = revision.getID();
+ InternalCDOBranch branch = revision.getBranch();
+ long timeStamp = revision.getTimeStamp();
+
+ // A DetachedCDORevision can only come from DBStoreAccessor.rawStore().
+ if (revision instanceof DetachedCDORevision)
+ {
+ int version = revision.getVersion();
+ detachAttributes(accessor, id, version, branch, timeStamp, monitor);
+
+ long revised = revision.getRevised();
+ if (revised != CDOBranchPoint.UNSPECIFIED_DATE)
+ {
+ reviseOldRevision(accessor, id, branch, revised);
+ }
+
+ return;
+ }
+
// If the repository's root resource ID is not yet set, then this must be the initial initRootResource()
// commit. The duplicate check is certainly not needed in this case, and it appears that Mysql has problems
// with it (Table definition has changed, please retry transaction), see bug 482886.
@@ -622,16 +642,14 @@ public abstract class AbstractHorizontalClassMapping implements IClassMapping, I
try
{
async = monitor.forkAsync();
- CDOID id = revision.getID();
if (mapType)
{
- long timeStamp = revision.getTimeStamp();
mappingStrategy.putObjectType(accessor, timeStamp, id, eClass);
}
else if (revise)
{
- long revised = revision.getTimeStamp() - 1;
- reviseOldRevision(accessor, id, revision.getBranch(), revised);
+ long revised = timeStamp - 1;
+ reviseOldRevision(accessor, id, branch, revised);
for (IListMapping mapping : getListMappings())
{
mapping.objectDetached(accessor, id, revised);
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingClassMapping.java
index dabbffafa3..e393717ea9 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingClassMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingClassMapping.java
@@ -576,6 +576,25 @@ public class HorizontalBranchingClassMapping extends AbstractHorizontalClassMapp
@Override
public void writeRevision(IDBStoreAccessor accessor, InternalCDORevision revision, boolean mapType, boolean revise, OMMonitor monitor)
{
+ CDOID id = revision.getID();
+ int version = revision.getVersion();
+ InternalCDOBranch branch = revision.getBranch();
+ long timeStamp = revision.getTimeStamp();
+
+ // A DetachedCDORevision can only come from DBStoreAccessor.rawStore().
+ if (revision instanceof DetachedCDORevision)
+ {
+ detachAttributes(accessor, id, version, branch, timeStamp, monitor);
+
+ long revised = revision.getRevised();
+ if (revised != CDOBranchPoint.UNSPECIFIED_DATE)
+ {
+ reviseOldRevision(accessor, id, branch, revised);
+ }
+
+ return;
+ }
+
Async async = null;
monitor.begin(10);
@@ -584,11 +603,9 @@ public class HorizontalBranchingClassMapping extends AbstractHorizontalClassMapp
try
{
async = monitor.forkAsync();
- CDOID id = revision.getID();
if (mapType)
{
// Put new objects into objectTypeMapper
- long timeStamp = revision.getTimeStamp();
EClass eClass = getEClass();
AbstractHorizontalMappingStrategy mappingStrategy = (AbstractHorizontalMappingStrategy)getMappingStrategy();
@@ -598,11 +615,10 @@ public class HorizontalBranchingClassMapping extends AbstractHorizontalClassMapp
}
}
- if (!mapType && revise && revision.getVersion() > CDOBranchVersion.FIRST_VERSION)
+ if (!mapType && revise && version > CDOBranchVersion.FIRST_VERSION)
{
// If revision is not the first one, revise the old revision
- long revised = revision.getTimeStamp() - 1;
- InternalCDOBranch branch = revision.getBranch();
+ long revised = timeStamp - 1;
reviseOldRevision(accessor, id, branch, revised);
for (IListMapping mapping : getListMappings())

Back to the top