summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaspar De Groot2009-12-28 05:25:24 (EST)
committerCaspar De Groot2009-12-28 05:25:24 (EST)
commit44453ea65510c656ee9a39604da2cb5ca2296a8e (patch)
tree13c8db6507f6deee70b2d5646cad70e7b4c522f2
parentbb1a711dc08e9842f45bd8d5b1ff53348bce1405 (diff)
downloadcdo-44453ea65510c656ee9a39604da2cb5ca2296a8e.zip
cdo-44453ea65510c656ee9a39604da2cb5ca2296a8e.tar.gz
cdo-44453ea65510c656ee9a39604da2cb5ca2296a8e.tar.bz2
[292372] TwoLevelCache fails to revise revisions kept in L2
https://bugs.eclipse.org/bugs/show_bug.cgi?id=292372
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/two/TwoLevelRevisionCache.java24
1 files changed, 23 insertions, 1 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/two/TwoLevelRevisionCache.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/two/TwoLevelRevisionCache.java
index 94cbcb9..51af94e 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/two/TwoLevelRevisionCache.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/two/TwoLevelRevisionCache.java
@@ -118,7 +118,29 @@ public class TwoLevelRevisionCache extends Lifecycle implements CDORevisionCache
public boolean addRevision(InternalCDORevision revision)
{
- return level1.addRevision(revision);
+ boolean added = level1.addRevision(revision);
+
+ // Bugzilla 292372: If a new current revision was added to level1, we must check whether
+ // level2 contains a stale current revision, and revise that revision if possible
+ CDOID id = revision.getID();
+ if (added && revision.isCurrent())
+ {
+ InternalCDORevision rev2 = level2.getRevision(id);
+ if (rev2 != null && rev2.isCurrent())
+ {
+ // We can only revise if the revisions are consecutive
+ if (revision.getVersion() - rev2.getVersion() == 1)
+ {
+ rev2.setRevised(revision.getCreated() - 1);
+ }
+ else
+ {
+ level2.removeRevision(id, rev2.getVersion());
+ }
+ }
+ }
+
+ return added;
}
public InternalCDORevision removeRevision(CDOID id, int version)