diff options
author | Håvard Pettersen <havardpe@yahooinc.com> | 2024-01-19 14:34:54 +0000 |
---|---|---|
committer | Håvard Pettersen <havardpe@yahooinc.com> | 2024-01-22 14:53:33 +0000 |
commit | 56da1f042e9d2d545267c33242a51bf94a5fd12b (patch) | |
tree | dec504966cd31b918fb49a46174f7e65f59038c9 /searchcore | |
parent | ccda952db487445f3522eecbcbfee4a6f6a90c32 (diff) |
wire in strict flow analysis and strict-aware sorting
strict_cost added to all blueprints
separate top-down sort step after optimize
move relative estimate out of blueprint state
optimize all children; to calculate flow stats
leaf defaults:
matching>0.9: est: 0.5, cost: 1.0, strict_cost: 1.0
matching<=0.9: est: rel_est, cost: 1.0, strict_cost: rel_est
Diffstat (limited to 'searchcore')
-rw-r--r-- | searchcore/src/tests/proton/documentmetastore/lid_allocator/lid_allocator_test.cpp | 7 | ||||
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/matching/query.cpp | 5 |
2 files changed, 6 insertions, 6 deletions
diff --git a/searchcore/src/tests/proton/documentmetastore/lid_allocator/lid_allocator_test.cpp b/searchcore/src/tests/proton/documentmetastore/lid_allocator/lid_allocator_test.cpp index e136e491f05..4aefa10f5f2 100644 --- a/searchcore/src/tests/proton/documentmetastore/lid_allocator/lid_allocator_test.cpp +++ b/searchcore/src/tests/proton/documentmetastore/lid_allocator/lid_allocator_test.cpp @@ -180,9 +180,10 @@ TEST_F(LidAllocatorTest, whitelist_blueprint_can_maximize_relative_estimate) activate_lids({ 1, 2, 3, 4 }, true); // the number of hits are overestimated based on the number of // documents that could be active (100 in this test fixture) - EXPECT_EQ(make_whitelist_blueprint(1000)->estimate(), 0.1); - EXPECT_EQ(make_whitelist_blueprint(200)->estimate(), 0.5); - EXPECT_EQ(make_whitelist_blueprint(5)->estimate(), 1.0); + // NOTE: optimize must be called in order to calculate the relative estimate + EXPECT_EQ(Blueprint::optimize(make_whitelist_blueprint(1000))->estimate(), 0.1); + EXPECT_EQ(Blueprint::optimize(make_whitelist_blueprint(200))->estimate(), 0.5); + EXPECT_EQ(Blueprint::optimize(make_whitelist_blueprint(5))->estimate(), 1.0); } class LidAllocatorPerformanceTest : public LidAllocatorTest, diff --git a/searchcore/src/vespa/searchcore/proton/matching/query.cpp b/searchcore/src/vespa/searchcore/proton/matching/query.cpp index a93e8fbbddc..5ade0a44b8a 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/query.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/query.cpp @@ -200,8 +200,7 @@ Query::reserveHandles(const IRequestContext & requestContext, ISearchContext &co void Query::optimize(bool sort_by_cost) { - (void) sort_by_cost; - _blueprint = Blueprint::optimize(std::move(_blueprint), sort_by_cost); + _blueprint = Blueprint::optimize_and_sort(std::move(_blueprint), true, sort_by_cost); LOG(debug, "optimized blueprint:\n%s\n", _blueprint->asString().c_str()); } @@ -223,7 +222,7 @@ Query::handle_global_filter(const IRequestContext & requestContext, uint32_t doc } // optimized order may change after accounting for global filter: trace.addEvent(5, "Optimize query execution plan to account for global filter"); - _blueprint = Blueprint::optimize(std::move(_blueprint), sort_by_cost); + _blueprint = Blueprint::optimize_and_sort(std::move(_blueprint), true, sort_by_cost); LOG(debug, "blueprint after handle_global_filter:\n%s\n", _blueprint->asString().c_str()); // strictness may change if optimized order changed: fetchPostings(ExecuteInfo::create(true, 1.0, requestContext.getDoom(), requestContext.thread_bundle())); |