Skip to content
Permalink
Browse files
OAK-9465 | Avoid isActive check during filtering for ES indexes (#306)
  • Loading branch information
nit0906 committed Jun 30, 2021
1 parent c91e018 commit 45e05adb16ce65b2867b0de48a86291a8f01720d
Showing 4 changed files with 19 additions and 3 deletions.
@@ -738,6 +738,11 @@ protected boolean filterReplacedIndexes() {
return tracker.getMountInfoProvider().hasNonDefaultMounts();
}

@Override
protected boolean runIsActiveIndexCheck() {
return filterReplacedIndexes();
}

@Override
protected SizeEstimator getSizeEstimator(IndexPlan plan) {
return () -> {
@@ -156,4 +156,9 @@ private static boolean shouldInclude(String path, Filter.PathRestriction pathRes
protected boolean filterReplacedIndexes() {
return true;
}

@Override
protected boolean runIsActiveIndexCheck() {
return false;
}
}
@@ -94,6 +94,12 @@ public abstract class FulltextIndex implements AdvancedQueryIndex, QueryIndex, N
*/
protected abstract boolean filterReplacedIndexes();

/*
* Whether the isActiveIndex check should run during filtering of replaced indexes.
*
*/
protected abstract boolean runIsActiveIndexCheck();

/**
* Returns the {@link FulltextIndexPlanner} for the specified arguments
*/
@@ -111,7 +117,7 @@ public List<IndexPlan> getPlans(Filter filter, List<OrderEntry> sortOrder, NodeS
Collection<String> indexPaths = new IndexLookup(rootState, getIndexDefinitionPredicate())
.collectIndexNodePaths(filter);
if (filterReplacedIndexes()) {
indexPaths = IndexName.filterReplacedIndexes(indexPaths, rootState);
indexPaths = IndexName.filterReplacedIndexes(indexPaths, rootState, runIsActiveIndexCheck());
}
List<IndexPlan> plans = Lists.newArrayListWithCapacity(indexPaths.size());
for (String path : indexPaths) {
@@ -201,11 +201,11 @@ public IndexName getLatestProduct(List<IndexName> all) {
* @param rootState the root node state (used to find hidden nodes)
* @return the filtered list
*/
public static Collection<String> filterReplacedIndexes(Collection<String> indexPaths, NodeState rootState) {
public static Collection<String> filterReplacedIndexes(Collection<String> indexPaths, NodeState rootState, boolean checkIsActive) {
HashMap<String, IndexName> latestVersions = new HashMap<String, IndexName>();
for (String p : indexPaths) {
IndexName indexName = IndexName.parse(p);
if (indexName.isVersioned) {
if (indexName.isVersioned && checkIsActive) {
// which might not be a good idea - instead, it should check if the composite node store is used
// (but how?)
if (!isIndexActive(p, rootState)) {

0 comments on commit 45e05ad

Please sign in to comment.