diff options
author | Zoltan Ujhelyi | 2017-10-20 13:03:34 +0000 |
---|---|---|
committer | Zoltan Ujhelyi | 2017-10-31 09:41:57 +0000 |
commit | 93c7d4ef3ecf2945359ff740e920a14853c4bc17 (patch) | |
tree | 1cccc531ad0f379d7208c31b4b8281a16b2eaeae | |
parent | 8dfe52d1c4f58b1d4b39566b4fed8f3051ae9aea (diff) | |
download | org.eclipse.viatra-1.6-maintenance.tar.gz org.eclipse.viatra-1.6-maintenance.tar.xz org.eclipse.viatra-1.6-maintenance.zip |
[526225] Fix a regression related to statistics indexing1.6.21.6-maintenance
The fix for bug 518356
(http://git.eclipse.org/c/viatra/org.eclipse.viatra.git/commit/?id=aee1e492e61a238edd804dba7becd53af5a6f664
) erased the statistics indexes before executing a full indexing.
However, when moving model elements outside of the model scope, this
might have resulted in clearing the statistics when it is not
recalculated.
This change (backported from master) fixes the issue by only clearing
the stats store if the old indexing level had statistics indexing but
did not have instance indexing.
Conflicts:
query/plugins/org.eclipse.viatra.query.runtime.base/src/org/eclipse/viatra/query/runtime/base/core/NavigationHelperImpl.java
Change-Id: I2d7fe18ccbc4c0f43199a42f753b50edf96ff114
Signed-off-by: Zoltan Ujhelyi <ujhelyiz@incquerylabs.com>
-rw-r--r-- | query/plugins/org.eclipse.viatra.query.runtime.base/src/org/eclipse/viatra/query/runtime/base/core/NavigationHelperImpl.java | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/query/plugins/org.eclipse.viatra.query.runtime.base/src/org/eclipse/viatra/query/runtime/base/core/NavigationHelperImpl.java b/query/plugins/org.eclipse.viatra.query.runtime.base/src/org/eclipse/viatra/query/runtime/base/core/NavigationHelperImpl.java index 38dd00265..f34dc5209 100644 --- a/query/plugins/org.eclipse.viatra.query.runtime.base/src/org/eclipse/viatra/query/runtime/base/core/NavigationHelperImpl.java +++ b/query/plugins/org.eclipse.viatra.query.runtime.base/src/org/eclipse/viatra/query/runtime/base/core/NavigationHelperImpl.java @@ -1263,6 +1263,8 @@ public class NavigationHelperImpl implements NavigationHelper { delayTraversals = false; callable = null; + // This set collects all types whose indexing level increases from statistics to full + Set<Object> moveFromStatsToFullRequests = new HashSet<>(); for(Entry<Object, IndexingLevel> entry: observedFeatures.entrySet()){ IndexingLevel requested = delayedFeatures.get(entry.getKey()); if (requested != null){ @@ -1270,9 +1272,12 @@ public class NavigationHelperImpl implements NavigationHelper { IndexingLevel merged = requested.merge(old); if (merged == old){ delayedFeatures.remove(entry.getKey()); - }else{ + } else { delayedFeatures.put(entry.getKey(), merged); } + if (merged.hasInstances() && old.hasStatistics() && !old.hasInstances()) { + moveFromStatsToFullRequests.add(entry.getKey()); + } } } for(Entry<Object, IndexingLevel> entry: directlyObservedClasses.entrySet()){ @@ -1285,6 +1290,9 @@ public class NavigationHelperImpl implements NavigationHelper { } else{ delayedClasses.put(entry.getKey(), merged); } + if (merged.hasInstances() && old.hasStatistics() && !old.hasInstances()) { + moveFromStatsToFullRequests.add(entry.getKey()); + } } } for(Entry<Object, IndexingLevel> entry: observedDataTypes.entrySet()){ @@ -1297,9 +1305,14 @@ public class NavigationHelperImpl implements NavigationHelper { } else { delayedDataTypes.put(entry.getKey(), merged); } + if (merged.hasInstances() && old.hasStatistics() && !old.hasInstances()) { + moveFromStatsToFullRequests.add(entry.getKey()); + } } } + + boolean classesWarrantTraversal = !Maps .difference(delayedClasses, getAllObservedClassesInternal()).areEqual(); @@ -1321,19 +1334,16 @@ public class NavigationHelperImpl implements NavigationHelper { delayedDataTypes); // Instance indexing would add extra entries to the statistics store, so we have to clean the - // appropriate entries. If no re-traversal is required, it is detected earlier; at this point we - // only have to consider the target indexing level. See bug + // appropriate entries. At this point we simply empty the stats store for elements where + // indexing level is increased from statistics to full. See bug // https://bugs.eclipse.org/bugs/show_bug.cgi?id=518356 for more details. - + // Technically, the statsStore cleanup seems only necessary for EDataTypes; otherwise everything // works as expected, but it seems a better idea to do the cleanup for all types in the same way - for (Entry<Object, IndexingLevel> entry : Iterables.concat(toGatherClasses.entrySet(), - toGatherFeatures.entrySet(), toGatherDataTypes.entrySet())) { - if (entry.getValue().hasInstances()) { - statsStore.removeType(entry.getKey()); - } + for (Object type : moveFromStatsToFullRequests) { + statsStore.removeType(type); } - + if (classesWarrantTraversal || !toGatherFeatures.isEmpty() || !toGatherDataTypes.isEmpty()) { // repeat the cycle with this visit final NavigationHelperVisitor visitor = new NavigationHelperVisitor.TraversingVisitor(this, |