8000 don't return any in-progress indexes by jsteemann · Pull Request #10431 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

don't return any in-progress indexes #10431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 14, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
don't return any in-progress indexes
  • Loading branch information
jsteemann committed Nov 13, 2019
commit e49017ff8ff9baa883585323f52451baad77e7df
3 changes: 3 additions & 0 deletions arangod/RestHandler/RestIndexHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ RestStatus RestIndexHandler::getSelectivityEstimates() {
builder.add(StaticStrings::Code, VPackValue(static_cast<int>(rest::ResponseCode::OK)));
builder.add("indexes", VPackValue(VPackValueType::Object));
for (std::shared_ptr<Index> idx : idxs) {
if (idx->inProgress()) {
continue;
}
std::string name = coll->name();
name.push_back(TRI_INDEX_HANDLE_SEPARATOR_CHR);
name.append(std::to_string(idx->id()));
Expand Down
29 changes: 20 additions & 9 deletions arangod/Transaction/Methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,8 @@ std::pair<bool, bool> transaction::Methods::findIndexHandleForAndNode(
auto considerIndex = [&bestIndex, &bestCost, &bestSupportsFilter, &bestSupportsSort,
&indexes, node, reference, itemsInCollection,
&sortCondition](std::shared_ptr<Index> const& idx) -> void {
TRI_ASSERT(!idx->inProgress());

double filterCost = 0.0;
double sortCost = 0.0;
size_t itemsInIndex = itemsInCollection;
Expand Down Expand Up @@ -2941,6 +2943,8 @@ bool transaction::Methods::getIndexForSortCondition(

auto considerIndex = [reference, sortCondition, itemsInIndex, &bestCost, &bestIndex,
&coveredAttributes](std::shared_ptr<Index> const& idx) -> void {
TRI_ASSERT(!idx->inProgress());

Index::SortCosts costs =
idx->supportsSortCondition(sortCondition, reference, itemsInIndex);
if (costs.supportsCondition &&
Expand Down Expand Up @@ -3016,6 +3020,7 @@ std::unique_ptr<IndexIterator> transaction::Methods::indexScanForCondition(
}

// Now create the Iterator
TRI_ASSERT(!idx->inProgress());
return idx->iteratorForCondition(this, condition, var, opts);
}

Expand Down Expand Up @@ -3218,7 +3223,7 @@ Result transaction::Methods::unlockRecursive(TRI_voc_cid_t cid, AccessMode::Type

/// @brief get list of indexes for a collection
std::vector<std::shared_ptr<Index>> transaction::Methods::indexesForCollection(
std::string const& collectionName, bool withHidden) {
std::string const& collectionName) {
if (_state->isCoordinator()) {
return indexesForCollectionCoordinator(collectionName);
}
Expand All @@ -3227,13 +3232,12 @@ std::vector<std::shared_ptr<Index>> transaction::Methods::indexesForCollection(
TRI_voc_cid_t cid = addCollectionAtRuntime(collectionName, AccessMode::Type::READ);
LogicalCollection* document = documentCollection(trxCollection(cid));
std::vector<std::shared_ptr<Index>> indexes = document->getIndexes();
if (!withHidden) {
indexes.erase(std::remove_if(indexes.begin(), indexes.end(),
[](std::shared_ptr<Index> x) {
return x->isHidden();
}),
indexes.end());
}

indexes.erase(std::remove_if(indexes.begin(), indexes.end(),
[](std::shared_ptr<Index> const& x) {
return x->isHidden();
}),
indexes.end());
return indexes;
}

Expand Down Expand Up @@ -3264,7 +3268,14 @@ std::vector<std::shared_ptr<Index>> transaction::Methods::indexesForCollectionCo
collection->clusterIndexEstimates(true);
}

return collection->getIndexes();
std::vector<std::shared_ptr<Index>> i 8000 ndexes = collection->getIndexes();

indexes.erase(std::remove_if(indexes.begin(), indexes.end(),
[](std::shared_ptr<Index> const& x) {
return x->isHidden();
}),
indexes.end());
return indexes;
}

/// @brief get the index by it's identifier. Will either throw or
Expand Down
2 changes: 1 addition & 1 deletion arangod/Transaction/Methods.h
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ class Methods {

/// @brief get all indexes for a collection name
ENTERPRISE_VIRT std::vector<std::shared_ptr<arangodb::Index>> indexesForCollection(
std::string const&, bool withHidden = false);
std::string const& collectionName);

/// @brief Lock all collections. Only works for selected sub-classes
virtual int lockCollections();
Expand Down
0