Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Winkler2013-01-10 14:58:05 +0000
committerStefan Winkler2013-01-10 14:58:05 +0000
commitefd9c22e7d5b95bae22679b828e5ac432cfa3255 (patch)
tree7247b51bd5d30a78dedb663e92953281ead219ac /plugins
parenta0f424a79a3c2568b8b73ee1961cee81156ea20b (diff)
downloadcdo-efd9c22e7d5b95bae22679b828e5ac432cfa3255.tar.gz
cdo-efd9c22e7d5b95bae22679b828e5ac432cfa3255.tar.xz
cdo-efd9c22e7d5b95bae22679b828e5ac432cfa3255.zip
ASSIGNED - bug 390283: [DB] Incorrect handling of operations ondrops/I20130111-0411
unordered ELists https://bugs.eclipse.org/bugs/show_bug.cgi?id=390283
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditListTableMappingWithRanges.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingListTableMappingWithRanges.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_390283_Test.java2
3 files changed, 14 insertions, 4 deletions
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 7a3e49ba56..22364ac71d 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
@@ -603,7 +603,7 @@ public class AuditListTableMappingWithRanges extends BasicAbstractListTableMappi
int toIdx = delta.getNewPosition();
// optimization: a move from the end of the list to an index that was just removed requires no shifting
- boolean optimizeMove = lastRemovedIndex != -1 && fromIdx == lastIndex && toIdx == lastRemovedIndex;
+ boolean optimizeMove = lastRemovedIndex != -1 && fromIdx == lastIndex - 1 && toIdx == lastRemovedIndex;
if (TRACER.isEnabled())
{
@@ -637,6 +637,12 @@ public class AuditListTableMappingWithRanges extends BasicAbstractListTableMappi
moveOneDown(accessor, id, oldVersion, newVersion, toIdx, fromIdx - 1);
}
}
+ else
+ {
+ // finish the optimized move by resetting lastRemovedIndex
+ lastRemovedIndex = -1;
+ --lastIndex;
+ }
// create the item
addEntry(accessor, id, newVersion, toIdx, value);
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 1a3838f11c..4cc3ecde1e 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
@@ -878,7 +878,7 @@ public class BranchingListTableMappingWithRanges extends BasicAbstractListTableM
int toIdx = delta.getNewPosition();
// optimization: a move from the end of the list to an index that was just removed requires no shifting
- boolean optimizeMove = lastRemovedIndex != -1 && fromIdx == lastIndex && toIdx == lastRemovedIndex;
+ boolean optimizeMove = lastRemovedIndex != -1 && fromIdx == lastIndex - 1 && toIdx == lastRemovedIndex;
if (TRACER.isEnabled())
{
@@ -912,6 +912,12 @@ public class BranchingListTableMappingWithRanges extends BasicAbstractListTableM
moveOneDown(accessor, id, branchID, oldVersion, newVersion, toIdx, fromIdx - 1);
}
}
+ else
+ {
+ // finish the optimized move by resetting lastRemovedIndex
+ lastRemovedIndex = -1;
+ --lastIndex;
+ }
// create the item
addEntry(accessor, id, branchID, newVersion, toIdx, value);
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_390283_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_390283_Test.java
index 50414690c1..81049c2991 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_390283_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_390283_Test.java
@@ -13,7 +13,6 @@ package org.eclipse.emf.cdo.tests.bugzilla;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.tests.AbstractCDOTest;
-import org.eclipse.emf.cdo.tests.config.impl.ConfigTest.Skips;
import org.eclipse.emf.cdo.tests.model6.UnorderedList;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
@@ -26,7 +25,6 @@ import java.util.Arrays;
*
* @author Eike Stepper
*/
-@Skips("DB.ranges")
public class Bugzilla_390283_Test extends AbstractCDOTest
{
public void testAddAfterRemove() throws Exception

Back to the top