summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-09-03 10:45:18 (EDT)
committerEike Stepper2007-09-03 10:45:18 (EDT)
commit4775ad921aa23d1ec4d51b37816fac048c1b175b (patch)
tree75acfb86eb2a27b219d4e49e5de2c96e2cae3ed5
parent07efade9da0b69feed8375afbd11930bf95fe1a8 (diff)
downloadcdo-4775ad921aa23d1ec4d51b37816fac048c1b175b.zip
cdo-4775ad921aa23d1ec4d51b37816fac048c1b175b.tar.gz
cdo-4775ad921aa23d1ec4d51b37816fac048c1b175b.tar.bz2
[201265] Handling large collections by loading CDOIDs in chunks
https://bugs.eclipse.org/bugs/show_bug.cgi?id=201265
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadChunkIndication.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadRevisionIndication.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreReader.java24
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOLegacyImpl.java15
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java3
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionRequest.java3
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadChunkRequest.java3
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionRequest.java3
11 files changed, 58 insertions, 24 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 e3f7436..3186e8e 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
@@ -411,7 +411,7 @@ public class DBStoreAccessor implements IDBStoreAccessor
return store.getMappingStrategy().readObjectType(this, id);
}
- public CDORevision readRevision(CDOID id)
+ public CDORevision readRevision(CDOID id, int referenceChunk)
{
if (TRACER.isEnabled())
{
@@ -427,7 +427,7 @@ public class DBStoreAccessor implements IDBStoreAccessor
return revision;
}
- public CDORevision readRevisionByTime(CDOID id, long timeStamp)
+ public CDORevision readRevisionByTime(CDOID id, int referenceChunk, long timeStamp)
{
if (TRACER.isEnabled())
{
@@ -443,7 +443,7 @@ public class DBStoreAccessor implements IDBStoreAccessor
return revision;
}
- public CDORevision readRevisionByVersion(CDOID id, int version)
+ public CDORevision readRevisionByVersion(CDOID id, int referenceChunk, int version)
{
if (TRACER.isEnabled())
{
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java
index 0b9d958..9d8beb1 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java
@@ -77,7 +77,7 @@ public class RevisionManager extends CDORevisionResolverImpl implements IRevisio
protected CDORevisionImpl loadRevision(CDOID id, int referenceChunk)
{
IStoreReader storeReader = StoreUtil.getReader();
- CDORevisionImpl revision = (CDORevisionImpl)storeReader.readRevision(id);
+ CDORevisionImpl revision = (CDORevisionImpl)storeReader.readRevision(id, referenceChunk);
registerObjectType(revision);
return revision;
}
@@ -86,7 +86,7 @@ public class RevisionManager extends CDORevisionResolverImpl implements IRevisio
protected CDORevisionImpl loadRevisionByTime(CDOID id, int referenceChunk, long timeStamp)
{
IStoreReader storeReader = StoreUtil.getReader();
- CDORevisionImpl revision = (CDORevisionImpl)storeReader.readRevisionByTime(id, timeStamp);
+ CDORevisionImpl revision = (CDORevisionImpl)storeReader.readRevisionByTime(id, referenceChunk, timeStamp);
registerObjectType(revision);
return revision;
}
@@ -95,7 +95,7 @@ public class RevisionManager extends CDORevisionResolverImpl implements IRevisio
protected CDORevisionImpl loadRevisionByVersion(CDOID id, int referenceChunk, int version)
{
IStoreReader storeReader = StoreUtil.getReader();
- CDORevisionImpl revision = (CDORevisionImpl)storeReader.readRevisionByVersion(id, version);
+ CDORevisionImpl revision = (CDORevisionImpl)storeReader.readRevisionByVersion(id, referenceChunk, version);
registerObjectType(revision);
return revision;
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadChunkIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadChunkIndication.java
index 6e44567..952f877 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadChunkIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadChunkIndication.java
@@ -20,6 +20,7 @@ import org.eclipse.emf.cdo.protocol.CDOProtocolConstants;
import org.eclipse.emf.cdo.protocol.model.CDOClass;
import org.eclipse.emf.cdo.protocol.model.CDOClassRef;
import org.eclipse.emf.cdo.protocol.model.CDOFeature;
+import org.eclipse.emf.cdo.protocol.revision.CDORevision;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
@@ -36,6 +37,8 @@ public class LoadChunkIndication extends CDOReadIndication
private CDOID id;
+ private int version;
+
private CDOFeature feature;
private int fromIndex;
@@ -56,7 +59,10 @@ public class LoadChunkIndication extends CDOReadIndication
protected void indicating(ExtendedDataInputStream in) throws IOException
{
id = CDOIDImpl.read(in);
- if (PROTOCOL.isEnabled()) PROTOCOL.format("Read ID: {0}", id);
+ if (PROTOCOL.isEnabled()) PROTOCOL.format("Read revision ID: {0}", id);
+
+ version = in.readInt();
+ if (PROTOCOL.isEnabled()) PROTOCOL.format("Read revision version: {0}", version);
CDOClassRef classRef = new CDOClassRefImpl(in, null);
int featureID = in.readInt();
@@ -74,7 +80,7 @@ public class LoadChunkIndication extends CDOReadIndication
@Override
protected void responding(ExtendedDataOutputStream out) throws IOException
{
- CDORevisionImpl revision = getRevisionManager().getRevision(id, CDORevisionImpl.UNCHUNKED);
+ CDORevisionImpl revision = getRevisionManager().getRevisionByVersion(id, CDORevision.UNCHUNKED, version);
MoveableList list = revision.getList(feature);
for (int i = fromIndex; i <= toIndex; i++)
{
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadRevisionIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadRevisionIndication.java
index b7cdda4..3a9de59 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadRevisionIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadRevisionIndication.java
@@ -15,6 +15,7 @@ import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl;
import org.eclipse.emf.cdo.internal.server.bundle.OM;
import org.eclipse.emf.cdo.protocol.CDOID;
import org.eclipse.emf.cdo.protocol.CDOProtocolConstants;
+import org.eclipse.emf.cdo.protocol.revision.CDORevision;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
@@ -68,7 +69,7 @@ public class LoadRevisionIndication extends CDOReadIndication
PROTOCOL.format("Read ID: {0}", id);
}
- referenceChunk = CDORevisionImpl.UNCHUNKED;
+ referenceChunk = CDORevision.UNCHUNKED;
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreReader.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreReader.java
index f7199cd..392a6a8 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreReader.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreReader.java
@@ -52,11 +52,29 @@ public interface IStoreReader extends IStoreAccessor
*/
public CDOClassRef readObjectType(CDOID id);
- public CDORevision readRevision(CDOID id);
+ /**
+ * @param referenceChunk
+ * Must currently be ignored by the implementor of this method.
+ * <p>
+ * TODO Remove this comment when no longer applicable.
+ */
+ public CDORevision readRevision(CDOID id, int referenceChunk);
- public CDORevision readRevisionByTime(CDOID id, long timeStamp);
+ /**
+ * @param referenceChunk
+ * Must currently be ignored by the implementor of this method.
+ * <p>
+ * TODO Remove this comment when no longer applicable.
+ */
+ public CDORevision readRevisionByTime(CDOID id, int referenceChunk, long timeStamp);
- public CDORevision readRevisionByVersion(CDOID id, int version);
+ /**
+ * @param referenceChunk
+ * Must currently be ignored by the implementor of this method.
+ * <p>
+ * TODO Remove this comment when no longer applicable.
+ */
+ public CDORevision readRevisionByVersion(CDOID id, int referenceChunk, int version);
public CDOID readResourceID(String path);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOLegacyImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOLegacyImpl.java
index abe5d10..bb1b06b 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOLegacyImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOLegacyImpl.java
@@ -346,15 +346,18 @@ public abstract class CDOLegacyImpl extends CDOWrapperImpl
if (instanceList != null)
{
clearEList(instanceList);
- List<?> revisionList = (List<?>)value;
- for (Object element : revisionList)
+ if (value != null)
{
- if (feature.isReference())
+ List<?> revisionList = (List<?>)value;
+ for (Object element : revisionList)
{
- element = convertPotentialID(view, element);
- }
+ if (feature.isReference())
+ {
+ element = convertPotentialID(view, element);
+ }
- instanceList.basicAdd(element, null);
+ instanceList.basicAdd(element, null);
+ }
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java
index 4da63ff..9e945a8 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java
@@ -17,6 +17,7 @@ import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl.MoveableLi
import org.eclipse.emf.cdo.protocol.CDOID;
import org.eclipse.emf.cdo.protocol.model.CDOFeature;
import org.eclipse.emf.cdo.protocol.revision.CDOReferenceProxy;
+import org.eclipse.emf.cdo.protocol.revision.CDORevision;
import org.eclipse.emf.cdo.protocol.util.TransportException;
import org.eclipse.net4j.IChannel;
@@ -56,7 +57,7 @@ public class CDORevisionManagerImpl extends CDORevisionResolverImpl implements C
// Get appropriate chunk size
int chunkSize = session.getReferenceChunkSize();
- if (chunkSize == CDORevisionImpl.UNCHUNKED)
+ if (chunkSize == CDORevision.UNCHUNKED)
{
// Can happen if CDOSession.setReferenceChunkSize() was called meanwhile
chunkSize = Integer.MAX_VALUE;
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
index 25e30f7..6955fd6 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
@@ -18,10 +18,10 @@ import org.eclipse.emf.cdo.internal.protocol.CDOIDRangeImpl;
import org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl;
import org.eclipse.emf.cdo.internal.protocol.model.CDOClassRefImpl;
import org.eclipse.emf.cdo.internal.protocol.model.CDOPackageImpl;
-import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl;
import org.eclipse.emf.cdo.protocol.CDOID;
import org.eclipse.emf.cdo.protocol.CDOIDRange;
import org.eclipse.emf.cdo.protocol.CDOProtocolConstants;
+import org.eclipse.emf.cdo.protocol.revision.CDORevision;
import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.net4j.IChannel;
@@ -76,7 +76,7 @@ public class CDOSessionImpl extends Container<CDOView> implements CDOSession
private int sessionID;
- private int referenceChunkSize = CDORevisionImpl.UNCHUNKED;
+ private int referenceChunkSize = CDORevision.UNCHUNKED;
private IFailOverStrategy failOverStrategy;
@@ -146,7 +146,7 @@ public class CDOSessionImpl extends Container<CDOView> implements CDOSession
{
if (referenceChunkSize <= 0)
{
- referenceChunkSize = CDORevisionImpl.UNCHUNKED;
+ referenceChunkSize = CDORevision.UNCHUNKED;
}
this.referenceChunkSize = referenceChunkSize;
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionRequest.java
index abd245d..0e140d9 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionRequest.java
@@ -18,6 +18,7 @@ import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl;
import org.eclipse.emf.cdo.protocol.CDOID;
import org.eclipse.emf.cdo.protocol.CDOIDRange;
import org.eclipse.emf.cdo.protocol.CDOProtocolConstants;
+import org.eclipse.emf.cdo.protocol.revision.CDORevision;
import org.eclipse.net4j.IChannel;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
@@ -119,7 +120,7 @@ public class CommitTransactionRequest extends CDOClientRequest<CommitTransaction
{
InternalCDOObject object = (InternalCDOObject)it.next();
CDORevisionImpl revision = (CDORevisionImpl)object.cdoRevision();
- revision.write(out, transaction, CDORevisionImpl.UNCHUNKED);
+ revision.write(out, transaction, CDORevision.UNCHUNKED);
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadChunkRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadChunkRequest.java
index 1158b4c..93c5250 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadChunkRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadChunkRequest.java
@@ -67,6 +67,9 @@ public class LoadChunkRequest extends CDOClientRequest<CDOID>
if (PROTOCOL.isEnabled()) PROTOCOL.format("Writing revision ID: {0}", revision.getID());
CDOIDImpl.write(out, revision.getID());
+ if (PROTOCOL.isEnabled()) PROTOCOL.format("Writing revision version: {0}", revision.getVersion());
+ out.writeInt(revision.getVersion());
+
if (PROTOCOL.isEnabled()) PROTOCOL.format("Writing feature: {0}", feature);
CDOClassRefImpl classRef = (CDOClassRefImpl)feature.getContainingClass().createClassRef();
classRef.write(out, null);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionRequest.java
index b02fb43..3c7ffb6 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionRequest.java
@@ -14,6 +14,7 @@ import org.eclipse.emf.cdo.internal.protocol.CDOIDImpl;
import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl;
import org.eclipse.emf.cdo.protocol.CDOID;
import org.eclipse.emf.cdo.protocol.CDOProtocolConstants;
+import org.eclipse.emf.cdo.protocol.revision.CDORevision;
import org.eclipse.net4j.IChannel;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
@@ -54,7 +55,7 @@ public class LoadRevisionRequest extends CDOClientRequest<CDORevisionImpl>
@Override
protected void requesting(ExtendedDataOutputStream out) throws IOException
{
- if (referenceChunk == CDORevisionImpl.UNCHUNKED)
+ if (referenceChunk == CDORevision.UNCHUNKED)
{
if (PROTOCOL.isEnabled())
{