diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2016-12-12 23:22:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-12 23:22:04 +0100 |
commit | c565531abe3c7d47daab4cd1660f8dc2dbe7557d (patch) | |
tree | 54c5e02473447f25e6cb6965af1058b5cdb66dc1 /searchcore | |
parent | 0471fbbbba3c0e18e2b99ab313f2f4b5c0157e97 (diff) | |
parent | 4c85d00f222a445cea83994f4e949a3f82f0975e (diff) |
Merge pull request #1305 from yahoo/balder/reduce-include-dependency-rebased-3
Balder/reduce include dependency rebased 3
Diffstat (limited to 'searchcore')
92 files changed, 876 insertions, 1178 deletions
diff --git a/searchcore/src/apps/proton/proton.cpp b/searchcore/src/apps/proton/proton.cpp index 5604ee71d28..d8ae874c652 100644 --- a/searchcore/src/apps/proton/proton.cpp +++ b/searchcore/src/apps/proton/proton.cpp @@ -1,7 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("proton"); #include <vespa/vespalib/util/signalhandler.h> #include <vespa/vespalib/util/programoptions.h> #include <string> @@ -11,6 +9,9 @@ LOG_SETUP("proton"); #include <vespa/searchlib/util/sigbushandler.h> #include <vespa/searchlib/util/ioerrorhandler.h> #include <vespa/vespalib/io/fileutil.h> +#include <vespa/metrics/metricmanager.h> +#include <vespa/log/log.h> +LOG_SETUP("proton"); typedef vespalib::SignalHandler SIG; diff --git a/searchcore/src/apps/vespa-dump-feed/vespa-dump-feed.cpp b/searchcore/src/apps/vespa-dump-feed/vespa-dump-feed.cpp index 89d38d68e9e..33832dc98d0 100644 --- a/searchcore/src/apps/vespa-dump-feed/vespa-dump-feed.cpp +++ b/searchcore/src/apps/vespa-dump-feed/vespa-dump-feed.cpp @@ -1,5 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include <vespa/config/config.h> #include <vespa/config/print/fileconfigwriter.h> @@ -18,6 +17,7 @@ #include <vespa/vespalib/util/signalhandler.h> #include <vespa/vespalib/util/slaveproc.h> #include <vespa/vespalib/util/stringfmt.h> +#include <vespa/vespalib/objects/nbostream.h> #include <iostream> diff --git a/searchcore/src/apps/vespa-transactionlog-inspect/vespa-transactionlog-inspect.cpp b/searchcore/src/apps/vespa-transactionlog-inspect/vespa-transactionlog-inspect.cpp index 369f37b4c69..ae00e168c3d 100644 --- a/searchcore/src/apps/vespa-transactionlog-inspect/vespa-transactionlog-inspect.cpp +++ b/searchcore/src/apps/vespa-transactionlog-inspect/vespa-transactionlog-inspect.cpp @@ -8,6 +8,7 @@ #include <vespa/searchlib/transactionlog/translogclient.h> #include <vespa/searchlib/transactionlog/translogserver.h> #include <vespa/vespalib/util/programoptions.h> +#include <vespa/document/config/config-documenttypes.h> #include <iostream> #include <vespa/log/log.h> LOG_SETUP("vespa-transactionlog-inspect"); diff --git a/searchcore/src/tests/applyattrupdates/applyattrupdates.cpp b/searchcore/src/tests/applyattrupdates/applyattrupdates.cpp index ba9ade78253..35307317d49 100644 --- a/searchcore/src/tests/applyattrupdates/applyattrupdates.cpp +++ b/searchcore/src/tests/applyattrupdates/applyattrupdates.cpp @@ -1,27 +1,23 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/document/config/config-documenttypes.h> +#include <vespa/document/base/testdocrepo.h> #include <vespa/document/fieldvalue/arrayfieldvalue.h> #include <vespa/document/fieldvalue/bytefieldvalue.h> -#include <vespa/document/fieldvalue/doublefieldvalue.h> #include <vespa/document/fieldvalue/floatfieldvalue.h> #include <vespa/document/fieldvalue/intfieldvalue.h> -#include <vespa/document/fieldvalue/longfieldvalue.h> #include <vespa/document/fieldvalue/stringfieldvalue.h> #include <vespa/document/fieldvalue/weightedsetfieldvalue.h> -#include <vespa/document/repo/documenttyperepo.h> #include <vespa/document/update/addvalueupdate.h> #include <vespa/document/update/assignvalueupdate.h> #include <vespa/document/update/clearvalueupdate.h> #include <vespa/document/update/documentupdate.h> #include <vespa/document/update/removevalueupdate.h> #include <vespa/document/update/mapvalueupdate.h> -#include <vespa/log/log.h> #include <vespa/searchcore/proton/common/attrupdate.h> #include <vespa/searchlib/attribute/attributefactory.h> #include <vespa/searchlib/attribute/attributevector.hpp> #include <vespa/vespalib/testkit/testapp.h> -#include <cmath> + +#include <vespa/log/log.h> LOG_SETUP("applyattrupdates_test"); diff --git a/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp b/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp index 6e6df7cc5e3..2c8301e259f 100644 --- a/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp @@ -485,8 +485,8 @@ TEST_F("require that history can be wiped", Fixture) f.addAttribute("a3"); f._m.flushAll(10); Schema hs; - hs.addAttributeField(Schema::AttributeField("a1", Schema::INT32)); - hs.addAttributeField(Schema::AttributeField("a3", Schema::INT32)); + hs.addAttributeField(Schema::AttributeField("a1", schema::INT32)); + hs.addAttributeField(Schema::AttributeField("a3", schema::INT32)); f._m.wipeHistory(hs); FastOS_StatInfo si; EXPECT_TRUE(!FastOS_File::Stat(vespalib::string(test_dir + "/a1").c_str(), &si)); diff --git a/searchcore/src/tests/proton/attribute/attribute_test.cpp b/searchcore/src/tests/proton/attribute/attribute_test.cpp index f00776444e6..3493ecb4e07 100644 --- a/searchcore/src/tests/proton/attribute/attribute_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_test.cpp @@ -142,10 +142,10 @@ struct Fixture TEST_F("require that attribute adapter handles put", Fixture) { Schema s; - s.addAttributeField(Schema::AttributeField("a1", Schema::INT32, Schema::SINGLE)); - s.addAttributeField(Schema::AttributeField("a2", Schema::INT32, Schema::ARRAY)); - s.addAttributeField(Schema::AttributeField("a3", Schema::FLOAT, Schema::SINGLE)); - s.addAttributeField(Schema::AttributeField("a4", Schema::STRING, Schema::SINGLE)); + s.addAttributeField(Schema::AttributeField("a1", schema::INT32, schema::SINGLE)); + s.addAttributeField(Schema::AttributeField("a2", schema::INT32, schema::ARRAY)); + s.addAttributeField(Schema::AttributeField("a3", schema::FLOAT, schema::SINGLE)); + s.addAttributeField(Schema::AttributeField("a4", schema::STRING, schema::SINGLE)); DocBuilder idb(s); @@ -236,8 +236,7 @@ TEST_F("require that attribute adapter handles put", Fixture) TEST_F("require that attribute adapter handles predicate put", Fixture) { Schema s; - s.addAttributeField( - Schema::AttributeField("a1", Schema::BOOLEANTREE, Schema::SINGLE)); + s.addAttributeField(Schema::AttributeField("a1", schema::BOOLEANTREE, schema::SINGLE)); DocBuilder idb(s); proton::AttributeManager & am = *f._m; @@ -285,8 +284,8 @@ TEST_F("require that attribute adapter handles remove", Fixture) AttributeVector::SP a1 = f.addAttribute("a1"); AttributeVector::SP a2 = f.addAttribute("a2"); Schema s; - s.addAttributeField(Schema::AttributeField("a1", Schema::INT32, Schema::SINGLE)); - s.addAttributeField(Schema::AttributeField("a2", Schema::INT32, Schema::SINGLE)); + s.addAttributeField(Schema::AttributeField("a1", schema::INT32, schema::SINGLE)); + s.addAttributeField(Schema::AttributeField("a2", schema::INT32, schema::SINGLE)); DocBuilder idb(s); @@ -323,7 +322,7 @@ TEST_F("require that visibilitydelay is honoured", Fixture) AVConfig(AVBasicType::STRING), createSerialNum); Schema s; - s.addAttributeField(Schema::AttributeField("a1", Schema::STRING, Schema::SINGLE)); + s.addAttributeField(Schema::AttributeField("a1", schema::STRING, schema::SINGLE)); DocBuilder idb(s); EXPECT_EQUAL(1u, a1->getNumDocs()); EXPECT_EQUAL(0u, a1->getStatus().getLastSyncToken()); @@ -373,7 +372,7 @@ TEST_F("require that attribute adapter handles predicate remove", Fixture) createSerialNum); Schema s; s.addAttributeField( - Schema::AttributeField("a1", Schema::BOOLEANTREE, Schema::SINGLE)); + Schema::AttributeField("a1", schema::BOOLEANTREE, schema::SINGLE)); DocBuilder idb(s); PredicateSlimeBuilder builder; @@ -399,12 +398,8 @@ TEST_F("require that attribute adapter handles update", Fixture) fillAttribute(a2, 1, 20, 1); Schema schema; - schema.addAttributeField(Schema::AttributeField( - "a1", Schema::INT32, - Schema::SINGLE)); - schema.addAttributeField(Schema::AttributeField( - "a2", Schema::INT32, - Schema::SINGLE)); + schema.addAttributeField(Schema::AttributeField("a1", schema::INT32, schema::SINGLE)); + schema.addAttributeField(Schema::AttributeField("a2", schema::INT32, schema::SINGLE)); DocBuilder idb(schema); const document::DocumentType &dt(idb.getDocumentType()); DocumentUpdate upd(dt, DocumentId("doc::1")); @@ -441,9 +436,7 @@ TEST_F("require that attribute adapter handles predicate update", Fixture) AVConfig(AVBasicType::PREDICATE), createSerialNum); Schema schema; - schema.addAttributeField(Schema::AttributeField( - "a1", Schema::BOOLEANTREE, - Schema::SINGLE)); + schema.addAttributeField(Schema::AttributeField("a1", schema::BOOLEANTREE, schema::SINGLE)); DocBuilder idb(schema); PredicateSlimeBuilder builder; @@ -587,8 +580,7 @@ createTensorAttribute(Fixture &f) { Schema createTensorSchema() { Schema schema; - schema.addAttributeField(Schema::AttributeField("a1", Schema::TENSOR, - Schema::SINGLE)); + schema.addAttributeField(Schema::AttributeField("a1", schema::TENSOR, schema::SINGLE)); return schema; } diff --git a/searchcore/src/tests/proton/common/cachedselect_test.cpp b/searchcore/src/tests/proton/common/cachedselect_test.cpp index e2c759f72aa..576d81b3763 100644 --- a/searchcore/src/tests/proton/common/cachedselect_test.cpp +++ b/searchcore/src/tests/proton/common/cachedselect_test.cpp @@ -58,6 +58,7 @@ using search::SingleValueNumericPostingAttribute; using search::IntegerAttribute; using search::IntegerAttributeTemplate; using search::attribute::IAttributeContext; +using namespace search::index; typedef Node::UP NodeUP; typedef IntegerAttributeTemplate<int32_t> IATint32; @@ -69,18 +70,15 @@ extern template class SingleValueNumericPostingAttribute<IntPostingAttribute>; typedef SingleValueNumericPostingAttribute<IntEnumAttribute> SvIntAttr; -namespace -{ +namespace { void makeSchema(Schema &s) { - s.addIndexField(Schema::IndexField("ia", Schema::STRING)); - s.addAttributeField(Schema::AttributeField("aa", Schema::INT32)); - s.addAttributeField(Schema::AttributeField("aaa", Schema::INT32, - Schema::ARRAY)); - s.addAttributeField(Schema::AttributeField("aaw", Schema::INT32, - Schema::WEIGHTEDSET)); + s.addIndexField(Schema::IndexField("ia", schema::STRING)); + s.addAttributeField(Schema::AttributeField("aa", schema::INT32)); + s.addAttributeField(Schema::AttributeField("aaa", schema::INT32, schema::ARRAY)); + s.addAttributeField(Schema::AttributeField("aaw", schema::INT32, schema::WEIGHTEDSET)); } const int32_t doc_type_id = 787121340; diff --git a/searchcore/src/tests/proton/common/document_type_inspector/document_type_inspector_test.cpp b/searchcore/src/tests/proton/common/document_type_inspector/document_type_inspector_test.cpp index c7fcd9ec72d..8f4d6f1f2fe 100644 --- a/searchcore/src/tests/proton/common/document_type_inspector/document_type_inspector_test.cpp +++ b/searchcore/src/tests/proton/common/document_type_inspector/document_type_inspector_test.cpp @@ -1,8 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("document_type_inspector_test"); - #include <vespa/searchcore/proton/common/document_type_inspector.h> #include <vespa/searchlib/index/docbuilder.h> #include <vespa/vespalib/testkit/testapp.h> @@ -15,8 +12,8 @@ Schema getSchema() { Schema schema; - schema.addSummaryField(Schema::SummaryField("f1", Schema::STRING)); - schema.addSummaryField(Schema::SummaryField("f2", Schema::STRING)); + schema.addSummaryField(Schema::SummaryField("f1", schema::STRING)); + schema.addSummaryField(Schema::SummaryField("f2", schema::STRING)); return schema; } diff --git a/searchcore/src/tests/proton/common/schemautil_test.cpp b/searchcore/src/tests/proton/common/schemautil_test.cpp index c6519ecae06..465c7a2a3b0 100644 --- a/searchcore/src/tests/proton/common/schemautil_test.cpp +++ b/searchcore/src/tests/proton/common/schemautil_test.cpp @@ -2,14 +2,11 @@ // Unit tests for schemautil. #include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("schemautil_test"); - #include <vespa/searchcore/proton/common/schemautil.h> #include <vespa/vespalib/stllike/string.h> #include <vespa/vespalib/testkit/testapp.h> -using search::index::Schema; +using namespace search::index; using vespalib::string; using namespace proton; @@ -19,15 +16,15 @@ namespace { void addAllFieldTypes(const string &name, Schema &schema, fastos::TimeStamp timestamp) { - Schema::IndexField index_field(name, Schema::STRING); + Schema::IndexField index_field(name, schema::STRING); index_field.setTimestamp(timestamp); schema.addIndexField(index_field); - Schema::AttributeField attribute_field(name, Schema::STRING); + Schema::AttributeField attribute_field(name, schema::STRING); attribute_field.setTimestamp(timestamp); schema.addAttributeField(attribute_field); - Schema::SummaryField summary_field(name, Schema::STRING); + Schema::SummaryField summary_field(name, schema::STRING); summary_field.setTimestamp(timestamp); schema.addSummaryField(summary_field); } @@ -112,9 +109,9 @@ assertSchemaResult(const vespalib::string &name, TEST("require that listSchema can list all fields") { Schema schema; - schema.addIndexField(Schema::IndexField("if", Schema::STRING)); - schema.addAttributeField(Schema::AttributeField("af", Schema::INT32)); - schema.addSummaryField(Schema::SummaryField("sf", Schema::FLOAT, Schema::ARRAY)); + schema.addIndexField(Schema::IndexField("if", schema::STRING)); + schema.addAttributeField(Schema::AttributeField("af", schema::INT32)); + schema.addSummaryField(Schema::SummaryField("sf", schema::FLOAT, schema::ARRAY)); ListSchemaResult r; SchemaUtil::listSchema(schema, r.fieldNames, r.fieldDataTypes, r.fieldCollectionTypes, r.fieldLocations); diff --git a/searchcore/src/tests/proton/common/selectpruner_test.cpp b/searchcore/src/tests/proton/common/selectpruner_test.cpp index e8ec0ae7cb5..7bea3ee12e0 100644 --- a/searchcore/src/tests/proton/common/selectpruner_test.cpp +++ b/searchcore/src/tests/proton/common/selectpruner_test.cpp @@ -1,8 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("selectpruner_test"); - #include <vespa/vespalib/stllike/string.h> #include <vespa/vespalib/testkit/testapp.h> #include <vespa/document/repo/configbuilder.h> @@ -11,8 +8,10 @@ LOG_SETUP("selectpruner_test"); #include <vespa/document/select/parser.h> #include <vespa/document/select/cloningvisitor.h> +#include <vespa/log/log.h> +LOG_SETUP("selectpruner_test"); -using search::index::Schema; +using namespace search::index; using document::DocumentTypeRepo; using document::DocumentType; using document::select::Node; @@ -38,12 +37,12 @@ namespace void makeSchema(Schema &s) { - s.addIndexField(Schema::IndexField("ia", Schema::STRING)); - s.addAttributeField(Schema::AttributeField("aa", Schema::INT32)); - s.addAttributeField(Schema::AttributeField("aaa", Schema::INT32, - Schema::ARRAY)); - s.addAttributeField(Schema::AttributeField("aaw", Schema::INT32, - Schema::WEIGHTEDSET)); + s.addIndexField(Schema::IndexField("ia", schema::STRING)); + s.addAttributeField(Schema::AttributeField("aa", schema::INT32)); + s.addAttributeField(Schema::AttributeField("aaa", schema::INT32, + schema::ARRAY)); + s.addAttributeField(Schema::AttributeField("aaw", schema::INT32, + schema::WEIGHTEDSET)); } const int32_t doc_type_id = 787121340; diff --git a/searchcore/src/tests/proton/config/config.cpp b/searchcore/src/tests/proton/config/config.cpp index 86379e50c9d..f280c609070 100644 --- a/searchcore/src/tests/proton/config/config.cpp +++ b/searchcore/src/tests/proton/config/config.cpp @@ -1,7 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("config_test"); + #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/linkedptr.h> #include <map> @@ -11,6 +9,12 @@ LOG_SETUP("config_test"); #include <vespa/searchcore/proton/server/protonconfigurer.h> #include <vespa/vespalib/util/varholder.h> #include <vespa/fileacquirer/config-filedistributorrpc.h> +#include <vespa/config-summarymap.h> +#include <vespa/config-summary.h> +#include <vespa/config-rank-profiles.h> +#include <vespa/config-attributes.h> +#include <vespa/config-indexschema.h> +#include <vespa/searchsummary/config/config-juniperrc.h> using namespace config; using namespace proton; diff --git a/searchcore/src/tests/proton/docsummary/docsummary.cpp b/searchcore/src/tests/proton/docsummary/docsummary.cpp index b0f64f4198f..3a163387860 100644 --- a/searchcore/src/tests/proton/docsummary/docsummary.cpp +++ b/searchcore/src/tests/proton/docsummary/docsummary.cpp @@ -421,18 +421,18 @@ void Test::requireThatAdapterHandlesAllFieldTypes() { Schema s; - s.addSummaryField(Schema::SummaryField("a", Schema::INT8)); - s.addSummaryField(Schema::SummaryField("b", Schema::INT16)); - s.addSummaryField(Schema::SummaryField("c", Schema::INT32)); - s.addSummaryField(Schema::SummaryField("d", Schema::INT64)); - s.addSummaryField(Schema::SummaryField("e", Schema::FLOAT)); - s.addSummaryField(Schema::SummaryField("f", Schema::DOUBLE)); - s.addSummaryField(Schema::SummaryField("g", Schema::STRING)); - s.addSummaryField(Schema::SummaryField("h", Schema::STRING)); - s.addSummaryField(Schema::SummaryField("i", Schema::RAW)); - s.addSummaryField(Schema::SummaryField("j", Schema::RAW)); - s.addSummaryField(Schema::SummaryField("k", Schema::STRING)); - s.addSummaryField(Schema::SummaryField("l", Schema::STRING)); + s.addSummaryField(Schema::SummaryField("a", schema::INT8)); + s.addSummaryField(Schema::SummaryField("b", schema::INT16)); + s.addSummaryField(Schema::SummaryField("c", schema::INT32)); + s.addSummaryField(Schema::SummaryField("d", schema::INT64)); + s.addSummaryField(Schema::SummaryField("e", schema::FLOAT)); + s.addSummaryField(Schema::SummaryField("f", schema::DOUBLE)); + s.addSummaryField(Schema::SummaryField("g", schema::STRING)); + s.addSummaryField(Schema::SummaryField("h", schema::STRING)); + s.addSummaryField(Schema::SummaryField("i", schema::RAW)); + s.addSummaryField(Schema::SummaryField("j", schema::RAW)); + s.addSummaryField(Schema::SummaryField("k", schema::STRING)); + s.addSummaryField(Schema::SummaryField("l", schema::STRING)); BuildContext bc(s); bc._bld.startDocument("doc::0"); @@ -481,7 +481,7 @@ void Test::requireThatAdapterHandlesMultipleDocuments() { Schema s; - s.addSummaryField(Schema::SummaryField("a", Schema::INT32)); + s.addSummaryField(Schema::SummaryField("a", schema::INT32)); BuildContext bc(s); bc._bld.startDocument("doc::0"). @@ -523,8 +523,7 @@ void Test::requireThatAdapterHandlesDocumentIdField() { Schema s; - s.addSummaryField(Schema::SummaryField("documentid", - Schema::STRING)); + s.addSummaryField(Schema::SummaryField("documentid", schema::STRING)); BuildContext bc(s); bc._bld.startDocument("doc::0"). startSummaryField("documentid"). @@ -551,7 +550,7 @@ void Test::requireThatDocsumRequestIsProcessed() { Schema s; - s.addSummaryField(Schema::SummaryField("a", Schema::INT32)); + s.addSummaryField(Schema::SummaryField("a", schema::INT32)); BuildContext bc(s); DBContext dc(bc._repo, getDocTypeName()); @@ -609,8 +608,8 @@ void Test::requireThatRewritersAreUsed() { Schema s; - s.addSummaryField(Schema::SummaryField("aa", Schema::INT32)); - s.addSummaryField(Schema::SummaryField("ab", Schema::INT32)); + s.addSummaryField(Schema::SummaryField("aa", schema::INT32)); + s.addSummaryField(Schema::SummaryField("ab", schema::INT32)); BuildContext bc(s); DBContext dc(bc._repo, getDocTypeName()); @@ -649,25 +648,16 @@ void Test::requireThatAttributesAreUsed() { Schema s; - addField(s, "ba", - Schema::INT32, Schema::SINGLE); - addField(s, "bb", - Schema::FLOAT, Schema::SINGLE); - addField(s, "bc", - Schema::STRING, Schema::SINGLE); - addField(s, "bd", - Schema::INT32, Schema::ARRAY); - addField(s, "be", - Schema::FLOAT, Schema::ARRAY); - addField(s, "bf", - Schema::STRING, Schema::ARRAY); - addField(s, "bg", - Schema::INT32, Schema::WEIGHTEDSET); - addField(s, "bh", - Schema::FLOAT, Schema::WEIGHTEDSET); - addField(s, "bi", - Schema::STRING, Schema::WEIGHTEDSET); - addField(s, "bj", Schema::TENSOR, Schema::SINGLE); + addField(s, "ba", schema::INT32, schema::SINGLE); + addField(s, "bb", schema::FLOAT, schema::SINGLE); + addField(s, "bc", schema::STRING, schema::SINGLE); + addField(s, "bd", schema::INT32, schema::ARRAY); + addField(s, "be", schema::FLOAT, schema::ARRAY); + addField(s, "bf", schema::STRING, schema::ARRAY); + addField(s, "bg", schema::INT32, schema::WEIGHTEDSET); + addField(s, "bh", schema::FLOAT, schema::WEIGHTEDSET); + addField(s, "bi", schema::STRING, schema::WEIGHTEDSET); + addField(s, "bj", schema::TENSOR, schema::SINGLE); BuildContext bc(s); DBContext dc(bc._repo, getDocTypeName()); @@ -819,9 +809,7 @@ void Test::requireThatSummaryAdapterHandlesPutAndRemove() { Schema s; - s.addSummaryField(Schema::SummaryField("f1", - Schema::STRING, - Schema::SINGLE)); + s.addSummaryField(Schema::SummaryField("f1", schema::STRING, schema::SINGLE)); BuildContext bc(s); DBContext dc(bc._repo, getDocTypeName()); Document::UP exp = bc._bld.startDocument("doc::1"). @@ -855,18 +843,10 @@ void Test::requireThatAnnotationsAreUsed() { Schema s; - s.addIndexField(Schema::IndexField("g", - Schema::STRING, - Schema::SINGLE)); - s.addSummaryField(Schema::SummaryField("g", - Schema::STRING, - Schema::SINGLE)); - s.addIndexField(Schema::IndexField("dynamicstring", - Schema::STRING, - Schema::SINGLE)); - s.addSummaryField(Schema::SummaryField("dynamicstring", - Schema::STRING, - Schema::SINGLE)); + s.addIndexField(Schema::IndexField("g", schema::STRING, schema::SINGLE)); + s.addSummaryField(Schema::SummaryField("g", schema::STRING, schema::SINGLE)); + s.addIndexField(Schema::IndexField("dynamicstring", schema::STRING, schema::SINGLE)); + s.addSummaryField(Schema::SummaryField("dynamicstring", schema::STRING, schema::SINGLE)); BuildContext bc(s); DBContext dc(bc._repo, getDocTypeName()); Document::UP exp = bc._bld.startDocument("doc::0"). @@ -916,24 +896,12 @@ void Test::requireThatUrisAreUsed() { Schema s; - s.addUriIndexFields(Schema::IndexField("urisingle", - Schema::STRING, - Schema::SINGLE)); - s.addSummaryField(Schema::SummaryField("urisingle", - Schema::STRING, - Schema::SINGLE)); - s.addUriIndexFields(Schema::IndexField("uriarray", - Schema::STRING, - Schema::ARRAY)); - s.addSummaryField(Schema::SummaryField("uriarray", - Schema::STRING, - Schema::ARRAY)); - s.addUriIndexFields(Schema::IndexField("uriwset", - Schema::STRING, - Schema::WEIGHTEDSET)); - s.addSummaryField(Schema::SummaryField("uriwset", - Schema::STRING, - Schema::WEIGHTEDSET)); + s.addUriIndexFields(Schema::IndexField("urisingle", schema::STRING, schema::SINGLE)); + s.addSummaryField(Schema::SummaryField("urisingle", schema::STRING, schema::SINGLE)); + s.addUriIndexFields(Schema::IndexField("uriarray", schema::STRING, schema::ARRAY)); + s.addSummaryField(Schema::SummaryField("uriarray", schema::STRING, schema::ARRAY)); + s.addUriIndexFields(Schema::IndexField("uriwset", schema::STRING, schema::WEIGHTEDSET)); + s.addSummaryField(Schema::SummaryField("uriwset", schema::STRING, schema::WEIGHTEDSET)); BuildContext bc(s); DBContext dc(bc._repo, getDocTypeName()); Document::UP exp = bc._bld.startDocument("doc::0"). @@ -1091,14 +1059,9 @@ void Test::requireThatPositionsAreUsed() { Schema s; - s.addAttributeField(Schema::AttributeField("sp2", - Schema::INT64)); - s.addAttributeField(Schema::AttributeField("ap2", - Schema::INT64, - Schema::ARRAY)); - s.addAttributeField(Schema::AttributeField("wp2", - Schema::INT64, - Schema::WEIGHTEDSET)); + s.addAttributeField(Schema::AttributeField("sp2", schema::INT64)); + s.addAttributeField(Schema::AttributeField("ap2", schema::INT64, schema::ARRAY)); + s.addAttributeField(Schema::AttributeField("wp2", schema::INT64, schema::WEIGHTEDSET)); BuildContext bc(s); DBContext dc(bc._repo, getDocTypeName()); @@ -1153,14 +1116,9 @@ void Test::requireThatRawFieldsWorks() { Schema s; - s.addSummaryField(Schema::AttributeField("i", - Schema::RAW)); - s.addSummaryField(Schema::AttributeField("araw", - Schema::RAW, - Schema::ARRAY)); - s.addSummaryField(Schema::AttributeField("wraw", - Schema::RAW, - Schema::WEIGHTEDSET)); + s.addSummaryField(Schema::AttributeField("i", schema::RAW)); + s.addSummaryField(Schema::AttributeField("araw", schema::RAW, schema::ARRAY)); + s.addSummaryField(Schema::AttributeField("wraw", schema::RAW, schema::WEIGHTEDSET)); std::vector<char> binaryBlob; binaryBlob.push_back('\0'); @@ -1238,7 +1196,7 @@ void Test::requireThatFieldCacheRepoCanReturnDefaultFieldCache() { Schema s; - s.addSummaryField(Schema::SummaryField("a", Schema::INT32)); + s.addSummaryField(Schema::SummaryField("a", schema::INT32)); BuildContext bc(s); FieldCacheRepo::UP repo = bc.createFieldCacheRepo(getResultConfig()); FieldCache::CSP cache = repo->getFieldCache(""); diff --git a/searchcore/src/tests/proton/docsummary/summaryfieldconverter_test.cpp b/searchcore/src/tests/proton/docsummary/summaryfieldconverter_test.cpp index df7c82f191d..292f0e2e787 100644 --- a/searchcore/src/tests/proton/docsummary/summaryfieldconverter_test.cpp +++ b/searchcore/src/tests/proton/docsummary/summaryfieldconverter_test.cpp @@ -445,11 +445,11 @@ void Test::checkArray(const char *(&str)[N], const FieldValue *value) { } void Test::setSummaryField(const string &field) { - _schema->addSummaryField(Schema::Field(field, Schema::STRING)); + _schema->addSummaryField(Schema::Field(field, search::index::schema::STRING)); } void Test::setAttributeField(const string &field) { - _schema->addAttributeField(Schema::Field(field, Schema::STRING)); + _schema->addAttributeField(Schema::Field(field, search::index::schema::STRING)); } void Test::requireThatSummaryIsAnUnmodifiedString() { diff --git a/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp b/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp index 12bba229821..bf123264637 100644 --- a/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp +++ b/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp @@ -1,5 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> +#include <vespa/document/fieldvalue/fieldvalues.h> #include <vespa/document/base/field.h> #include <vespa/document/datatype/documenttype.h> #include <vespa/document/fieldset/fieldsets.h> @@ -15,6 +15,8 @@ #include <vespa/searchcore/proton/common/attrupdate.h> #include <vespa/searchlib/attribute/attributefactory.h> #include <vespa/searchcore/proton/server/commit_and_wait_document_retriever.h> +#include <vespa/vespalib/objects/nbostream.h> + using document::DocumentType; using document::Field; @@ -37,7 +39,7 @@ using search::attribute::BasicType; using search::attribute::CollectionType; using search::attribute::Config; using search::attribute::IAttributeContext; -using search::index::Schema; +using namespace search::index; using storage::spi::Timestamp; using storage::spi::Bucket; using storage::spi::PartitionId; @@ -229,9 +231,9 @@ struct AttrUnitDR : public UnitDR : UnitDR(d->getType(), document::Document::UP(d->clone()), t, b, r), _amgr(), _schema(), _aa(), _dd(), _ss() { - createAttribute(_aa, BasicType::INT32, Schema::INT32, "aa"); - createAttribute(_dd, BasicType::DOUBLE, Schema::DOUBLE, "dd"); - createAttribute(_ss, BasicType::STRING, Schema::STRING, "ss"); + createAttribute(_aa, BasicType::INT32, schema::INT32, "aa"); + createAttribute(_dd, BasicType::DOUBLE, schema::DOUBLE, "dd"); + createAttribute(_ss, BasicType::STRING, schema::STRING, "ss"); } AttrUnitDR(document::Document::UP d, Timestamp t, Bucket b, bool r, @@ -239,11 +241,11 @@ struct AttrUnitDR : public UnitDR : UnitDR(d->getType(), document::Document::UP(d->clone()), t, b, r), _amgr(), _schema(), _aa(), _dd(), _ss() { - createAttribute(_aa, BasicType::INT32, Schema::INT32, "aa"); + createAttribute(_aa, BasicType::INT32, schema::INT32, "aa"); addAttribute<IntFieldValue, int32_t>(*_aa, aa); - createAttribute(_dd, BasicType::DOUBLE, Schema::DOUBLE, "dd"); + createAttribute(_dd, BasicType::DOUBLE, schema::DOUBLE, "dd"); addAttribute<DoubleFieldValue, double>(*_dd, dd); - createAttribute(_ss, BasicType::STRING, Schema::STRING, "ss"); + createAttribute(_ss, BasicType::STRING, schema::STRING, "ss"); addAttribute<StringFieldValue, vespalib::string>(*_ss, ss); } diff --git a/searchcore/src/tests/proton/documentdb/configvalidator/configvalidator_test.cpp b/searchcore/src/tests/proton/documentdb/configvalidator/configvalidator_test.cpp index 7957600195d..70045537894 100644 --- a/searchcore/src/tests/proton/documentdb/configvalidator/configvalidator_test.cpp +++ b/searchcore/src/tests/proton/documentdb/configvalidator/configvalidator_test.cpp @@ -1,7 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("configvalidator_test"); #include <vespa/vespalib/testkit/testapp.h> #include <vespa/searchcore/proton/server/configvalidator.h> @@ -36,7 +34,7 @@ struct SchemaBuilder Schema _schema; SchemaBuilder() : _schema() {} SchemaBuilder &add(const vespalib::string &name, FType ftype, - Schema::DataType dtype, Schema::CollectionType ctype = Schema::SINGLE) { + schema::DataType dtype, schema::CollectionType ctype = schema::SINGLE) { switch (ftype) { case INDEX: _schema.addIndexField(IField(name, dtype, ctype)); @@ -61,15 +59,15 @@ create(FType ftype, Schema::DataType dtype, Schema::CollectionType ctype) } Schema -created(FType ftype, Schema::DataType dtype) +created(FType ftype, schema::DataType dtype) { - return create(ftype, dtype, Schema::SINGLE); + return create(ftype, dtype, schema::SINGLE); } Schema -createc(FType ftype, Schema::CollectionType ctype) +createc(FType ftype, schema::CollectionType ctype) { - return create(ftype, Schema::STRING, ctype); + return create(ftype, schema::STRING, ctype); } ConfigValidator::ResultType @@ -93,13 +91,13 @@ void requireThatChangedDataTypeIsDiscovered(FType ftype) { EXPECT_EQUAL(DTC, - checkSchema(created(ftype, Schema::INT32), - created(ftype, Schema::STRING), + checkSchema(created(ftype, schema::INT32), + created(ftype, schema::STRING), Schema())); EXPECT_EQUAL(DTC, - checkSchema(created(ftype, Schema::INT32), + checkSchema(created(ftype, schema::INT32), Schema(), - created(ftype, Schema::STRING))); + created(ftype, schema::STRING))); } TEST("require that changed data type is discovered") @@ -113,13 +111,13 @@ void requireThatChangedCollectionTypeIsDiscovered(FType ftype) { EXPECT_EQUAL(CTC, - checkSchema(createc(ftype, Schema::ARRAY), - createc(ftype, Schema::SINGLE), + checkSchema(createc(ftype, schema::ARRAY), + createc(ftype, schema::SINGLE), Schema())); EXPECT_EQUAL(CTC, - checkSchema(createc(ftype, Schema::ARRAY), + checkSchema(createc(ftype, schema::ARRAY), Schema(), - createc(ftype, Schema::SINGLE))); + createc(ftype, schema::SINGLE))); } TEST("require that changed collection type is discovered") @@ -131,15 +129,15 @@ TEST("require that changed collection type is discovered") TEST("require that changed index aspect is discovered") { - Schema s1 = created(SUMMARY, Schema::STRING); - s1.addIndexField(IField("f1", Schema::STRING)); - Schema s2 = created(SUMMARY, Schema::STRING); - Schema s2h = created(INDEX, Schema::STRING); - - Schema s3 = created(ATTRIBUTE, Schema::STRING); - s3.addIndexField(IField("f1", Schema::STRING)); - Schema s4 = created(ATTRIBUTE, Schema::STRING); - Schema s4h = created(INDEX, Schema::STRING); + Schema s1 = created(SUMMARY, schema::STRING); + s1.addIndexField(IField("f1", schema::STRING)); + Schema s2 = created(SUMMARY, schema::STRING); + Schema s2h = created(INDEX, schema::STRING); + + Schema s3 = created(ATTRIBUTE, schema::STRING); + s3.addIndexField(IField("f1", schema::STRING)); + Schema s4 = created(ATTRIBUTE, schema::STRING); + Schema s4h = created(INDEX, schema::STRING); { // remove as index field EXPECT_EQUAL(IAR, checkSchema(s2, s1, Schema())); EXPECT_EQUAL(IAR, checkSchema(s2, Schema(), s1)); @@ -163,21 +161,21 @@ TEST("require that changed index aspect is discovered") TEST("require that changed attribute aspect is discovered") { - Schema s1 = created(SUMMARY, Schema::STRING); - s1.addAttributeField(AField("f1", Schema::STRING)); - Schema s2 = created(SUMMARY, Schema::STRING); - Schema s2h = created(ATTRIBUTE, Schema::STRING); - - Schema s3 = created(INDEX, Schema::STRING); - s3.addAttributeField(AField("f1", Schema::STRING)); - Schema s4 = created(INDEX, Schema::STRING); - Schema s4h = created(ATTRIBUTE, Schema::STRING); - - Schema s5 = created(INDEX, Schema::STRING); - s5.addSummaryField(SField("f1", Schema::STRING)); - s5.addAttributeField(AField("f1", Schema::STRING)); - Schema s6 = created(INDEX, Schema::STRING); - s6.addSummaryField(SField("f1", Schema::STRING)); + Schema s1 = created(SUMMARY, schema::STRING); + s1.addAttributeField(AField("f1", schema::STRING)); + Schema s2 = created(SUMMARY, schema::STRING); + Schema s2h = created(ATTRIBUTE, schema::STRING); + + Schema s3 = created(INDEX, schema::STRING); + s3.addAttributeField(AField("f1", schema::STRING)); + Schema s4 = created(INDEX, schema::STRING); + Schema s4h = created(ATTRIBUTE, schema::STRING); + + Schema s5 = created(INDEX, schema::STRING); + s5.addSummaryField(SField("f1", schema::STRING)); + s5.addAttributeField(AField("f1", schema::STRING)); + Schema s6 = created(INDEX, schema::STRING); + s6.addSummaryField(SField("f1", schema::STRING)); { // remove as attribute field EXPECT_EQUAL(AAR, checkSchema(s2, s1, Schema())); EXPECT_EQUAL(AAR, checkSchema(s2, Schema(), s1)); @@ -203,15 +201,15 @@ TEST("require that changed attribute aspect is discovered") TEST("require that changed summary aspect is allowed") { - Schema s1 = created(INDEX, Schema::STRING); - s1.addSummaryField(SField("f1", Schema::STRING)); - Schema s2 = created(INDEX, Schema::STRING); - Schema s2h = created(SUMMARY, Schema::STRING); - - Schema s3 = created(ATTRIBUTE, Schema::STRING); - s3.addSummaryField(SField("f1", Schema::STRING)); - Schema s4 = created(ATTRIBUTE, Schema::STRING); - Schema s4h = created(SUMMARY, Schema::STRING); + Schema s1 = created(INDEX, schema::STRING); + s1.addSummaryField(SField("f1", schema::STRING)); + Schema s2 = created(INDEX, schema::STRING); + Schema s2h = created(SUMMARY, schema::STRING); + + Schema s3 = created(ATTRIBUTE, schema::STRING); + s3.addSummaryField(SField("f1", schema::STRING)); + Schema s4 = created(ATTRIBUTE, schema::STRING); + Schema s4h = created(SUMMARY, schema::STRING); { // remove as summary field EXPECT_EQUAL(OK, checkSchema(s2, s1, Schema())); EXPECT_EQUAL(IAA, checkSchema(s2, Schema(), s1)); @@ -231,16 +229,16 @@ TEST("require that changed summary aspect is allowed") TEST("require that fields can be added and removed") { Schema e; - Schema s1 = created(INDEX, Schema::STRING); - Schema s2 = created(ATTRIBUTE, Schema::STRING); - Schema s3 = created(SUMMARY, Schema::STRING); - Schema s4 = created(SUMMARY, Schema::STRING); - s4.addIndexField(IField("f1", Schema::STRING)); - Schema s5 = created(SUMMARY, Schema::STRING); - s5.addAttributeField(AField("f1", Schema::STRING)); - Schema s6 = created(SUMMARY, Schema::STRING); - s6.addIndexField(IField("f1", Schema::STRING)); - s6.addAttributeField(AField("f1", Schema::STRING)); + Schema s1 = created(INDEX, schema::STRING); + Schema s2 = created(ATTRIBUTE, schema::STRING); + Schema s3 = created(SUMMARY, schema::STRING); + Schema s4 = created(SUMMARY, schema::STRING); + s4.addIndexField(IField("f1", schema::STRING)); + Schema s5 = created(SUMMARY, schema::STRING); + s5.addAttributeField(AField("f1", schema::STRING)); + Schema s6 = created(SUMMARY, schema::STRING); + s6.addIndexField(IField("f1", schema::STRING)); + s6.addAttributeField(AField("f1", schema::STRING)); { // addition of field EXPECT_EQUAL(OK, checkSchema(s1, e, e)); EXPECT_EQUAL(OK, checkSchema(s2, e, e)); @@ -267,53 +265,53 @@ TEST("require that fields can be added and removed") TEST("require that data type changed precedes collection type changed") { - Schema olds = SchemaBuilder().add("f1", FType::SUMMARY, Schema::STRING). - add("f2", FType::INDEX, Schema::STRING).schema(); - Schema news = SchemaBuilder().add("f1", FType::SUMMARY, Schema::INT32). - add("f2", FType::INDEX, Schema::STRING, Schema::ARRAY).schema(); + Schema olds = SchemaBuilder().add("f1", FType::SUMMARY, schema::STRING). + add("f2", FType::INDEX, schema::STRING).schema(); + Schema news = SchemaBuilder().add("f1", FType::SUMMARY, schema::INT32). + add("f2", FType::INDEX, schema::STRING, schema::ARRAY).schema(); EXPECT_EQUAL(DTC, checkSchema(news, olds, Schema())); } TEST("require that collection type change precedes index aspect added") { - Schema olds = SchemaBuilder().add("f1", FType::SUMMARY, Schema::STRING). - add("f2", FType::SUMMARY, Schema::STRING).schema(); - Schema news = SchemaBuilder().add("f1", FType::SUMMARY, Schema::STRING, Schema::ARRAY). - add("f2", FType::SUMMARY, Schema::STRING). - add("f2", FType::INDEX, Schema::STRING).schema(); + Schema olds = SchemaBuilder().add("f1", FType::SUMMARY, schema::STRING). + add("f2", FType::SUMMARY, schema::STRING).schema(); + Schema news = SchemaBuilder().add("f1", FType::SUMMARY, schema::STRING, schema::ARRAY). + add("f2", FType::SUMMARY, schema::STRING). + add("f2", FType::INDEX, schema::STRING).schema(); EXPECT_EQUAL(CTC, checkSchema(news, olds, Schema())); } TEST("require that index aspect added precedes index aspect removed") { - Schema olds = SchemaBuilder().add("f1", FType::SUMMARY, Schema::STRING). - add("f2", FType::SUMMARY, Schema::STRING). - add("f2", FType::INDEX, Schema::STRING).schema(); - Schema news = SchemaBuilder().add("f1", FType::SUMMARY, Schema::STRING). - add("f1", FType::INDEX, Schema::STRING). - add("f2", FType::SUMMARY, Schema::STRING).schema(); + Schema olds = SchemaBuilder().add("f1", FType::SUMMARY, schema::STRING). + add("f2", FType::SUMMARY, schema::STRING). + add("f2", FType::INDEX, schema::STRING).schema(); + Schema news = SchemaBuilder().add("f1", FType::SUMMARY, schema::STRING). + add("f1", FType::INDEX, schema::STRING). + add("f2", FType::SUMMARY, schema::STRING).schema(); EXPECT_EQUAL(IAA, checkSchema(news, olds, Schema())); } TEST("require that index aspect removed precedes attribute aspect removed") { - Schema olds = SchemaBuilder().add("f1", FType::SUMMARY, Schema::STRING). - add("f1", FType::INDEX, Schema::STRING). - add("f2", FType::SUMMARY, Schema::STRING). - add("f2", FType::ATTRIBUTE, Schema::STRING).schema(); - Schema news = SchemaBuilder().add("f1", FType::SUMMARY, Schema::STRING). - add("f2", FType::SUMMARY, Schema::STRING).schema(); + Schema olds = SchemaBuilder().add("f1", FType::SUMMARY, schema::STRING). + add("f1", FType::INDEX, schema::STRING). + add("f2", FType::SUMMARY, schema::STRING). + add("f2", FType::ATTRIBUTE, schema::STRING).schema(); + Schema news = SchemaBuilder().add("f1", FType::SUMMARY, schema::STRING). + add("f2", FType::SUMMARY, schema::STRING).schema(); EXPECT_EQUAL(IAR, checkSchema(news, olds, Schema())); } TEST("require that attribute aspect removed precedes attribute aspect added") { - Schema olds = SchemaBuilder().add("f1", FType::SUMMARY, Schema::STRING). - add("f1", FType::ATTRIBUTE, Schema::STRING). - add("f2", FType::SUMMARY, Schema::STRING).schema(); - Schema news = SchemaBuilder().add("f1", FType::SUMMARY, Schema::STRING). - add("f2", FType::SUMMARY, Schema::STRING). - add("f2", FType::ATTRIBUTE, Schema::STRING).schema(); + Schema olds = SchemaBuilder().add("f1", FType::SUMMARY, schema::STRING). + add("f1", FType::ATTRIBUTE, schema::STRING). + add("f2", FType::SUMMARY, schema::STRING).schema(); + Schema news = SchemaBuilder().add("f1", FType::SUMMARY, schema::STRING). + add("f2", FType::SUMMARY, schema::STRING). + add("f2", FType::ATTRIBUTE, schema::STRING).schema(); EXPECT_EQUAL(AAR, checkSchema(news, olds, Schema())); } diff --git a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp index 152b1f5cf29..fa610496227 100644 --- a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp +++ b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp @@ -1,7 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("document_subdbs_test"); #include <vespa/searchcore/proton/bucketdb/bucketdbhandler.h> #include <vespa/searchcore/proton/initializer/task_runner.h> @@ -12,11 +9,11 @@ LOG_SETUP("document_subdbs_test"); #include <vespa/searchcore/proton/server/document_subdb_explorer.h> #include <vespa/searchcore/proton/server/emptysearchview.h> #include <vespa/searchcore/proton/server/fast_access_document_retriever.h> -#include <vespa/searchcore/proton/server/idocumentsubdb.h> #include <vespa/searchcore/proton/server/minimal_document_retriever.h> #include <vespa/searchcore/proton/server/searchabledocsubdb.h> #include <vespa/searchcore/proton/test/test.h> #include <vespa/searchcore/proton/test/thread_utils.h> +#include <vespa/searchcorespi/plugin/iindexmanagerfactory.h> #include <vespa/searchlib/index/docbuilder.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/test/insertion_operators.h> diff --git a/searchcore/src/tests/proton/documentdb/documentdbconfig/documentdbconfig_test.cpp b/searchcore/src/tests/proton/documentdb/documentdbconfig/documentdbconfig_test.cpp index 8fd10b49409..859e54dec5a 100644 --- a/searchcore/src/tests/proton/documentdb/documentdbconfig/documentdbconfig_test.cpp +++ b/searchcore/src/tests/proton/documentdb/documentdbconfig/documentdbconfig_test.cpp @@ -1,12 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("documentdbconfig_test"); - #include <vespa/searchcore/proton/server/documentdbconfig.h> #include <vespa/searchcore/proton/test/documentdb_config_builder.h> #include <vespa/vespalib/testkit/testapp.h> +#include <vespa/config-rank-profiles.h> using namespace document; using namespace proton; diff --git a/searchcore/src/tests/proton/documentdb/documentdbconfigscout/documentdbconfigscout_test.cpp b/searchcore/src/tests/proton/documentdb/documentdbconfigscout/documentdbconfigscout_test.cpp index 25c55fa2dbc..31d580b0756 100644 --- a/searchcore/src/tests/proton/documentdb/documentdbconfigscout/documentdbconfigscout_test.cpp +++ b/searchcore/src/tests/proton/documentdb/documentdbconfigscout/documentdbconfigscout_test.cpp @@ -1,13 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("documentdbconfigscout_test"); - #include <vespa/searchcore/proton/server/documentdbconfig.h> #include <vespa/searchcore/proton/server/documentdbconfigscout.h> #include <vespa/searchcore/proton/test/documentdb_config_builder.h> #include <vespa/vespalib/testkit/testapp.h> +#include <vespa/config-attributes.h> using namespace document; using namespace proton; diff --git a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp index 8a7f646383f..168bb7cefad 100644 --- a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp +++ b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp @@ -1,7 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("feedhandler_test"); + #include <vespa/documentapi/messagebus/documentprotocol.h> #include <vespa/documentapi/messagebus/messages/documentreply.h> #include <vespa/documentapi/messagebus/messages/removedocumentreply.h> @@ -23,6 +21,9 @@ LOG_SETUP("feedhandler_test"); #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/closuretask.h> #include <vespa/searchcore/proton/bucketdb/bucketdbhandler.h> +#include <vespa/vespalib/util/exceptions.h> +#include <vespa/log/log.h> +LOG_SETUP("feedhandler_test"); using document::BucketId; using document::Document; @@ -35,9 +36,7 @@ using documentapi::DocumentReply; using documentapi::RemoveDocumentReply; using documentapi::UpdateDocumentReply; using mbus::Reply; -using search::index::DocBuilder; -using search::index::DummyFileHeaderContext; -using search::index::Schema; +using namespace search::index; using search::SerialNum; using search::transactionlog::TransLogServer; using storage::spi::PartitionId; @@ -259,7 +258,7 @@ struct SchemaContext { schema(new Schema()), builder() { - schema->addIndexField(Schema::IndexField("i1", Schema::STRING, Schema::SINGLE)); + schema->addIndexField(Schema::IndexField("i1", schema::STRING, schema::SINGLE)); builder.reset(new DocBuilder(*schema)); } DocTypeName getDocType() const { diff --git a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp index 5dc7b335106..6415138631e 100644 --- a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp +++ b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp @@ -47,8 +47,7 @@ using search::AttributeVector; using search::CacheStats; using search::DocumentMetaData; using search::SearchableStats; -using search::index::DocBuilder; -using search::index::Schema; +using namespace search::index; using searchcorespi::IndexSearchable; using storage::spi::BucketChecksum; using storage::spi::BucketInfo; @@ -399,11 +398,11 @@ struct SchemaContext _schema(new Schema()), _builder() { - _schema->addIndexField(Schema::IndexField("i1", Schema::STRING, Schema::SINGLE)); - _schema->addAttributeField(Schema::AttributeField("a1", Schema::STRING, Schema::SINGLE)); - _schema->addAttributeField(Schema::AttributeField("a2", Schema::BOOLEANTREE, Schema::SINGLE)); - _schema->addAttributeField(Schema::AttributeField("a3", Schema::TENSOR, Schema::SINGLE)); - _schema->addSummaryField(Schema::SummaryField("s1", Schema::STRING, Schema::SINGLE)); + _schema->addIndexField(Schema::IndexField("i1", schema::STRING, schema::SINGLE)); + _schema->addAttributeField(Schema::AttributeField("a1", schema::STRING, schema::SINGLE)); + _schema->addAttributeField(Schema::AttributeField("a2", schema::BOOLEANTREE, schema::SINGLE)); + _schema->addAttributeField(Schema::AttributeField("a3", schema::TENSOR, schema::SINGLE)); + _schema->addSummaryField(Schema::SummaryField("s1", schema::STRING, schema::SINGLE)); _builder.reset(new DocBuilder(*_schema)); } const document::DocumentTypeRepo::SP &getRepo() const { return _builder->getDocumentTypeRepo(); } diff --git a/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp b/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp index 16cad6e07bd..8d6d8293d82 100644 --- a/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp +++ b/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp @@ -1,7 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("fileconfigmanager_test"); #include "config-mycfg.h" #include <vespa/searchcore/proton/server/fileconfigmanager.h> @@ -9,6 +6,13 @@ LOG_SETUP("fileconfigmanager_test"); #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/testkit/test_kit.h> #include <vespa/searchcore/proton/common/schemautil.h> +#include <vespa/config-summary.h> +#include <vespa/config-summarymap.h> +#include <vespa/config-rank-profiles.h> +#include <vespa/config-attributes.h> +#include <vespa/config-indexschema.h> +#include <vespa/searchsummary/config/config-juniperrc.h> + using namespace config; using namespace document; @@ -38,12 +42,12 @@ Schema::SP getSchema(int step) { Schema::SP schema(new Schema); - schema->addIndexField(Schema::IndexField("foo1", Schema::STRING)); + schema->addIndexField(Schema::IndexField("foo1", schema::STRING)); if (step < 2) { - schema->addIndexField(Schema::IndexField("foo2", Schema::STRING)); + schema->addIndexField(Schema::IndexField("foo2", schema::STRING)); } if (step < 1) { - schema->addIndexField(Schema::IndexField("foo3", Schema::STRING)); + schema->addIndexField(Schema::IndexField("foo3", schema::STRING)); } return schema; } @@ -76,7 +80,7 @@ Schema makeHistorySchema() { Schema hs; - hs.addIndexField(Schema::IndexField("history", Schema::STRING)); + hs.addIndexField(Schema::IndexField("history", schema::STRING)); return hs; } diff --git a/searchcore/src/tests/proton/feed_and_search/feed_and_search.cpp b/searchcore/src/tests/proton/feed_and_search/feed_and_search.cpp index ccd80f6bdf3..3b863561188 100644 --- a/searchcore/src/tests/proton/feed_and_search/feed_and_search.cpp +++ b/searchcore/src/tests/proton/feed_and_search/feed_and_search.cpp @@ -96,8 +96,7 @@ const uint32_t field_id = 1; Schema getSchema() { Schema schema; - schema.addIndexField(Schema::IndexField(field_name, - Schema::STRING)); + schema.addIndexField(Schema::IndexField(field_name, search::index::schema::STRING)); return schema; } diff --git a/searchcore/src/tests/proton/feedtoken/feedtoken.cpp b/searchcore/src/tests/proton/feedtoken/feedtoken.cpp index bd7d0b9cf6c..074c9284c06 100644 --- a/searchcore/src/tests/proton/feedtoken/feedtoken.cpp +++ b/searchcore/src/tests/proton/feedtoken/feedtoken.cpp @@ -1,13 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("feedtoken_test"); - #include <vespa/messagebus/emptyreply.h> #include <vespa/messagebus/testlib/receptor.h> #include <vespa/documentapi/messagebus/messages/removedocumentreply.h> #include <vespa/searchcore/proton/common/feedtoken.h> #include <vespa/vespalib/testkit/testapp.h> +#include <vespa/vespalib/util/exceptions.h> using namespace proton; @@ -24,10 +21,7 @@ public: // empty } - void send(mbus::Reply::UP reply, - ResultUP, - bool, - double latency_ms) { + void send(mbus::Reply::UP reply, ResultUP, bool, double latency_ms) { _receptor.handleReply(std::move(reply)); _latency_ms = latency_ms; } diff --git a/searchcore/src/tests/proton/index/fusionrunner_test.cpp b/searchcore/src/tests/proton/index/fusionrunner_test.cpp index dd2bcee97b2..5b0420bc922 100644 --- a/searchcore/src/tests/proton/index/fusionrunner_test.cpp +++ b/searchcore/src/tests/proton/index/fusionrunner_test.cpp @@ -125,7 +125,7 @@ const uint32_t disk_id[] = { 1, 2, 21, 42 }; Schema getSchema() { Schema schema; schema.addIndexField( - Schema::IndexField(field_name, Schema::STRING)); + Schema::IndexField(field_name, search::index::schema::STRING)); return schema; } diff --git a/searchcore/src/tests/proton/index/indexmanager_test.cpp b/searchcore/src/tests/proton/index/indexmanager_test.cpp index a384bc824c5..ca53364f1b5 100644 --- a/searchcore/src/tests/proton/index/indexmanager_test.cpp +++ b/searchcore/src/tests/proton/index/indexmanager_test.cpp @@ -78,7 +78,7 @@ const uint32_t docid = 1; Schema getSchema() { Schema schema; - schema.addIndexField(Schema::IndexField(field_name, Schema::STRING)); + schema.addIndexField(Schema::IndexField(field_name, search::index::schema::STRING)); return schema; } diff --git a/searchcore/src/tests/proton/matching/matching_test.cpp b/searchcore/src/tests/proton/matching/matching_test.cpp index 533bbd9be1d..88561b529bc 100644 --- a/searchcore/src/tests/proton/matching/matching_test.cpp +++ b/searchcore/src/tests/proton/matching/matching_test.cpp @@ -143,12 +143,12 @@ struct MyWorld { void basicSetup(size_t heapSize=10, size_t arraySize=100) { // schema - schema.addIndexField(Schema::IndexField("f1", Schema::STRING)); - schema.addIndexField(Schema::IndexField("f2", Schema::STRING)); - schema.addIndexField(Schema::IndexField("tensor_field", Schema::TENSOR)); - schema.addAttributeField(Schema::AttributeField("a1", Schema::INT32)); - schema.addAttributeField(Schema::AttributeField("a2", Schema::INT32)); - schema.addAttributeField(Schema::AttributeField("predicate_field", Schema::BOOLEANTREE)); + schema.addIndexField(Schema::IndexField("f1", schema::STRING)); + schema.addIndexField(Schema::IndexField("f2", schema::STRING)); + schema.addIndexField(Schema::IndexField("tensor_field", schema::TENSOR)); + schema.addAttributeField(Schema::AttributeField("a1", schema::INT32)); + schema.addAttributeField(Schema::AttributeField("a2", schema::INT32)); + schema.addAttributeField(Schema::AttributeField("predicate_field", schema::BOOLEANTREE)); // config config.add(indexproperties::rank::FirstPhase::NAME, "attribute(a1)"); diff --git a/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp b/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp index d3313e2149b..f73cfaf0e9d 100644 --- a/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp +++ b/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp @@ -9,6 +9,7 @@ #include <vespa/document/fieldset/fieldsets.h> #include <vespa/vdslib/distribution/distribution.h> #include <vespa/vdslib/state/clusterstate.h> +#include <vespa/config-stor-distribution.h> #include <set> using document::BucketId; diff --git a/searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp b/searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp index 44eb1353637..5d0056981ed 100644 --- a/searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp +++ b/searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp @@ -77,18 +77,18 @@ struct MyConfig for (auto attr : attrs) { if (attr == "tensor") { _mgr->addAttribute(attr, test::AttributeUtils::getTensorConfig(), 1); - _schema.addAttributeField(Schema::AttributeField(attr, Schema::TENSOR)); + _schema.addAttributeField(Schema::AttributeField(attr, schema::TENSOR)); } else if (attr == "predicate") { _mgr->addAttribute(attr, test::AttributeUtils::getPredicateConfig(), 1); - _schema.addAttributeField(Schema::AttributeField(attr, Schema::BOOLEANTREE)); + _schema.addAttributeField(Schema::AttributeField(attr, schema::BOOLEANTREE)); } else { _mgr->addAttribute(attr, test::AttributeUtils::getStringConfig(), 1); - _schema.addAttributeField(Schema::AttributeField(attr, Schema::STRING)); + _schema.addAttributeField(Schema::AttributeField(attr, schema::STRING)); } } } void addIndexField(const vespalib::string &name) { - _schema.addIndexField(Schema::IndexField(name, Schema::STRING)); + _schema.addIndexField(Schema::IndexField(name, schema::STRING)); } }; diff --git a/searchcore/src/tests/proton/server/documentretriever_test.cpp b/searchcore/src/tests/proton/server/documentretriever_test.cpp index a2b9b7e416b..ac505699eaf 100644 --- a/searchcore/src/tests/proton/server/documentretriever_test.cpp +++ b/searchcore/src/tests/proton/server/documentretriever_test.cpp @@ -75,6 +75,7 @@ using storage::spi::Timestamp; using vespalib::make_string; using vespalib::string; using namespace document::config_builder; +using namespace search::index; using namespace proton; @@ -175,17 +176,17 @@ BasicType convertDataType(Schema::DataType t) { switch (t) { - case Schema::INT32: + case schema::INT32: return BasicType::INT32; - case Schema::INT64: + case schema::INT64: return BasicType::INT64; - case Schema::FLOAT: + case schema::FLOAT: return BasicType::FLOAT; - case Schema::DOUBLE: + case schema::DOUBLE: return BasicType::DOUBLE; - case Schema::STRING: + case schema::STRING: return BasicType::STRING; - case Schema::BOOLEANTREE: + case schema::BOOLEANTREE: return BasicType::PREDICATE; default: throw std::runtime_error(make_string("Data type %u not handled", (uint32_t)t)); @@ -196,11 +197,11 @@ CollectionType convertCollectionType(Schema::CollectionType ct) { switch (ct) { - case Schema::SINGLE: + case schema::SINGLE: return CollectionType::SINGLE; - case Schema::ARRAY: + case schema::ARRAY: return CollectionType::ARRAY; - case Schema::WEIGHTEDSET: + case schema::WEIGHTEDSET: return CollectionType::WSET; default: throw std::runtime_error(make_string("Collection type %u not handled", (uint32_t)ct)); @@ -246,7 +247,7 @@ struct Fixture { void addAttribute(const char *name, U val, Schema::DataType t, Schema::CollectionType ct) { T *attr = addAttribute<T>(name, t, ct); - if (ct == Schema::SINGLE) { + if (ct == schema::SINGLE) { attr->update(lid, val); } else { attr->append(lid, val + 1, dyn_weight); @@ -275,43 +276,43 @@ struct Fixture { Result putRes(meta_store.get().put(gid, bucket_id, timestamp, inspect.getLid())); lid = putRes.getLid(); ASSERT_TRUE(putRes.ok()); - Schema::CollectionType ct = Schema::SINGLE; + schema::CollectionType ct = schema::SINGLE; addAttribute<IntegerAttribute>( - dyn_field_i, dyn_value_i, Schema::INT32, ct); + dyn_field_i, dyn_value_i, schema::INT32, ct); addAttribute<FloatingPointAttribute>( - dyn_field_d, dyn_value_d, Schema::DOUBLE, ct); + dyn_field_d, dyn_value_d, schema::DOUBLE, ct); addAttribute<StringAttribute>( - dyn_field_s, dyn_value_s, Schema::STRING, ct); + dyn_field_s, dyn_value_s, schema::STRING, ct); addAttribute<FloatingPointAttribute>( - dyn_field_n, Schema::FLOAT, ct); + dyn_field_n, schema::FLOAT, ct); addAttribute<IntegerAttribute>( - dyn_field_nai, Schema::INT32, ct); + dyn_field_nai, schema::INT32, ct); addAttribute<StringAttribute>( - dyn_field_nas, Schema::STRING, ct); + dyn_field_nas, schema::STRING, ct); addAttribute<IntegerAttribute>( - zcurve_field, dynamic_zcurve_value, Schema::INT64, ct); + zcurve_field, dynamic_zcurve_value, schema::INT64, ct); PredicateAttribute *attr = addAttribute<PredicateAttribute>( - dyn_field_p, Schema::BOOLEANTREE, ct); + dyn_field_p, schema::BOOLEANTREE, ct); attr->getIndex().indexEmptyDocument(lid); attr->commit(); - ct = Schema::ARRAY; + ct = schema::ARRAY; addAttribute<IntegerAttribute>( - dyn_arr_field_i, dyn_value_i, Schema::INT32, ct); + dyn_arr_field_i, dyn_value_i, schema::INT32, ct); addAttribute<FloatingPointAttribute>( - dyn_arr_field_d, dyn_value_d, Schema::DOUBLE, ct); + dyn_arr_field_d, dyn_value_d, schema::DOUBLE, ct); addAttribute<StringAttribute>( - dyn_arr_field_s, dyn_value_s, Schema::STRING, ct); + dyn_arr_field_s, dyn_value_s, schema::STRING, ct); addAttribute<FloatingPointAttribute>( - dyn_arr_field_n, Schema::FLOAT, ct); - ct = Schema::WEIGHTEDSET; + dyn_arr_field_n, schema::FLOAT, ct); + ct = schema::WEIGHTEDSET; addAttribute<IntegerAttribute>( - dyn_wset_field_i, dyn_value_i, Schema::INT32, ct); + dyn_wset_field_i, dyn_value_i, schema::INT32, ct); addAttribute<FloatingPointAttribute>( - dyn_wset_field_d, dyn_value_d, Schema::DOUBLE, ct); + dyn_wset_field_d, dyn_value_d, schema::DOUBLE, ct); addAttribute<StringAttribute>( - dyn_wset_field_s, dyn_value_s, Schema::STRING, ct); + dyn_wset_field_s, dyn_value_s, schema::STRING, ct); addAttribute<FloatingPointAttribute>( - dyn_wset_field_n, Schema::FLOAT, ct); + dyn_wset_field_n, schema::FLOAT, ct); } }; @@ -405,7 +406,7 @@ TEST_F("require that attributes are patched into stored document", Fixture) { } TEST_F("require that attributes are patched into stored document unless also index field", Fixture) { - f.schema.addIndexField(Schema::IndexField(dyn_field_s, Schema::STRING)); + f.schema.addIndexField(Schema::IndexField(dyn_field_s, schema::STRING)); DocumentMetaData meta_data = f.retriever.getDocumentMetaData(doc_id); Document::UP doc = f.retriever.getDocument(meta_data.lid); ASSERT_TRUE(doc.get()); diff --git a/searchcore/src/tests/proton/server/memoryconfigstore_test.cpp b/searchcore/src/tests/proton/server/memoryconfigstore_test.cpp index e4c404f5cdd..387fff27ca9 100644 --- a/searchcore/src/tests/proton/server/memoryconfigstore_test.cpp +++ b/searchcore/src/tests/proton/server/memoryconfigstore_test.cpp @@ -35,12 +35,12 @@ Schema::SP getSchema(int step) { Schema::SP schema(new Schema); - schema->addIndexField(Schema::IndexField("foo1", Schema::STRING)); + schema->addIndexField(Schema::IndexField("foo1", search::index::schema::STRING)); if (step < 2) { - schema->addIndexField(Schema::IndexField("foo2", Schema::STRING)); + schema->addIndexField(Schema::IndexField("foo2", search::index::schema::STRING)); } if (step < 1) { - schema->addIndexField(Schema::IndexField("foo3", Schema::STRING)); + schema->addIndexField(Schema::IndexField("foo3", search::index::schema::STRING)); } return schema; } @@ -113,7 +113,7 @@ TEST("require that wipe history clears previous history schema " "and adds new, identical entry for current serial num") { MemoryConfigStore config_store; Schema::SP history(new Schema); - history->addIndexField(Schema::IndexField("foo", Schema::STRING)); + history->addIndexField(Schema::IndexField("foo", search::index::schema::STRING)); config_store.saveConfig(*getConfig(10), *history, 5); DocumentDBConfig::SP config; config_store.loadConfig(*getConfig(14), 5, config, history); @@ -171,7 +171,7 @@ TEST("require that wipe history clears only portions of history") TEST("require that wipe history does nothing if serial num exists") { MemoryConfigStore config_store; Schema::SP history(new Schema); - history->addIndexField(Schema::IndexField("foo", Schema::STRING)); + history->addIndexField(Schema::IndexField("foo", search::index::schema::STRING)); config_store.saveConfig(*getConfig(10), *history, 5); DocumentDBConfig::SP config; config_store.saveWipeHistoryConfig(5, 0); diff --git a/searchcore/src/tests/proton/verify_ranksetup/verify_ranksetup_test.cpp b/searchcore/src/tests/proton/verify_ranksetup/verify_ranksetup_test.cpp index 8cace3a7bb4..bd1b0a5db6b 100644 --- a/searchcore/src/tests/proton/verify_ranksetup/verify_ranksetup_test.cpp +++ b/searchcore/src/tests/proton/verify_ranksetup/verify_ranksetup_test.cpp @@ -15,8 +15,8 @@ const std::string gen_dir("generated"); const char *valid_feature = "value(0)"; const char *invalid_feature = "invalid_feature_name and format"; -using search::index::Schema; using namespace search::fef::indexproperties; +using namespace search::index; struct Writer { FILE *file; @@ -53,17 +53,17 @@ struct Model { Model() : indexes(), attributes(), properties(), extra_profiles() { verify_dir(); } - void index(const std::string &name, Schema::DataType data_type, - Schema::CollectionType collection_type) + void index(const std::string &name, schema::DataType data_type, + schema::CollectionType collection_type) { - indexes[name].first = Schema::getTypeName(data_type); - indexes[name].second = Schema::getTypeName(collection_type); + indexes[name].first = schema::getTypeName(data_type); + indexes[name].second = schema::getTypeName(collection_type); } - void attribute(const std::string &name, Schema::DataType data_type, - Schema::CollectionType collection_type) + void attribute(const std::string &name, schema::DataType data_type, + schema::CollectionType collection_type) { - attributes[name].first = Schema::getTypeName(data_type); - attributes[name].second = Schema::getTypeName(collection_type); + attributes[name].first = schema::getTypeName(data_type); + attributes[name].second = schema::getTypeName(collection_type); } void property(const std::string &name, const std::string &val) { properties[name] = val; @@ -162,18 +162,18 @@ struct EmptyModel : Model {}; struct SimpleModel : Model { SimpleModel() : Model() { - index("title", Schema::STRING, Schema::SINGLE); - index("list", Schema::STRING, Schema::ARRAY); - index("keywords", Schema::STRING, Schema::WEIGHTEDSET); - attribute("date", Schema::INT32, Schema::SINGLE); + index("title", schema::STRING, schema::SINGLE); + index("list", schema::STRING, schema::ARRAY); + index("keywords", schema::STRING, schema::WEIGHTEDSET); + attribute("date", schema::INT32, schema::SINGLE); constants["my_tensor"] = "tensor(x{},y{})"; } }; struct ShadowModel : Model { ShadowModel() : Model() { - index("both", Schema::STRING, Schema::SINGLE); - attribute("both", Schema::STRING, Schema::SINGLE); + index("both", schema::STRING, schema::SINGLE); + attribute("both", schema::STRING, schema::SINGLE); } }; diff --git a/searchcore/src/vespa/searchcore/fdispatch/program/fdispatch.h b/searchcore/src/vespa/searchcore/fdispatch/program/fdispatch.h index f4fa80a77ab..1def71604fb 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/program/fdispatch.h +++ b/searchcore/src/vespa/searchcore/fdispatch/program/fdispatch.h @@ -9,6 +9,8 @@ #include <vespa/searchlib/engine/transportserver.h> #include <vespa/searchcore/config/config-fdispatchrc.h> #include <vespa/config/subscription/configuri.h> +#include <vespa/config/helper/ifetchercallback.h> +#include <vespa/config/helper/configfetcher.h> #include <vespa/vespalib/net/simple_component_config_producer.h> #include <vespa/vespalib/util/random.h> diff --git a/searchcore/src/vespa/searchcore/fdispatch/search/search_path.cpp b/searchcore/src/vespa/searchcore/fdispatch/search/search_path.cpp index b8e0417678e..67491cc9ff7 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/search/search_path.cpp +++ b/searchcore/src/vespa/searchcore/fdispatch/search/search_path.cpp @@ -1,11 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".fdispatch.search_path"); #include "search_path.h" +#include <vespa/vespalib/stllike/asciistream.h> -#include <iostream> +#include <vespa/log/log.h> +LOG_SETUP(".fdispatch.search_path"); namespace fdispatch { diff --git a/searchcore/src/vespa/searchcore/fdispatch/search/search_path.h b/searchcore/src/vespa/searchcore/fdispatch/search/search_path.h index 706bb1bc1b9..9bc5da83a09 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/search/search_path.h +++ b/searchcore/src/vespa/searchcore/fdispatch/search/search_path.h @@ -2,10 +2,13 @@ #pragma once -#include <vespa/vespalib/stllike/asciistream.h> #include <vespa/vespalib/stllike/string.h> #include <set> +#include <vector> +namespace vespalib { + class asciistream; +} namespace fdispatch { class SearchPath diff --git a/searchcore/src/vespa/searchcore/grouping/groupingcontext.h b/searchcore/src/vespa/searchcore/grouping/groupingcontext.h index cd3b69d1bf5..e79408fc6a3 100644 --- a/searchcore/src/vespa/searchcore/grouping/groupingcontext.h +++ b/searchcore/src/vespa/searchcore/grouping/groupingcontext.h @@ -2,6 +2,7 @@ #pragma once #include <vespa/searchlib/aggregation/grouping.h> +#include <vespa/vespalib/objects/nbostream.h> #include <vector> #include <memory> @@ -17,9 +18,9 @@ namespace grouping { class GroupingContext { public: - typedef std::unique_ptr<GroupingContext> UP; + typedef std::unique_ptr<GroupingContext> UP; typedef std::shared_ptr<search::aggregation::Grouping> GroupingPtr; - typedef std::vector<GroupingPtr> GroupingList; + typedef std::vector<GroupingPtr> GroupingList; private: GroupingContext &operator=(const GroupingContext &); diff --git a/searchcore/src/vespa/searchcore/grouping/mergingmanager.cpp b/searchcore/src/vespa/searchcore/grouping/mergingmanager.cpp index 3087fcf47d9..b8fffa4a17a 100644 --- a/searchcore/src/vespa/searchcore/grouping/mergingmanager.cpp +++ b/searchcore/src/vespa/searchcore/grouping/mergingmanager.cpp @@ -1,13 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".mergingmanager"); #include "mergingmanager.h" #include <map> #include <vespa/searchlib/aggregation/grouping.h> #include <vespa/searchlib/aggregation/fs4hit.h> #include <vespa/vespalib/objects/objectpredicate.h> #include <vespa/vespalib/objects/objectoperation.h> +#include <vespa/vespalib/objects/nbostream.h> namespace search { namespace grouping { diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_filter_config.h b/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_filter_config.h index 7612543554c..393caaf64af 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_filter_config.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_filter_config.h @@ -20,15 +20,13 @@ struct AttributeUsageFilterConfig AttributeUsageFilterConfig() : _enumStoreLimit(1.0), _multiValueLimit(1.0) - { - } + { } AttributeUsageFilterConfig(double enumStoreLimit_in, double multiValueLimit_in) : _enumStoreLimit(enumStoreLimit_in), _multiValueLimit(multiValueLimit_in) - { - } + { } bool operator==(const AttributeUsageFilterConfig &rhs) const { return ((_enumStoreLimit == rhs._enumStoreLimit) && diff --git a/searchcore/src/vespa/searchcore/proton/attribute/document_field_retriever.cpp b/searchcore/src/vespa/searchcore/proton/attribute/document_field_retriever.cpp index f95bf7dabf4..0995c1f4b68 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/document_field_retriever.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/document_field_retriever.cpp @@ -1,16 +1,16 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.attribute.document_field_retriever"); #include "document_field_retriever.h" - #include <vespa/document/fieldvalue/arrayfieldvalue.h> #include <vespa/document/fieldvalue/weightedsetfieldvalue.h> #include <vespa/document/fieldvalue/tensorfieldvalue.h> #include <vespa/searchcommon/attribute/attributecontent.h> #include <vespa/searchlib/tensor/tensor_attribute.h> #include <vespa/vespalib/tensor/tensor.h> +#include <vespa/vespalib/util/exceptions.h> + +#include <vespa/log/log.h> +LOG_SETUP(".proton.attribute.document_field_retriever"); using search::DocumentIdT; using document::ArrayFieldValue; @@ -19,7 +19,7 @@ using document::Field; using document::FieldValue; using document::TensorFieldValue; using document::WeightedSetFieldValue; -using search::index::Schema; +using namespace search::index; using search::attribute::AttributeContent; using search::attribute::IAttributeVector; using search::attribute::WeightedType; @@ -38,7 +38,7 @@ setValue(DocumentIdT lid, const IAttributeVector &attr) { switch (field.getCollectionType()) { - case Schema::SINGLE: + case schema::SINGLE: { if ( ! attr.isUndefined(lid) ) { AttributeContent<T> content; @@ -49,7 +49,7 @@ setValue(DocumentIdT lid, } break; } - case Schema::ARRAY: + case schema::ARRAY: { AttributeContent<T> content; content.fill(attr, lid); @@ -69,7 +69,7 @@ setValue(DocumentIdT lid, doc.setValue(f, *fv); break; } - case Schema::WEIGHTEDSET: + case schema::WEIGHTEDSET: { AttributeContent<WeightedType<T> > content; content.fill(attr, lid); @@ -107,34 +107,34 @@ DocumentFieldRetriever::populate(DocumentIdT lid, bool isIndexField) { switch (field.getDataType()) { - case Schema::UINT1: - case Schema::UINT2: - case Schema::UINT4: - case Schema::INT8: - case Schema::INT16: - case Schema::INT32: - case Schema::INT64: + case schema::UINT1: + case schema::UINT2: + case schema::UINT4: + case schema::INT8: + case schema::INT16: + case schema::INT32: + case schema::INT64: setValue<IAttributeVector::largeint_t>( lid, doc, field, attr); break; - case Schema::FLOAT: - case Schema::DOUBLE: + case schema::FLOAT: + case schema::DOUBLE: setValue<double>(lid, doc, field, attr); break; - case Schema::STRING: + case schema::STRING: // If it is a stringfield we also need to check if // it is an index field. In that case we shall // keep the original in order to preserve annotations. if (isIndexField) { break; } - case Schema::RAW: + case schema::RAW: setValue<const char *>(lid, doc, field, attr); break; - case Schema::BOOLEANTREE: + case schema::BOOLEANTREE: // Predicate attribute doesn't store documents, it only indexes them. break; - case Schema::TENSOR: + case schema::TENSOR: // Tensor attribute is not authorative. Partial updates must update // document store. break; diff --git a/searchcore/src/vespa/searchcore/proton/common/feeddebugger.cpp b/searchcore/src/vespa/searchcore/proton/common/feeddebugger.cpp index c01fdda78db..48ba7207281 100644 --- a/searchcore/src/vespa/searchcore/proton/common/feeddebugger.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/feeddebugger.cpp @@ -1,11 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "feeddebugger.h" #include <vespa/vespalib/text/stringtokenizer.h> +#include <vespa/vespalib/stllike/asciistream.h> -namespace proton -{ +namespace proton { namespace { diff --git a/searchcore/src/vespa/searchcore/proton/common/schemautil.cpp b/searchcore/src/vespa/searchcore/proton/common/schemautil.cpp index 4175925357d..da7e89d8f59 100644 --- a/searchcore/src/vespa/searchcore/proton/common/schemautil.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/schemautil.cpp @@ -1,11 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> +#include "schemautil.h" + #include <vespa/log/log.h> LOG_SETUP(".proton.common.schemautil"); -#include "schemautil.h" - -using search::index::Schema; +using namespace search::index; namespace proton { @@ -205,24 +205,24 @@ SchemaUtil::listSchema(const Schema &schema, const Schema::AttributeField &field = schema.getAttributeField(i); quads.push_back( FieldQuad(field.getName(), - Schema::getTypeName(field.getDataType()), - Schema::getTypeName(field.getCollectionType()), + schema::getTypeName(field.getDataType()), + schema::getTypeName(field.getCollectionType()), "a")); } for (uint32_t i = 0; i < schema.getNumIndexFields(); ++i) { const Schema::IndexField &field = schema.getIndexField(i); quads.push_back( FieldQuad(field.getName(), - Schema::getTypeName(field.getDataType()), - Schema::getTypeName(field.getCollectionType()), + schema::getTypeName(field.getDataType()), + schema::getTypeName(field.getCollectionType()), "i")); } for (uint32_t i = 0; i < schema.getNumSummaryFields(); ++i) { const Schema::SummaryField &field = schema.getSummaryField(i); quads.push_back( FieldQuad(field.getName(), - Schema::getTypeName(field.getDataType()), - Schema::getTypeName(field.getCollectionType()), + schema::getTypeName(field.getDataType()), + schema::getTypeName(field.getCollectionType()), "s")); } std::sort(quads.begin(), quads.end()); diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/documentstoreadapter.cpp b/searchcore/src/vespa/searchcore/proton/docsummary/documentstoreadapter.cpp index eb44ac89e32..855126bd064 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/documentstoreadapter.cpp +++ b/searchcore/src/vespa/searchcore/proton/docsummary/documentstoreadapter.cpp @@ -1,12 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.docsummary.documentstoreadapter"); #include "documentstoreadapter.h" #include "summaryfieldconverter.h" - -#include <vespa/document/fieldvalue/literalfieldvalue.h> +#include <vespa/document/fieldvalue/stringfieldvalue.h> +#include <vespa/log/log.h> +LOG_SETUP(".proton.docsummary.documentstoreadapter"); using namespace document; using namespace search::docsummary; diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summaryfieldconverter.cpp b/searchcore/src/vespa/searchcore/proton/docsummary/summaryfieldconverter.cpp index 58839cd7f04..0c4d739be79 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/summaryfieldconverter.cpp +++ b/searchcore/src/vespa/searchcore/proton/docsummary/summaryfieldconverter.cpp @@ -1,11 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.docsummary.summaryfieldconverter"); - #include "summaryfieldconverter.h" - #include "linguisticsannotation.h" #include "searchdatatype.h" #include <vespa/document/annotation/alternatespanlist.h> @@ -48,6 +43,7 @@ LOG_SETUP(".proton.docsummary.summaryfieldconverter"); #include <vespa/vespalib/data/slime/json_format.h> #include <vespa/vespalib/tensor/serialization/slime_binary_format.h> #include <vespa/searchlib/util/slime_output_raw_buf_adapter.h> +#include <vespa/vespalib/util/exceptions.h> using document::AlternateSpanList; diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.h b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.h index 85eed282ea0..cef714f024e 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.h +++ b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.h @@ -1,7 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/document/document.h> +#include <vespa/document/fieldvalue/document.h> #include <vespa/document/repo/documenttyperepo.h> #include <vespa/searchcore/config/config-proton.h> #include <vespa/searchcore/proton/attribute/attributemanager.h> diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp index a4e43324c8f..11ff8474e88 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp @@ -1,8 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.documentmetastore.documentmetastore"); #include "documentmetastore.h" #include "search_context.h" @@ -15,6 +12,7 @@ LOG_SETUP(".proton.documentmetastore.documentmetastore"); #include <vespa/searchlib/btree/btreeroot.hpp> #include <vespa/searchlib/btree/btreebuilder.hpp> #include <vespa/vespalib/data/fileheader.h> +#include <vespa/vespalib/util/exceptions.h> #include <vespa/searchcore/proton/bucketdb/bucketsessionbase.h> #include <vespa/searchcore/proton/bucketdb/joinbucketssession.h> #include <vespa/searchcore/proton/bucketdb/splitbucketsession.h> diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreattribute.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreattribute.cpp index 3de5c4c84d1..4105f3e1f9b 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreattribute.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreattribute.cpp @@ -1,9 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.documentmetastore.documentmetastoreattribute"); #include "documentmetastoreattribute.h" +#include <vespa/vespalib/util/exceptions.h> namespace proton { @@ -30,12 +28,10 @@ DocumentMetaStoreAttribute::notImplemented() const DocumentMetaStoreAttribute::DocumentMetaStoreAttribute(const vespalib::string &name) : NotImplementedAttribute(name, Config(BasicType::NONE)) -{ -} +{ } DocumentMetaStoreAttribute::~DocumentMetaStoreAttribute() -{ -} +{ } } diff --git a/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.cpp b/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.cpp index 062bc7bdd27..7cec043a162 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.cpp @@ -1,8 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.matching.indexenvironment"); #include "indexenvironment.h" #include <vespa/searchlib/fef/functiontablefactory.h> @@ -18,9 +16,9 @@ namespace { search::fef::CollectionType convertCollectionType(search::index::Schema::CollectionType type) { switch (type) { - case search::index::Schema::SINGLE: return search::fef::CollectionType::SINGLE; - case search::index::Schema::ARRAY: return search::fef::CollectionType::ARRAY; - case search::index::Schema::WEIGHTEDSET: return search::fef::CollectionType::WEIGHTEDSET; + case search::index::schema::SINGLE: return search::fef::CollectionType::SINGLE; + case search::index::schema::ARRAY: return search::fef::CollectionType::ARRAY; + case search::index::schema::WEIGHTEDSET: return search::fef::CollectionType::WEIGHTEDSET; default: abort(); } diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp index 0cbb00efd85..fb78f25cc41 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp @@ -19,6 +19,7 @@ #include <vespa/vespalib/util/clock.h> #include <vespa/vespalib/util/closure.h> #include <vespa/vespalib/util/thread_bundle.h> +#include <vespa/searchcore/grouping/groupingmanager.h> #include <vespa/log/log.h> #include <cmath> @@ -389,7 +390,7 @@ MatchThread::run() search::ResultSet::UP result = findMatches(*matchTools); match_time.stop(); match_time_s = match_time.elapsed().sec(); - resultContext = resultProcessor.createThreadContext(matchTools->getHardDoom(), thread_id); + resultContext = resultProcessor.createThreadContext(matchTools->getHardDoom(), thread_id, _distributionKey); { WaitTimer get_token_timer(wait_time_s); QueryLimiter::Token::UP processToken( diff --git a/searchcore/src/vespa/searchcore/proton/matching/partial_result.h b/searchcore/src/vespa/searchcore/proton/matching/partial_result.h index 7264057c223..f998a8aa92e 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/partial_result.h +++ b/searchcore/src/vespa/searchcore/proton/matching/partial_result.h @@ -6,8 +6,6 @@ #include <vespa/vespalib/util/dual_merge_director.h> #include <vespa/searchlib/common/rankedhit.h> #include <vector> -#include <algorithm> -#include <memory> namespace proton { namespace matching { diff --git a/searchcore/src/vespa/searchcore/proton/matching/result_processor.cpp b/searchcore/src/vespa/searchcore/proton/matching/result_processor.cpp index 1881c824442..787178de76e 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/result_processor.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/result_processor.cpp @@ -1,13 +1,23 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.matching.result_processor"); #include "result_processor.h" -#include <vespa/searchlib/common/sortresults.h> #include <vespa/searchlib/common/docstamp.h> #include <vespa/searchlib/uca/ucaconverter.h> #include <vespa/searchlib/engine/searchreply.h> +#include <vespa/searchcore/grouping/groupingcontext.h> +#include <vespa/searchcore/grouping/groupingmanager.h> +#include <vespa/searchcore/grouping/groupingsession.h> +#include "partial_result.h" +#include "sessionmanager.h" + +#include <vespa/log/log.h> +LOG_SETUP(".proton.matching.result_processor"); + +using search::attribute::IAttributeContext; +using search::grouping::GroupingSession; +using search::grouping::GroupingContext; +using search::grouping::SessionId; namespace proton { namespace matching { @@ -19,21 +29,40 @@ ResultProcessor::Result::Result(std::unique_ptr<search::engine::SearchReply> rep ResultProcessor::Result::~Result() { } -ResultProcessor::Sort::Sort(const vespalib::Doom & doom, search::attribute::IAttributeContext &ac, const vespalib::string &ss) +ResultProcessor::Sort::Sort(uint32_t partitionId, const vespalib::Doom & doom, IAttributeContext &ac, const vespalib::string &ss) : sorter(FastS_DefaultResultSorter::instance()), _ucaFactory(std::make_unique<search::uca::UcaConverterFactory>()), - sortSpec(doom, *_ucaFactory) + sortSpec(partitionId, doom, *_ucaFactory) { if (!ss.empty() && sortSpec.Init(ss.c_str(), ac)) { sorter = &sortSpec; } } -ResultProcessor::ResultProcessor(search::attribute::IAttributeContext &attrContext, +ResultProcessor::Context::Context(Sort::UP s, PartialResult::LP r, GroupingContext::UP g) + : sort(std::move(s)), + result(r), + grouping(std::move(g)), + groupingSource(grouping.get()) +{ } + +ResultProcessor::Context::~Context() { } + +void +ResultProcessor::GroupingSource::merge(Source &s) { + GroupingSource &rhs = static_cast<GroupingSource&>(s); + assert((ctx == 0) == (rhs.ctx == 0)); + if (ctx != 0) { + search::grouping::GroupingManager man(*ctx); + man.merge(*rhs.ctx); + } +} + +ResultProcessor::ResultProcessor(IAttributeContext &attrContext, const search::IDocumentMetaStore &metaStore, SessionManager &sessionMgr, - search::grouping::GroupingContext &groupingContext, - const search::grouping::SessionId &sessionId, + GroupingContext &groupingContext, + const vespalib::string &sessionId, const vespalib::string &sortSpec, size_t offset, size_t hits) : _attrContext(attrContext), @@ -48,11 +77,12 @@ ResultProcessor::ResultProcessor(search::attribute::IAttributeContext &attrConte _wasMerged(false) { if (!_groupingContext.empty()) { - _groupingSession.reset(new search::grouping::GroupingSession(sessionId, - _groupingContext, attrContext)); + _groupingSession.reset(new GroupingSession(sessionId, _groupingContext, attrContext)); } } +ResultProcessor::~ResultProcessor() { } + void ResultProcessor::prepareThreadContextCreation(size_t num_threads) { @@ -65,9 +95,9 @@ ResultProcessor::prepareThreadContextCreation(size_t num_threads) } ResultProcessor::Context::UP -ResultProcessor::createThreadContext(const vespalib::Doom & hardDoom, size_t thread_id) +ResultProcessor::createThreadContext(const vespalib::Doom & hardDoom, size_t thread_id, uint32_t distributionKey) { - Sort::UP sort(new Sort(hardDoom, _attrContext, _sortSpec)); + Sort::UP sort(new Sort(distributionKey, hardDoom, _attrContext, _sortSpec)); PartialResult::LP result(new PartialResult((_offset + _hits), sort->hasSortData())); if (thread_id == 0) { _result = result; @@ -113,8 +143,7 @@ ResultProcessor::makeReply() dst.gid = gid; } dst.metric = src._rankValue; - LOG(debug, "convertLidToGid: hit[%zu]: lid(%u) -> gid(%s)", - i, docId, dst.gid.toString().c_str()); + LOG(debug, "convertLidToGid: hit[%zu]: lid(%u) -> gid(%s)", i, docId, dst.gid.toString().c_str()); } if (result.hasSortData() && hitcnt > 0) { size_t sortDataSize = result.sortDataSize(); diff --git a/searchcore/src/vespa/searchcore/proton/matching/result_processor.h b/searchcore/src/vespa/searchcore/proton/matching/result_processor.h index c829db1f4b8..0ce87ceb7c6 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/result_processor.h +++ b/searchcore/src/vespa/searchcore/proton/matching/result_processor.h @@ -2,41 +2,45 @@ #pragma once -#include "partial_result.h" -#include "result_processor.h" -#include "sessionmanager.h" -#include <vespa/searchcore/grouping/groupingcontext.h> -#include <vespa/searchcore/grouping/groupingmanager.h> -#include <vespa/searchcore/grouping/groupingsession.h> -#include <vespa/searchlib/attribute/attributecontext.h> #include <vespa/searchlib/common/sortresults.h> -#include <vespa/searchlib/common/idocumentmetastore.h> -#include <vespa/searchlib/common/resultset.h> #include <vespa/vespalib/util/dual_merge_director.h> -#include <vespa/vespalib/util/noncopyable.hpp> namespace search { -namespace engine { - class SearchReply; -} + namespace engine { + class SearchReply; + } + namespace grouping { + class GroupingContext; + class GroupingSession; + } + class IDocumentMetaStore; } namespace proton { namespace matching { +class SessionManager; +class PartialResult; + class ResultProcessor { + using GroupingContext = search::grouping::GroupingContext; + using GroupingSession = search::grouping::GroupingSession; + using IAttributeContext = search::attribute::IAttributeContext; + using PartialResultLP = vespalib::LinkedPtr<PartialResult>; public: /** * Sorter selection and owner of additional data needed for * multi-level sorting. **/ - struct Sort : vespalib::noncopyable { + struct Sort { typedef std::unique_ptr<Sort> UP; FastS_IResultSorter *sorter; std::unique_ptr<search::common::ConverterFactory> _ucaFactory; FastS_SortSpec sortSpec; - Sort(const vespalib::Doom & doom, search::attribute::IAttributeContext &ac, const vespalib::string &ss); + Sort(const Sort &) = delete; + Sort & operator = (const Sort &) = delete; + Sort(uint32_t partitionId, const vespalib::Doom & doom, IAttributeContext &ac, const vespalib::string &ss); bool hasSortData() const { return (sorter == (const FastS_IResultSorter *) &sortSpec); } @@ -46,68 +50,62 @@ public: * Adapter to use grouping contexts as merging sources. **/ struct GroupingSource : vespalib::DualMergeDirector::Source { - search::grouping::GroupingContext *ctx; - GroupingSource(search::grouping::GroupingContext *g) : ctx(g) {} - virtual void merge(Source &s) { - GroupingSource &rhs = static_cast<GroupingSource&>(s); - assert((ctx == 0) == (rhs.ctx == 0)); - if (ctx != 0) { - search::grouping::GroupingManager man(*ctx); - man.merge(*rhs.ctx); - } - } + GroupingContext *ctx; + GroupingSource(GroupingContext *g) : ctx(g) {} + void merge(Source &s) override; }; /** * Context per thread used for result processing. **/ struct Context { - typedef std::unique_ptr<Context> UP; + using UP = std::unique_ptr<Context>; + using GroupingContextUP = std::unique_ptr<GroupingContext>; - Sort::UP sort; - PartialResult::LP result; - search::grouping::GroupingContext::UP grouping; - GroupingSource groupingSource; + Sort::UP sort; + PartialResultLP result; + GroupingContextUP grouping; + GroupingSource groupingSource; - Context(Sort::UP s, PartialResult::LP r, - search::grouping::GroupingContext::UP g) - : sort(std::move(s)), result(r), grouping(std::move(g)), - groupingSource(grouping.get()) {} + Context(Sort::UP s, PartialResultLP r, GroupingContextUP g); + ~Context(); }; struct Result { - typedef std::unique_ptr<Result> UP; - Result(std::unique_ptr<search::engine::SearchReply> reply, size_t numFs4Hits); + using UP = std::unique_ptr<Result>; + using SearchReply = search::engine::SearchReply; + Result(std::unique_ptr<SearchReply> reply, size_t numFs4Hits); ~Result(); - std::unique_ptr<search::engine::SearchReply> _reply; + std::unique_ptr<SearchReply> _reply; size_t _numFs4Hits; }; private: - search::attribute::IAttributeContext &_attrContext; + IAttributeContext &_attrContext; const search::IDocumentMetaStore &_metaStore; SessionManager &_sessionMgr; - search::grouping::GroupingContext &_groupingContext; - search::grouping::GroupingSession::UP _groupingSession; + GroupingContext &_groupingContext; + std::unique_ptr<GroupingSession> _groupingSession; const vespalib::string &_sortSpec; size_t _offset; size_t _hits; - PartialResult::LP _result; + PartialResultLP _result; bool _wasMerged; public: - ResultProcessor(search::attribute::IAttributeContext &attrContext, - const search::IDocumentMetaStore &metaStore, - SessionManager &sessionMgr, - search::grouping::GroupingContext &groupingContext, - const search::grouping::SessionId &sessionId, - const vespalib::string &sortSpec, + ResultProcessor(IAttributeContext &attrContext, + const search::IDocumentMetaStore & metaStore, + SessionManager & sessionMgr, + GroupingContext & groupingContext, + const vespalib::string & sessionId, + const vespalib::string & sortSpec, size_t offset, size_t hits); + ~ResultProcessor(); size_t countFS4Hits(); void prepareThreadContextCreation(size_t num_threads); - Context::UP createThreadContext(const vespalib::Doom & hardDoom, size_t thread_id); - Result::UP makeReply(); + Context::UP createThreadContext(const vespalib::Doom & hardDoom, size_t thread_id, uint32_t distributionKey); + std::unique_ptr<Result> makeReply(); }; } // namespace proton::matching diff --git a/searchcore/src/vespa/searchcore/proton/metrics/legacy_documentdb_metrics.cpp b/searchcore/src/vespa/searchcore/proton/metrics/legacy_documentdb_metrics.cpp index 23edd50006b..a82535c9e97 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/legacy_documentdb_metrics.cpp +++ b/searchcore/src/vespa/searchcore/proton/metrics/legacy_documentdb_metrics.cpp @@ -1,10 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.metrics.legacy_documentdb_metrics"); #include "legacy_documentdb_metrics.h" #include <vespa/vespalib/util/stringfmt.h> +#include <vespa/vespalib/util/exceptions.h> using vespalib::asciistream; using vespalib::make_string; @@ -19,23 +17,17 @@ LegacyDocumentDBMetrics::IndexMetrics::IndexMetrics(MetricSet *parent) memoryUsage("memoryusage", "", "Memory usage for memory indexes", this), docsInMemory("docsinmemory", "", "Number of documents in memory", this), diskUsage("diskusage", "", "Disk usage for disk indexes", this) -{ -} +{ } LegacyDocumentDBMetrics::DocstoreMetrics::DocstoreMetrics(MetricSet *parent) : MetricSet("docstore", "", "Document store metrics", parent), memoryUsage("memoryusage", "", "Memory usage for docstore", this), - cacheLookups("cachelookups", "", "Number of lookups in summary cache", - this), + cacheLookups("cachelookups", "", "Number of lookups in summary cache", this), hits(0), - cacheHitRate("cachehitrate", "", "Rate of cache hits in summary cache", - this), - cacheElements("cacheelements", "", "Number of elements in summary cache", - this), - cacheMemoryUsed("cachememoryused", "", "Memory used by summary cache", - this) -{ -} + cacheHitRate("cachehitrate", "", "Rate of cache hits in summary cache", this), + cacheElements("cacheelements", "", "Number of elements in summary cache", this), + cacheMemoryUsed("cachememoryused", "", "Memory used by summary cache", this) +{ } void LegacyDocumentDBMetrics::MatchingMetrics::update(const MatchingStats &stats) @@ -54,13 +46,11 @@ LegacyDocumentDBMetrics::MatchingMetrics::MatchingMetrics(MetricSet *parent) : MetricSet("matching", "", "Matching metrics", parent), docsMatched("docsmatched", "", "Number of documents matched", this), docsRanked("docsranked", "", "Number of documents ranked (first phase)", this), - docsReRanked("docsreranked", "", - "Number of documents re-ranked (second phase)", this), + docsReRanked("docsreranked", "", "Number of documents re-ranked (second phase)", this), queries("queries", "", "Number of queries executed", this), queryCollateralTime("querycollateraltime", "", "Average time spent setting up and tearing down queries", this), queryLatency("querylatency", "", "Average latency when matching a query", this) -{ -} +{ } LegacyDocumentDBMetrics::MatchingMetrics::RankProfileMetrics::RankProfileMetrics( const std::string &name, size_t numDocIdPartitions, MetricSet *parent) @@ -81,12 +71,10 @@ LegacyDocumentDBMetrics::MatchingMetrics::RankProfileMetrics::DocIdPartition::Do MetricSet(name, "", "DocId Partition profile metrics", parent), docsMatched("docsmatched", "", "Number of documents matched", this), docsRanked("docsranked", "", "Number of documents ranked (first phase)", this), - docsReRanked("docsreranked", "", - "Number of documents re-ranked (second phase)", this), + docsReRanked("docsreranked", "", "Number of documents re-ranked (second phase)", this), active_time("activetime", "", "Time spent doing actual work", this), wait_time("waittime", "", "Time spent waiting for other external threads and resources", this) -{ -} +{ } void LegacyDocumentDBMetrics::MatchingMetrics::RankProfileMetrics::DocIdPartition::update(const MatchingStats::Partition &stats) @@ -104,8 +92,7 @@ LegacyDocumentDBMetrics::MatchingMetrics::RankProfileMetrics::update(const Match queries.inc(stats.queries()); limited_queries.inc(stats.limited_queries()); matchTime.addValueBatch(stats.matchTimeAvg(), stats.matchTimeCount()); - groupingTime.addValueBatch(stats.groupingTimeAvg(), - stats.groupingTimeCount()); + groupingTime.addValueBatch(stats.groupingTimeAvg(), stats.groupingTimeCount()); rerankTime.addValueBatch(stats.rerankTimeAvg(), stats.rerankTimeCount()); if (stats.getNumPartitions() > 0) { if (stats.getNumPartitions() <= partitions.size()) { @@ -116,8 +103,7 @@ LegacyDocumentDBMetrics::MatchingMetrics::RankProfileMetrics::update(const Match } } else { vespalib::string msg(make_string("Num partitions used '%ld' is larger than number of partitions '%ld' configured.", - stats.getNumPartitions(), - partitions.size())); + stats.getNumPartitions(), partitions.size())); throw vespalib::IllegalStateException(msg, VESPA_STRLOC); } } @@ -138,13 +124,11 @@ DocumentMetaStoreMetrics(MetricSet *parent) { } -LegacyDocumentDBMetrics::SubDBMetrics::SubDBMetrics(const vespalib::string &name, - MetricSet *parent) +LegacyDocumentDBMetrics::SubDBMetrics::SubDBMetrics(const vespalib::string &name, MetricSet *parent) : MetricSet(name, "", "Sub database metrics", parent), attributes(this), docMetaStore(this) -{ -} +{ } LegacyDocumentDBMetrics::LegacyDocumentDBMetrics(const std::string &docTypeName, size_t maxNumThreads) : MetricSet(make_string("%s", docTypeName.c_str()), "", "Document DB Metrics", 0), @@ -159,20 +143,13 @@ LegacyDocumentDBMetrics::LegacyDocumentDBMetrics(const std::string &docTypeName, ready("ready", this), notReady("notready", this), removed("removed", this), - memoryUsage("memoryusage", "", "Memory usage for this Document DB", - this), - numDocs("numdocs", "", - "Number of ready/indexed documents in this Document DB (aka number of documents in the 'ready' sub db)", this), - numActiveDocs("numactivedocs", "", - "Number of active/searchable documents in this Document DB (aka number of active/searchable documents in the 'ready' sub db)", this), - numIndexedDocs("numindexeddocs", "", - "Number of ready/indexed documents in this Document DB (aka number of documents in the 'ready' sub db)", this), - numStoredDocs("numstoreddocs", "", - "Total number of documents stored in this Document DB (aka number of documents in the 'ready' and 'notready' sub dbs)", this), - numRemovedDocs("numremoveddocs", "", - "Number of removed documents in this Document DB (aka number of documents in the 'removed' sub db)", this), - numBadConfigs("numBadConfigs", "", - "Number of bad configs for this Document DB", this), + memoryUsage("memoryusage", "", "Memory usage for this Document DB", this), + numDocs("numdocs", "", "Number of ready/indexed documents in this Document DB (aka number of documents in the 'ready' sub db)", this), + numActiveDocs("numactivedocs", "", "Number of active/searchable documents in this Document DB (aka number of active/searchable documents in the 'ready' sub db)", this), + numIndexedDocs("numindexeddocs", "", "Number of ready/indexed documents in this Document DB (aka number of documents in the 'ready' sub db)", this), + numStoredDocs("numstoreddocs", "", "Total number of documents stored in this Document DB (aka number of documents in the 'ready' and 'notready' sub dbs)", this), + numRemovedDocs("numremoveddocs", "", "Number of removed documents in this Document DB (aka number of documents in the 'removed' sub db)", this), + numBadConfigs("numBadConfigs", "", "Number of bad configs for this Document DB", this), _maxNumThreads(maxNumThreads) { memoryUsage.addMetricToSum(index.memoryUsage); diff --git a/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.cpp b/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.cpp index c5581822e9d..be39398163f 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.cpp +++ b/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.cpp @@ -1,18 +1,19 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.server.metricsengine"); #include "metrics_engine.h" #include <vespa/metrics/jsonwriter.h> +#include <vespa/metrics/metricmanager.h> +#include <vespa/log/log.h> +LOG_SETUP(".proton.server.metricsengine"); namespace proton { MetricsEngine::MetricsEngine() : _root(), _legacyRoot(), - _manager(), - _metrics_producer(_manager) + _manager(std::make_unique<metrics::MetricManager>()), + _metrics_producer(*_manager) { } @@ -24,15 +25,15 @@ void MetricsEngine::start(const config::ConfigUri &) { { - metrics::MetricLockGuard guard(_manager.getMetricLock()); - _manager.registerMetric(guard, _root); - _manager.registerMetric(guard, _legacyRoot); + metrics::MetricLockGuard guard(_manager->getMetricLock()); + _manager->registerMetric(guard, _root); + _manager->registerMetric(guard, _legacyRoot); } // Storage doesnt snapshot unset metrics to save memory. Currently // feature seems a bit bugged. Disabling this optimalization for search. // Can enable it later when it is confirmed to be working well. - _manager.snapshotUnsetMetrics(true); + _manager->snapshotUnsetMetrics(true); // Currently, when injecting a metric manager into the content layer, // the content layer require to be the one initializing and starting it. @@ -41,28 +42,28 @@ MetricsEngine::start(const config::ConfigUri &) } void -MetricsEngine::addMetricsHook(metrics::MetricManager::UpdateHook &hook) +MetricsEngine::addMetricsHook(metrics::UpdateHook &hook) { - _manager.addMetricUpdateHook(hook, 5); + _manager->addMetricUpdateHook(hook, 5); } void -MetricsEngine::removeMetricsHook(metrics::MetricManager::UpdateHook &hook) +MetricsEngine::removeMetricsHook(metrics::UpdateHook &hook) { - _manager.removeMetricUpdateHook(hook); + _manager->removeMetricUpdateHook(hook); } void MetricsEngine::addExternalMetrics(metrics::Metric &child) { - metrics::MetricLockGuard guard(_manager.getMetricLock()); + metrics::MetricLockGuard guard(_manager->getMetricLock()); _legacyRoot.registerMetric(child); } void MetricsEngine::removeExternalMetrics(metrics::Metric &child) { - metrics::MetricLockGuard guard(_manager.getMetricLock()); + metrics::MetricLockGuard guard(_manager->getMetricLock()); _legacyRoot.unregisterMetric(child); } @@ -109,7 +110,7 @@ removeLegacyDocumentDBMetrics(LegacyProtonMetrics &legacyRoot, void MetricsEngine::addDocumentDBMetrics(DocumentDBMetricsCollection &child) { - metrics::MetricLockGuard guard(_manager.getMetricLock()); + metrics::MetricLockGuard guard(_manager->getMetricLock()); addLegacyDocumentDBMetrics(_legacyRoot, child.getMetrics()); _root.registerMetric(child.getTaggedMetrics()); @@ -118,7 +119,7 @@ MetricsEngine::addDocumentDBMetrics(DocumentDBMetricsCollection &child) void MetricsEngine::removeDocumentDBMetrics(DocumentDBMetricsCollection &child) { - metrics::MetricLockGuard guard(_manager.getMetricLock()); + metrics::MetricLockGuard guard(_manager->getMetricLock()); removeLegacyDocumentDBMetrics(_legacyRoot, child.getMetrics()); _root.unregisterMetric(child.getTaggedMetrics()); @@ -170,7 +171,7 @@ MetricsEngine::addAttribute(AttributeMetrics &subAttributes, AttributeMetrics *totalAttributes, const std::string &name) { - metrics::MetricLockGuard guard(_manager.getMetricLock()); + metrics::MetricLockGuard guard(_manager->getMetricLock()); doAddAttribute(subAttributes, name); if (totalAttributes != NULL) { doAddAttribute(*totalAttributes, name); @@ -182,7 +183,7 @@ MetricsEngine::removeAttribute(AttributeMetrics &subAttributes, AttributeMetrics *totalAttributes, const std::string &name) { - metrics::MetricLockGuard guard(_manager.getMetricLock()); + metrics::MetricLockGuard guard(_manager->getMetricLock()); doRemoveAttribute(subAttributes, name); if (totalAttributes != NULL) { doRemoveAttribute(*totalAttributes, name); @@ -193,7 +194,7 @@ void MetricsEngine::cleanAttributes(AttributeMetrics &subAttributes, AttributeMetrics *totalAttributes) { - metrics::MetricLockGuard guard(_manager.getMetricLock()); + metrics::MetricLockGuard guard(_manager->getMetricLock()); doCleanAttributes(subAttributes); if (totalAttributes != NULL) { doCleanAttributes(*totalAttributes); @@ -203,7 +204,7 @@ MetricsEngine::cleanAttributes(AttributeMetrics &subAttributes, void MetricsEngine::addRankProfile(LegacyDocumentDBMetrics &owner, const std::string &name, size_t numDocIdPartitions) { - metrics::MetricLockGuard guard(_manager.getMetricLock()); + metrics::MetricLockGuard guard(_manager->getMetricLock()); LegacyDocumentDBMetrics::MatchingMetrics::RankProfileMetrics::LP &entry = owner.matching.rank_profiles[name]; if (entry.get()) { @@ -216,7 +217,7 @@ void MetricsEngine::addRankProfile(LegacyDocumentDBMetrics &owner, } void MetricsEngine::cleanRankProfiles(LegacyDocumentDBMetrics &owner) { - metrics::MetricLockGuard guard(_manager.getMetricLock()); + metrics::MetricLockGuard guard(_manager->getMetricLock()); LegacyDocumentDBMetrics::MatchingMetrics::RankProfileMap metrics; owner.matching.rank_profiles.swap(metrics); for (LegacyDocumentDBMetrics::MatchingMetrics::RankProfileMap::const_iterator @@ -228,7 +229,7 @@ void MetricsEngine::cleanRankProfiles(LegacyDocumentDBMetrics &owner) { void MetricsEngine::stop() { - _manager.stop(); + _manager->stop(); } } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.h b/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.h index 7c8fa0627e8..d85f7e52f17 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.h +++ b/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.h @@ -12,15 +12,23 @@ #include <vespa/metrics/state_api_adapter.h> #include <vespa/vespalib/net/metrics_producer.h> +namespace metrics { + class Metricmanager; + class UpdateHook; +} + +namespace config { + class ConfigUri; +} namespace proton { class MetricsEngine : public MetricsWireService { private: - ContentProtonMetrics _root; - LegacyProtonMetrics _legacyRoot; - metrics::MetricManager _manager; - metrics::StateApiAdapter _metrics_producer; + ContentProtonMetrics _root; + LegacyProtonMetrics _legacyRoot; + std::unique_ptr<metrics::MetricManager> _manager; + metrics::StateApiAdapter _metrics_producer; public: typedef std::unique_ptr<MetricsEngine> UP; @@ -30,8 +38,8 @@ public: ContentProtonMetrics &root() { return _root; } LegacyProtonMetrics &legacyRoot() { return _legacyRoot; } void start(const config::ConfigUri & configUri); - void addMetricsHook(metrics::MetricManager::UpdateHook &hook); - void removeMetricsHook(metrics::MetricManager::UpdateHook &hook); + void addMetricsHook(metrics::UpdateHook &hook); + void removeMetricsHook(metrics::UpdateHook &hook); void addExternalMetrics(metrics::Metric &child); void removeExternalMetrics(metrics::Metric &child); void addDocumentDBMetrics(DocumentDBMetricsCollection &child); @@ -51,7 +59,7 @@ public: void stop(); vespalib::MetricsProducer &metrics_producer() { return _metrics_producer; } - metrics::MetricManager &getManager() { return _manager; } + metrics::MetricManager &getManager() { return *_manager; } }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.cpp b/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.cpp index fd02fbb126c..1f4a32bc4b5 100644 --- a/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.cpp +++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.cpp @@ -1,9 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.persistenceengine.persistenceengine"); - #include <vespa/documentapi/messagebus/messages/feedreply.h> #include <vespa/documentapi/messagebus/messages/removedocumentreply.h> #include <vespa/documentapi/messagebus/messages/updatedocumentreply.h> @@ -13,6 +10,9 @@ LOG_SETUP(".proton.persistenceengine.persistenceengine"); #include "transport_latch.h" #include <vespa/vespalib/util/exception.h> #include <vespa/vespalib/util/sequence.h> +#include <vespa/vespalib/stllike/hash_set.h> +#include <vespa/log/log.h> +LOG_SETUP(".proton.persistenceengine.persistenceengine"); using document::Document; using document::DocumentId; diff --git a/searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.cpp b/searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.cpp index 3d7473d779a..d1cb05292c1 100644 --- a/searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.cpp +++ b/searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.cpp @@ -1,15 +1,15 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.reprocessing.attribute_reprocessing_initializer"); - #include "attribute_reprocessing_initializer.h" #include <vespa/searchcore/proton/attribute/attribute_populator.h> #include <vespa/searchcore/proton/attribute/document_field_populator.h> #include <vespa/searchcore/proton/attribute/filter_attribute_manager.h> -using search::index::Schema; +#include <vespa/log/log.h> +LOG_SETUP(".proton.reprocessing.attribute_reprocessing_initializer"); + +using namespace search::index; using search::AttributeGuard; using search::AttributeVector; using search::SerialNum; @@ -28,9 +28,9 @@ toStr(bool value) return (value ? "true" : "false"); } -bool fastPartialUpdateAttribute(const Schema::DataType &attrType) { +bool fastPartialUpdateAttribute(const schema::DataType &attrType) { // Partial update to tensor or predicate attribute must update document - return ((attrType != Schema::BOOLEANTREE) && (attrType != Schema::TENSOR)); + return ((attrType != schema::BOOLEANTREE) && (attrType != schema::TENSOR)); } @@ -95,7 +95,7 @@ getFieldsToPopulate(const ARIConfig &newCfg, bool inNewSchema = newCfg.getInspector()->hasField(name); // NOTE: If it is a string and index field we shall // keep the original in order to preserve annotations. - bool isStringIndexField = attrField.getDataType() == Schema::STRING && + bool isStringIndexField = attrField.getDataType() == schema::STRING && newCfg.getSchema().isIndexField(name); bool populateField = !inNewAttrMgr && inNewSchema && !isStringIndexField && fastPartialUpdateAttribute(attrType); @@ -103,7 +103,7 @@ getFieldsToPopulate(const ARIConfig &newCfg, "isStringIndexField=%s, dataType=%s, populate=%s", name.c_str(), toStr(inNewAttrMgr), toStr(inNewSchema), toStr(isStringIndexField), - Schema::getTypeName(attrType).c_str(), + schema::getTypeName(attrType).c_str(), toStr(populateField)); if (populateField) { fieldsToPopulate.push_back(IReprocessingRewriter::SP diff --git a/searchcore/src/vespa/searchcore/proton/server/data_directory_upgrader.cpp b/searchcore/src/vespa/searchcore/proton/server/data_directory_upgrader.cpp index 626e8e664bd..5158deb23ce 100644 --- a/searchcore/src/vespa/searchcore/proton/server/data_directory_upgrader.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/data_directory_upgrader.cpp @@ -1,8 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.server.data_directory_upgrader"); #include "data_directory_upgrader.h" #include <vespa/vespalib/io/fileutil.h> diff --git a/searchcore/src/vespa/searchcore/proton/server/data_directory_upgrader.h b/searchcore/src/vespa/searchcore/proton/server/data_directory_upgrader.h index 97329c9b66e..f36cafdbdcf 100644 --- a/searchcore/src/vespa/searchcore/proton/server/data_directory_upgrader.h +++ b/searchcore/src/vespa/searchcore/proton/server/data_directory_upgrader.h @@ -3,6 +3,7 @@ #pragma once #include <vespa/vespalib/stllike/string.h> +#include <vector> namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/server/document_db_maintenance_config.h b/searchcore/src/vespa/searchcore/proton/server/document_db_maintenance_config.h index b7deb914a00..e1aa8417568 100644 --- a/searchcore/src/vespa/searchcore/proton/server/document_db_maintenance_config.h +++ b/searchcore/src/vespa/searchcore/proton/server/document_db_maintenance_config.h @@ -2,8 +2,8 @@ #pragma once #include <vespa/vespalib/stllike/string.h> -#include <vector> #include <vespa/searchcore/proton/attribute/attribute_usage_filter_config.h> +#include <vespa/fastos/timestamp.h> namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/server/document_subdb_initializer.cpp b/searchcore/src/vespa/searchcore/proton/server/document_subdb_initializer.cpp index 5f7e97cd5d5..2bd652b59c7 100644 --- a/searchcore/src/vespa/searchcore/proton/server/document_subdb_initializer.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/document_subdb_initializer.cpp @@ -1,24 +1,22 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "document_subdb_initializer.h" #include "idocumentsubdb.h" #include <future> #include <vespa/searchlib/common/lambdatask.h> +#include <vespa/searchcorespi/index/i_thread_service.h> using search::makeLambdaTask; namespace proton { -DocumentSubDbInitializer::DocumentSubDbInitializer(IDocumentSubDB &subDB, - searchcorespi::index::IThreadService &master) +DocumentSubDbInitializer::DocumentSubDbInitializer(IDocumentSubDB &subDB, searchcorespi::index::IThreadService &master) : InitTask(), _result(), _documentMetaStoreInitTask(), _subDB(subDB), _master(master) -{ -} +{ } void DocumentSubDbInitializer:: @@ -38,4 +36,4 @@ DocumentSubDbInitializer::run() (void) future.get(); } -} // namespace proton +} // namespace proton
\ No newline at end of file diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp index 8abf03ecb94..da691169001 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp @@ -13,7 +13,6 @@ #include "searchcontext.h" #include "summaryadapter.h" #include "tlcproxy.h" -#include <vespa/documentapi/messagebus/documentprotocol.h> #include <vespa/searchcore/proton/attribute/attribute_writer.h> #include <vespa/searchcore/proton/common/eventlogger.h> #include <vespa/searchcore/proton/common/schemautil.h> diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.h b/searchcore/src/vespa/searchcore/proton/server/documentdb.h index efc26510268..22643c9fba2 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.h @@ -37,6 +37,7 @@ #include <vespa/vespalib/util/varholder.h> #include <vespa/searchcore/proton/attribute/attribute_usage_filter.h> #include "disk_mem_usage_forwarder.h" +#include <vespa/metrics/updatehook.h> using vespa::config::search::core::ProtonConfig; @@ -72,12 +73,12 @@ class DocumentDB : public IDocumentDBConfigOwner, public search::transactionlog::SyncProxy { private: - class MetricsUpdateHook : public metrics::MetricManager::UpdateHook { + class MetricsUpdateHook : public metrics::UpdateHook { DocumentDBMetricsCollection _metrics; DocumentDB &_db; public: MetricsUpdateHook(DocumentDB &s, const std::string &doc_type, size_t maxNumThreads) - : metrics::MetricManager::UpdateHook("documentdb-hook"), + : metrics::UpdateHook("documentdb-hook"), _metrics(doc_type, maxNumThreads), _db(s) {} void updateMetrics(const MetricLockGuard & ) override { _db.updateMetrics(_metrics); } @@ -316,7 +317,7 @@ public: * * @return metrics update hook **/ - metrics::MetricManager::UpdateHook & getMetricsUpdateHook(void) { + metrics::UpdateHook & getMetricsUpdateHook(void) { return _metricsHook; } @@ -440,7 +441,7 @@ public: // Implements IDocSubDB::IOwner void syncFeedView() override; - searchcorespi::IIndexManagerFactory::SP + std::shared_ptr<searchcorespi::IIndexManagerFactory> getIndexManagerFactory(const vespalib::stringref & name) const override; vespalib::string getName() const override { return _docTypeName.getName(); } diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.cpp index 3fb0df44aa6..adc2ee8a438 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.cpp @@ -1,7 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "documentdbconfig.h" +#include <vespa/config-summary.h> +#include <vespa/config-summarymap.h> +#include <vespa/config-rank-profiles.h> +#include <vespa/config-attributes.h> +#include <vespa/config-indexschema.h> +#include <vespa/searchsummary/config/config-juniperrc.h> +#include <vespa/document/config/config-documenttypes.h> using namespace config; using namespace vespa::config::search::summary; @@ -29,8 +35,7 @@ DocumentDBConfig::ComparisonResult::ComparisonResult() _tuneFileDocumentDBChanged(false), _schemaChanged(false), _maintenanceChanged(false) -{ -} +{ } DocumentDBConfig::DocumentDBConfig( int64_t generation, @@ -66,8 +71,7 @@ DocumentDBConfig::DocumentDBConfig( _maintenance(maintenance), _extraConfigs(extraConfigs), _orig() -{ -} +{ } DocumentDBConfig:: @@ -89,8 +93,9 @@ DocumentDBConfig(const DocumentDBConfig &cfg) _maintenance(cfg._maintenance), _extraConfigs(cfg._extraConfigs), _orig(cfg._orig) -{ -} +{ } + +DocumentDBConfig::~DocumentDBConfig() { } bool DocumentDBConfig::operator==(const DocumentDBConfig & rhs) const diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.h b/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.h index 67b2a87b2f7..9515f2ec85a 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.h @@ -3,21 +3,31 @@ #pragma once #include "document_db_maintenance_config.h" -#include <vespa/document/config/config-documenttypes.h> #include <vespa/document/repo/documenttyperepo.h> #include <vespa/searchlib/common/tunefileinfo.h> -#include <vespa/searchsummary/config/config-juniperrc.h> #include <vespa/searchcommon/common/schema.h> #include <vespa/searchcore/config/config-ranking-constants.h> #include <vespa/searchcore/proton/matching/ranking_constants.h> -#include <vespa/config-attributes.h> -#include <vespa/config-indexschema.h> -#include <vespa/config-rank-profiles.h> -#include <vespa/config-summary.h> -#include <vespa/config-summarymap.h> #include <vespa/config/retriever/configkeyset.h> #include <vespa/config/retriever/configsnapshot.h> +namespace vespa { + namespace config { + namespace search { + namespace internal { + class InternalSummaryType; + class InternalSummarymapType; + class InternalRankProfilesType; + class InternalAttributesType; + class InternalIndexschemaType; + } + namespace summary { namespace internal { class InternalJuniperrcType; } } + } + } +} + +namespace document { namespace internal { class InternalDocumenttypesType; } } + namespace proton { class DocumentDBConfig @@ -43,14 +53,21 @@ public: }; using SP = std::shared_ptr<DocumentDBConfig>; - using IndexschemaConfigSP = std::shared_ptr<vespa::config::search::IndexschemaConfig>; - using AttributesConfigSP = std::shared_ptr<vespa::config::search::AttributesConfig>; - using RankProfilesConfigSP = std::shared_ptr<vespa::config::search::RankProfilesConfig>; + using IndexschemaConfig = const vespa::config::search::internal::InternalIndexschemaType; + using IndexschemaConfigSP = std::shared_ptr<IndexschemaConfig>; + using AttributesConfig = const vespa::config::search::internal::InternalAttributesType; + using AttributesConfigSP = std::shared_ptr<AttributesConfig>; + using RankProfilesConfig = const vespa::config::search::internal::InternalRankProfilesType; + using RankProfilesConfigSP = std::shared_ptr<RankProfilesConfig>; using RankingConstants = matching::RankingConstants; - using SummaryConfigSP = std::shared_ptr<vespa::config::search::SummaryConfig>; - using SummarymapConfigSP = std::shared_ptr<vespa::config::search::SummarymapConfig>; - using JuniperrcConfigSP = std::shared_ptr<vespa::config::search::summary::JuniperrcConfig>; - using DocumenttypesConfigSP = std::shared_ptr<document::DocumenttypesConfig>; + using SummaryConfig = const vespa::config::search::internal::InternalSummaryType; + using SummaryConfigSP = std::shared_ptr<SummaryConfig>; + using SummarymapConfig = const vespa::config::search::internal::InternalSummarymapType; + using SummarymapConfigSP = std::shared_ptr<SummarymapConfig>; + using JuniperrcConfig = const vespa::config::search::summary::internal::InternalJuniperrcType; + using JuniperrcConfigSP = std::shared_ptr<JuniperrcConfig>; + using DocumenttypesConfig = const document::internal::InternalDocumenttypesType; + using DocumenttypesConfigSP = std::shared_ptr<DocumenttypesConfig>; using MaintenanceConfigSP = DocumentDBMaintenanceConfig::SP; private: @@ -99,6 +116,7 @@ public: const config::ConfigSnapshot & extraConfig = config::ConfigSnapshot()); DocumentDBConfig(const DocumentDBConfig &cfg); + ~DocumentDBConfig(); const vespalib::string & getConfigId() const { return _configId; } void setConfigId(const vespalib::string &configId) { _configId = configId; } @@ -107,75 +125,33 @@ public: int64_t getGeneration(void) const { return _generation; } - const vespa::config::search::RankProfilesConfig & - getRankProfilesConfig() const { return *_rankProfiles; } - + const RankProfilesConfig &getRankProfilesConfig() const { return *_rankProfiles; } const RankingConstants &getRankingConstants() const { return *_rankingConstants; } - - const vespa::config::search::IndexschemaConfig & - getIndexschemaConfig() const { return *_indexschema; } - - const vespa::config::search::AttributesConfig & - getAttributesConfig() const { return *_attributes; } - - const vespa::config::search::SummaryConfig & - getSummaryConfig() const { return *_summary; } - - const vespa::config::search::SummarymapConfig & - getSummarymapConfig() const { return *_summarymap; } - - const vespa::config::search::summary::JuniperrcConfig & - getJuniperrcConfig() const { return *_juniperrc; } - - const document::DocumenttypesConfig & - getDocumenttypesConfig(void) const { return *_documenttypes; } - - const RankProfilesConfigSP & - getRankProfilesConfigSP(void) const { return _rankProfiles; } - + const IndexschemaConfig &getIndexschemaConfig() const { return *_indexschema; } + const AttributesConfig &getAttributesConfig() const { return *_attributes; } + const SummaryConfig &getSummaryConfig() const { return *_summary; } + const SummarymapConfig &getSummarymapConfig() const { return *_summarymap; } + const JuniperrcConfig &getJuniperrcConfig() const { return *_juniperrc; } + const DocumenttypesConfig &getDocumenttypesConfig() const { return *_documenttypes; } + const RankProfilesConfigSP &getRankProfilesConfigSP() const { return _rankProfiles; } const RankingConstants::SP &getRankingConstantsSP() const { return _rankingConstants; } - - const IndexschemaConfigSP & - getIndexschemaConfigSP(void) const { return _indexschema; } - - const AttributesConfigSP & - getAttributesConfigSP(void) const { return _attributes; } - - const SummaryConfigSP & - getSummaryConfigSP(void) const { return _summary; } - - const SummarymapConfigSP & - getSummarymapConfigSP(void) const { return _summarymap; } - - const JuniperrcConfigSP & - getJuniperrcConfigSP(void) const { return _juniperrc; } - - const DocumenttypesConfigSP & - getDocumenttypesConfigSP(void) const { return _documenttypes; } - - const document::DocumentTypeRepo::SP & - getDocumentTypeRepoSP() const { return _repo; } - - const document::DocumentType * - getDocumentType() const { return _repo->getDocumentType(getDocTypeName()); } - - const search::index::Schema::SP & - getSchemaSP(void) const { return _schema; } - - const MaintenanceConfigSP & - getMaintenanceConfigSP(void) const { return _maintenance; } - - const search::TuneFileDocumentDB::SP & - getTuneFileDocumentDBSP(void) const { return _tuneFileDocumentDB; } - - bool - operator==(const DocumentDBConfig &rhs) const; + const IndexschemaConfigSP &getIndexschemaConfigSP() const { return _indexschema; } + const AttributesConfigSP &getAttributesConfigSP() const { return _attributes; } + const SummaryConfigSP &getSummaryConfigSP() const { return _summary; } + const SummarymapConfigSP &getSummarymapConfigSP() const { return _summarymap; } + const JuniperrcConfigSP &getJuniperrcConfigSP() const { return _juniperrc; } + const DocumenttypesConfigSP &getDocumenttypesConfigSP() const { return _documenttypes; } + const document::DocumentTypeRepo::SP &getDocumentTypeRepoSP() const { return _repo; } + const document::DocumentType *getDocumentType() const { return _repo->getDocumentType(getDocTypeName()); } + const search::index::Schema::SP &getSchemaSP() const { return _schema; } + const MaintenanceConfigSP &getMaintenanceConfigSP() const { return _maintenance; } + const search::TuneFileDocumentDB::SP &getTuneFileDocumentDBSP() const { return _tuneFileDocumentDB; } + bool operator==(const DocumentDBConfig &rhs) const; /** * Compare this snapshot with the given one. */ - ComparisonResult - compare(const DocumentDBConfig &rhs) const; + ComparisonResult compare(const DocumentDBConfig &rhs) const; bool valid(void) const; diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp index 9a030555c50..2c9bc482e74 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp @@ -1,14 +1,17 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "documentdbconfigmanager.h" -#include <vespa/log/log.h> #include <vespa/searchcommon/common/schemaconfigurer.h> #include <vespa/searchlib/index/schemautil.h> -LOG_SETUP(".proton.server.documentdbconfigmanager"); #include <vespa/config/helper/legacy.h> #include <vespa/config/file_acquirer/file_acquirer.h> #include <vespa/vespalib/time/time_box.h> +#include <vespa/config-summarymap.h> +#include <vespa/config-rank-profiles.h> +#include <vespa/searchsummary/config/config-juniperrc.h> +#include <vespa/log/log.h> + +LOG_SETUP(".proton.server.documentdbconfigmanager"); using namespace config; using namespace vespa::config::search::core; @@ -283,7 +286,14 @@ DocumentDBConfigManager(const vespalib::string &configId, _ignoreForwardedConfig(true), _pendingConfigLock(), _extraConfigKeys() -{ +{ } + +DocumentDBConfigManager::~DocumentDBConfigManager() { } + +DocumentDBConfig::SP +DocumentDBConfigManager::getConfig() const { + vespalib::LockGuard lock(_pendingConfigLock); + return _pendingConfigSnapshot; } void diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.h b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.h index 525505fcfb0..58ba059de4a 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.h @@ -28,24 +28,21 @@ private: config::ConfigKeySet _extraConfigKeys; search::index::Schema::SP - buildNewSchema(const vespa::config::search::AttributesConfig & newAttributesConfig, - const vespa::config::search::SummaryConfig & newSummaryConfig, - const vespa::config::search::IndexschemaConfig & newIndexschemaConfig); + buildNewSchema(const DocumentDBConfig::AttributesConfig & newAttributesConfig, + const DocumentDBConfig::SummaryConfig & newSummaryConfig, + const DocumentDBConfig::IndexschemaConfig & newIndexschemaConfig); search::index::Schema::SP - buildSchema(const vespa::config::search::AttributesConfig & newAttributesConfig, - const vespa::config::search::SummaryConfig & newSummaryConfig, - const vespa::config::search::IndexschemaConfig & newIndexschemaConfig); + buildSchema(const DocumentDBConfig::AttributesConfig & newAttributesConfig, + const DocumentDBConfig::SummaryConfig & newSummaryConfig, + const DocumentDBConfig::IndexschemaConfig & newIndexschemaConfig); public: DocumentDBConfigManager(const vespalib::string &configId, const vespalib::string &docTypeName); + ~DocumentDBConfigManager(); void update(const config::ConfigSnapshot & snapshot); - DocumentDBConfig::SP - getConfig() const { - vespalib::LockGuard lock(_pendingConfigLock); - return _pendingConfigSnapshot; - } + DocumentDBConfig::SP getConfig() const; void forwardConfig(const BootstrapConfig::SP & config); const config::ConfigKeySet createConfigKeySet(void) const; diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h index 4e3e32c2c4c..7c8386c40bf 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h @@ -36,7 +36,7 @@ private: const uint32_t _readySubDbId; const uint32_t _remSubDbId; const uint32_t _notReadySubDbId; - typedef std::shared_ptr<std::vector<IDocumentRetriever::SP> > RetrieversSP; + typedef std::shared_ptr<std::vector<std::shared_ptr<IDocumentRetriever>> > RetrieversSP; vespalib::VarHolder<RetrieversSP> _retrievers; typedef std::vector<std::shared_ptr<IReprocessingTask>> ReprocessingTasks; ReprocessingRunner _reprocessingRunner; @@ -71,7 +71,7 @@ public: void maintenanceSync(MaintenanceController &mc, ICommitable &commit); // Internally synchronized - std::shared_ptr<std::vector<IDocumentRetriever::SP> > getRetrievers() { + RetrieversSP getRetrievers() { return _retrievers.get(); } diff --git a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp index 2713c571dbf..24c000e5d4a 100644 --- a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp @@ -1,13 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.server.fast_access_doc_subdb"); - #include "attributeadapterfactory.h" #include "emptysearchview.h" #include "fast_access_doc_subdb.h" #include "fast_access_document_retriever.h" +#include "document_subdb_initializer.h" #include <vespa/searchcore/proton/attribute/attribute_collection_spec_factory.h> #include <vespa/searchcore/proton/attribute/attribute_factory.h> #include <vespa/searchcore/proton/attribute/attribute_manager_initializer.h> @@ -20,6 +17,8 @@ LOG_SETUP(".proton.server.fast_access_doc_subdb"); #include <vespa/searchcore/proton/reprocessing/document_reprocessing_handler.h> #include <vespa/searchcore/proton/reprocessing/reprocess_documents_task.h> #include <vespa/searchlib/docstore/document_store_visitor_progress.h> +#include <vespa/log/log.h> +LOG_SETUP(".proton.server.fast_access_doc_subdb"); using proton::matching::SessionManager; using search::AttributeGuard; @@ -40,12 +39,9 @@ struct AttributeGuardComp AttributeGuardComp(const vespalib::string &n) : name(n) - { - } + { } - bool - operator()(const AttributeGuard &rhs) const - { + bool operator()(const AttributeGuard &rhs) const { return name == rhs->getName(); }; }; @@ -193,8 +189,7 @@ FastAccessDocSubDB::createReprocessingTask(IReprocessingInitializer &initializer docIdLimit)); } -FastAccessDocSubDB::FastAccessDocSubDB(const Config &cfg, - const Context &ctx) +FastAccessDocSubDB::FastAccessDocSubDB(const Config &cfg, const Context &ctx) : Parent(cfg._storeOnlyCfg, ctx._storeOnlyCtx), _hasAttributes(cfg._hasAttributes), _fastAccessAttributesOnly(cfg._fastAccessAttributesOnly), @@ -205,8 +200,9 @@ FastAccessDocSubDB::FastAccessDocSubDB(const Config &cfg, _addMetrics(cfg._addMetrics), _metricsWireService(ctx._metricsWireService), _docIdLimit(0) -{ -} +{ } + +FastAccessDocSubDB::~FastAccessDocSubDB() { } DocumentSubDbInitializer::UP FastAccessDocSubDB::createInitializer(const DocumentDBConfig &configSnapshot, diff --git a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.h b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.h index bb0b2a9ed5b..040569a70a0 100644 --- a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.h @@ -38,8 +38,7 @@ public: _hasAttributes(hasAttributes), _addMetrics(addMetrics), _fastAccessAttributesOnly(fastAccessAttributesOnly) - { - } + { } }; struct Context @@ -56,8 +55,7 @@ public: _subAttributeMetrics(subAttributeMetrics), _totalAttributeMetrics(totalAttributeMetrics), _metricsWireService(metricsWireService) - { - } + { } }; private: @@ -71,80 +69,60 @@ private: AttributeMetrics &_subAttributeMetrics; AttributeMetrics *_totalAttributeMetrics; - initializer::InitializerTask::SP + std::shared_ptr<initializer::InitializerTask> createAttributeManagerInitializer(const DocumentDBConfig &configSnapshot, SerialNum configSerialNum, - initializer::InitializerTask::SP documentMetaStoreInitTask, + std::shared_ptr<initializer::InitializerTask> documentMetaStoreInitTask, DocumentMetaStore::SP documentMetaStore, std::shared_ptr<AttributeManager::SP> attrMgrResult) const; void setupAttributeManager(AttributeManager::SP attrMgrResult); - - void initFeedView(const IAttributeWriter::SP &writer, - const DocumentDBConfig &configSnapshot); - + void initFeedView(const IAttributeWriter::SP &writer, const DocumentDBConfig &configSnapshot); protected: typedef StoreOnlyDocSubDB Parent; - typedef vespa::config::search::core::ProtonConfig ProtonConfig; const bool _addMetrics; MetricsWireService &_metricsWireService; DocIdLimit _docIdLimit; - AttributeCollectionSpec::UP createAttributeSpec(const AttributesConfig &attrCfg, - SerialNum serialNum) const; - + AttributeCollectionSpec::UP createAttributeSpec(const AttributesConfig &attrCfg, SerialNum serialNum) const; AttributeManager::SP getAndResetInitAttributeManager(); - virtual IFlushTarget::List getFlushTargetsInternal(); - - void reconfigureAttributeMetrics(const proton::IAttributeManager &newMgr, - const proton::IAttributeManager &oldMgr); + void reconfigureAttributeMetrics(const IAttributeManager &newMgr, const IAttributeManager &oldMgr); IReprocessingTask::UP createReprocessingTask(IReprocessingInitializer &initializer, const document::DocumentTypeRepo::SP &docTypeRepo) const; public: - FastAccessDocSubDB(const Config &cfg, - const Context &ctx); + FastAccessDocSubDB(const Config &cfg, const Context &ctx); - virtual ~FastAccessDocSubDB() {} + ~FastAccessDocSubDB(); - virtual DocumentSubDbInitializer::UP + virtual std::unique_ptr<DocumentSubDbInitializer> createInitializer(const DocumentDBConfig &configSnapshot, SerialNum configSerialNum, - const search::index::Schema::SP &unionSchema, - const vespa::config::search::core::ProtonConfig::Summary &protonSummaryCfg, - const vespa::config::search::core::ProtonConfig::Index &indexCfg) const override; - - virtual void setup(const DocumentSubDbInitializerResult &initResult) override; - - virtual void initViews(const DocumentDBConfig &configSnapshot, - const proton::matching::SessionManager::SP &sessionManager); - - virtual IReprocessingTask::List applyConfig(const DocumentDBConfig &newConfigSnapshot, - const DocumentDBConfig &oldConfigSnapshot, - SerialNum serialNum, - const ReconfigParams params); - - virtual proton::IAttributeManager::SP getAttributeManager() const; - - virtual IDocumentRetriever::UP getDocumentRetriever(); - - virtual void - onReplayDone(); - - virtual void - onReprocessDone(SerialNum serialNum); - - virtual SerialNum - getOldestFlushedSerial(); - - virtual SerialNum - getNewestFlushedSerial(); + const Schema::SP &unionSchema, + const ProtonConfig::Summary &protonSummaryCfg, + const ProtonConfig::Index &indexCfg) const override; + + void setup(const DocumentSubDbInitializerResult &initResult) override; + + void initViews(const DocumentDBConfig &configSnapshot, + const matching::SessionManager::SP &sessionManager) override; + + IReprocessingTask::List applyConfig(const DocumentDBConfig &newConfigSnapshot, + const DocumentDBConfig &oldConfigSnapshot, + SerialNum serialNum, + const ReconfigParams params) override; + + proton::IAttributeManager::SP getAttributeManager() const override; + IDocumentRetriever::UP getDocumentRetriever() override; + void onReplayDone() override; + void onReprocessDone(SerialNum serialNum) override; + SerialNum getOldestFlushedSerial() override; + SerialNum getNewestFlushedSerial() override; }; -} // namespace proton - +} // namespace proton
\ No newline at end of file diff --git a/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp b/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp index 5c9c4982f95..c485e1a1308 100644 --- a/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp @@ -1,12 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.server.feedhandler"); #include "feedhandler.h" #include "feedstates.h" #include "replaypacketdispatcher.h" #include "tlcproxy.h" +#include "ddbstate.h" #include <vespa/documentapi/messagebus/documentprotocol.h> #include <vespa/documentapi/messagebus/messages/documentreply.h> #include <vespa/documentapi/messagebus/messages/feedreply.h> @@ -19,7 +17,9 @@ LOG_SETUP(".proton.server.feedhandler"); #include <vespa/searchcore/proton/bucketdb/ibucketdbhandler.h> #include <vespa/vespalib/util/closuretask.h> #include <vespa/searchcore/proton/persistenceengine/i_resource_write_filter.h> -#include "ddbstate.h" +#include <vespa/vespalib/util/exceptions.h> +#include <vespa/log/log.h> +LOG_SETUP(".proton.server.feedhandler"); using document::BucketId; using document::Document; diff --git a/searchcore/src/vespa/searchcore/proton/server/feedstate.cpp b/searchcore/src/vespa/searchcore/proton/server/feedstate.cpp index 6cd4df5c571..1c1988ee760 100644 --- a/searchcore/src/vespa/searchcore/proton/server/feedstate.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/feedstate.cpp @@ -1,9 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/document/bucket/bucketid.h> + #include "feedstate.h" -#include <vespa/log/log.h> -LOG_SETUP(".feedstate"); +#include <vespa/vespalib/util/exceptions.h> using document::BucketId; using vespalib::IllegalStateException; diff --git a/searchcore/src/vespa/searchcore/proton/server/feedstates.cpp b/searchcore/src/vespa/searchcore/proton/server/feedstates.cpp index 6ded3dd7879..1da46a63995 100644 --- a/searchcore/src/vespa/searchcore/proton/server/feedstates.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/feedstates.cpp @@ -1,5 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "feedstates.h" #include "feedconfigstore.h" #include "ireplaypackethandler.h" @@ -7,6 +6,7 @@ #include <vespa/searchcore/proton/common/eventlogger.h> #include <vespa/vespalib/util/closuretask.h> #include <vespa/searchcore/proton/bucketdb/ibucketdbhandler.h> +#include <vespa/vespalib/util/exceptions.h> #include <vespa/log/log.h> LOG_SETUP(".proton.server.feedstates"); diff --git a/searchcore/src/vespa/searchcore/proton/server/feedstates.h b/searchcore/src/vespa/searchcore/proton/server/feedstates.h index 1bc88627377..53a7bdd0ee6 100644 --- a/searchcore/src/vespa/searchcore/proton/server/feedstates.h +++ b/searchcore/src/vespa/searchcore/proton/server/feedstates.h @@ -5,7 +5,6 @@ #include <vespa/searchcore/proton/server/feedhandler.h> #include <vespa/searchcore/proton/server/feedstate.h> #include <vespa/searchcore/proton/server/ireplaypackethandler.h> -#include <vespa/documentapi/messagebus/documentprotocol.h> namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp index 4813519c3fe..3e0619cee48 100644 --- a/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp @@ -1,18 +1,17 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "fileconfigmanager.h" #include <vespa/config/print/fileconfigwriter.h> #include <vespa/config/print/fileconfigsnapshotreader.h> #include <vespa/config/print/fileconfigsnapshotwriter.h> -#include <vespa/config/print/configformatter.h> -#include <vespa/document/repo/documenttyperepo.h> -#include <vespa/log/log.h> #include <vespa/searchcommon/common/schemaconfigurer.h> #include <vespa/searchlib/index/schemautil.h> #include <vespa/vespalib/io/fileutil.h> -#include <utime.h> +#include <vespa/config-summarymap.h> +#include <vespa/config-rank-profiles.h> +#include <vespa/searchsummary/config/config-juniperrc.h> #include <fstream> +#include <vespa/log/log.h> LOG_SETUP(".proton.server.fileconfigmanager"); using document::DocumentTypeRepo; diff --git a/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h b/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h index da49aa2a725..5838a66040e 100644 --- a/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h @@ -1,41 +1,45 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include "document_subdb_initializer.h" -#include "ifeedview.h" -#include "searchable_doc_subdb_configurer.h" #include <vespa/searchcore/config/config-proton.h> -#include <vespa/searchcore/proton/attribute/i_attribute_manager.h> -#include <vespa/searchcore/proton/docsummary/isummarymanager.h> -#include <vespa/searchcore/proton/docsummary/summarymanager.h> #include <vespa/searchcore/proton/documentmetastore/i_document_meta_store.h> -#include <vespa/searchcore/proton/index/i_index_writer.h> -#include <vespa/searchcore/proton/matchengine/imatchhandler.h> #include <vespa/searchcore/proton/matching/matching_stats.h> -#include <vespa/searchcore/proton/matching/sessionmanager.h> -#include <vespa/searchcore/proton/persistenceengine/i_document_retriever.h> #include <vespa/searchcore/proton/reprocessing/i_reprocessing_task.h> -#include <vespa/searchcore/proton/summaryengine/isearchhandler.h> #include <vespa/searchcorespi/flush/iflushtarget.h> -#include <vespa/searchcorespi/index/iindexmanager.h> -#include <vespa/searchcorespi/plugin/iindexmanagerfactory.h> #include <vespa/searchlib/common/serialnum.h> #include <vespa/searchlib/util/searchable_stats.h> -namespace document -{ - -class DocumentId; +namespace search { + namespace index { + class Schema; + } } +namespace document { class DocumentId; } -namespace proton -{ +namespace searchcorespi { + class IIndexManagerFactory; + class IIndexManager; +} +namespace proton { + namespace matching { class SessionManager; } class FeedHandler; class DocumentDBConfig; class FileConfigManager; class IReplayConfig; +class IIndexWriter; +class IDcoumentRetriever; +class DocumentSubDbInitializer; +class DocumentSubDbInitializerResult; +class ReconfigParams; +class IFeedView; +class ISearchHandler; +class ISummaryManager; +class ISummaryAdapter; +class IDocumentMetaStoreContext; +class IDocumentRetriever; +class IAttributeManager; /** * Interface for a document sub database that handles a subset of the documents that belong to a @@ -53,128 +57,73 @@ public: public: virtual ~IOwner() {} virtual void syncFeedView() = 0; - virtual searchcorespi::IIndexManagerFactory::SP + virtual std::shared_ptr<searchcorespi::IIndexManagerFactory> getIndexManagerFactory(const vespalib::stringref &name) const = 0; virtual vespalib::string getName() const = 0; virtual uint32_t getDistributionKey() const = 0; }; - typedef std::unique_ptr<IDocumentSubDB> UP; - typedef search::SerialNum SerialNum; - + using UP = std::unique_ptr<IDocumentSubDB>; + using SerialNum = search::SerialNum; + using Schema = search::index::Schema; + using SchemaSP = std::shared_ptr<Schema>; + using ProtonConfig = vespa::config::search::core::ProtonConfig; + using IFlushTarget = searchcorespi::IFlushTarget; public: IDocumentSubDB() { } - virtual ~IDocumentSubDB() { } - virtual uint32_t getSubDbId() const = 0; - virtual vespalib::string getName() const = 0; - virtual DocumentSubDbInitializer::UP - createInitializer(const DocumentDBConfig &configSnapshot, - SerialNum configSerialNum, - const search::index::Schema::SP &unionSchema, - const vespa::config::search::core:: - ProtonConfig::Summary &protonSummaryCfg, - const vespa::config::search::core:: - ProtonConfig::Index &indexCfg) const = 0; + virtual std::unique_ptr<DocumentSubDbInitializer> + createInitializer(const DocumentDBConfig &configSnapshot, SerialNum configSerialNum, const SchemaSP &unionSchema, + const ProtonConfig::Summary &protonSummaryCfg, const ProtonConfig::Index &indexCfg) const = 0; // Called by master thread virtual void setup(const DocumentSubDbInitializerResult &initResult) = 0; - - virtual void - initViews(const DocumentDBConfig &configSnapshot, - const proton::matching::SessionManager::SP &sessionManager) = 0; + virtual void initViews(const DocumentDBConfig &configSnapshot, const std::shared_ptr<matching::SessionManager> &sessionManager) = 0; virtual IReprocessingTask::List - applyConfig(const DocumentDBConfig &newConfigSnapshot, - const DocumentDBConfig &oldConfigSnapshot, - SerialNum serialNum, - const ReconfigParams params) = 0; - - virtual ISearchHandler::SP - getSearchView(void) const = 0; - - virtual IFeedView::SP - getFeedView(void) const = 0; - - virtual void - clearViews(void) = 0; - - virtual const ISummaryManager::SP & - getSummaryManager() const = 0; - - virtual proton::IAttributeManager::SP - getAttributeManager(void) const = 0; - - virtual const IIndexManager::SP & - getIndexManager(void) const = 0; - - virtual const ISummaryAdapter::SP & - getSummaryAdapter(void) const = 0; - - virtual const IIndexWriter::SP & - getIndexWriter(void) const = 0; - - virtual IDocumentMetaStoreContext & - getDocumentMetaStoreContext() = 0; - - virtual IFlushTarget::List - getFlushTargets(void) = 0; - - virtual size_t - getNumDocs(void) const = 0; - - virtual size_t - getNumActiveDocs(void) const = 0; - + applyConfig(const DocumentDBConfig &newConfigSnapshot, const DocumentDBConfig &oldConfigSnapshot, + SerialNum serialNum, const ReconfigParams params) = 0; + + virtual std::shared_ptr<ISearchHandler> getSearchView() const = 0; + virtual std::shared_ptr<IFeedView> getFeedView() const = 0; + virtual void clearViews() = 0; + virtual const std::shared_ptr<ISummaryManager> &getSummaryManager() const = 0; + virtual std::shared_ptr<IAttributeManager> getAttributeManager() const = 0; + virtual const std::shared_ptr<searchcorespi::IIndexManager> &getIndexManager() const = 0; + virtual const std::shared_ptr<ISummaryAdapter> &getSummaryAdapter() const = 0; + virtual const std::shared_ptr<IIndexWriter> &getIndexWriter() const = 0; + virtual IDocumentMetaStoreContext &getDocumentMetaStoreContext() = 0; + virtual IFlushTarget::List getFlushTargets() = 0; + virtual size_t getNumDocs() const = 0; + virtual size_t getNumActiveDocs() const = 0; /** * Needed by FeedRouter::handleRemove(). * TODO: remove together with FeedEngine. **/ - virtual bool - hasDocument(const document::DocumentId &id) = 0; - - virtual void - onReplayDone(void) = 0; - - virtual void - onReprocessDone(SerialNum serialNum) = 0; + virtual bool hasDocument(const document::DocumentId &id) = 0; + virtual void onReplayDone() = 0; + virtual void onReprocessDone(SerialNum serialNum) = 0; /* * Get oldest flushed serial for components. */ - virtual SerialNum - getOldestFlushedSerial(void) = 0; + virtual SerialNum getOldestFlushedSerial() = 0; /* * Get newest flushed serial. Used to validate that we've not lost * last part of transaction log. */ - virtual SerialNum - getNewestFlushedSerial() = 0; - - virtual void - wipeHistory(SerialNum wipeSerial, - const search::index::Schema &newHistorySchema, - const search::index::Schema &wipeSchema) = 0; - - virtual void - setIndexSchema(const search::index::Schema::SP &schema, - const search::index::Schema::SP &fusionSchema) = 0; - - virtual search::SearchableStats - getSearchableStats(void) const = 0; - - virtual IDocumentRetriever::UP - getDocumentRetriever(void) = 0; - - virtual matching::MatchingStats - getMatcherStats(const vespalib::string &rankProfile) const = 0; + virtual SerialNum getNewestFlushedSerial() = 0; + virtual void wipeHistory(SerialNum wipeSerial, const Schema &newHistorySchema, const Schema &wipeSchema) = 0; + virtual void setIndexSchema(const SchemaSP &schema, const SchemaSP &fusionSchema) = 0; + virtual search::SearchableStats getSearchableStats() const = 0; + virtual std::unique_ptr<IDocumentRetriever> getDocumentRetriever() = 0; + virtual matching::MatchingStats getMatcherStats(const vespalib::string &rankProfile) const = 0; virtual void close() = 0; }; -} // namespace proton - +} // namespace proton
\ No newline at end of file diff --git a/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_handler.cpp b/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_handler.cpp index 09cd3770919..44e3bdcee29 100644 --- a/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_handler.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_handler.cpp @@ -1,11 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.server.lid_space_compaction_handler"); - #include "lid_space_compaction_handler.h" #include "document_scan_iterator.h" +#include "ifeedview.h" +#include <vespa/searchcore/proton/docsummary/isummarymanager.h> +#include <vespa/searchcore/proton/documentmetastore/i_document_meta_store_context.h> using document::BucketId; using document::Document; @@ -40,8 +39,7 @@ LidSpaceCompactionHandler::createMoveOperation(const search::DocumentMetaData &d IFeedView::SP feedView = _subDb.getFeedView(); const ISummaryManager::SP &summaryMan = _subDb.getSummaryManager(); const uint32_t moveFromLid = document.lid; - Document::UP doc = summaryMan->getBackingStore().read(moveFromLid, - *feedView->getDocumentTypeRepo()); + Document::UP doc = summaryMan->getBackingStore().read(moveFromLid, *feedView->getDocumentTypeRepo()); MoveOperation::UP op(new MoveOperation(document.bucketId, document.timestamp, Document::SP(doc.release()), DbDocumentId(_subDb.getSubDbId(), moveFromLid), diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.cpp b/searchcore/src/vespa/searchcore/proton/server/proton.cpp index 204b520e6ca..17d83cc8324 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp @@ -1,7 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.server.proton"); #include "data_directory_upgrader.h" #include "disk_mem_usage_sampler.h" @@ -36,6 +33,9 @@ LOG_SETUP(".proton.server.proton"); #include <vespa/vespalib/util/random.h> #include <vespa/searchcore/proton/common/hw_info.h> #include <vespa/searchcore/proton/common/hw_info_sampler.h> +#include <vespa/document/base/exceptions.h> +#include <vespa/log/log.h> +LOG_SETUP(".proton.server.proton"); using document::DocumentTypeRepo; using vespalib::FileHeader; @@ -958,7 +958,7 @@ int countOpenFiles() } // namespace <unnamed> void -Proton::updateMetrics(const metrics::MetricLockGuard &) +Proton::updateMetrics(const vespalib::MonitorGuard &) { { ContentProtonMetrics &metrics = _metricsEngine->root(); diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.h b/searchcore/src/vespa/searchcore/proton/server/proton.h index 7bf51b4a0d1..64abb5cdd26 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton.h +++ b/searchcore/src/vespa/searchcore/proton/server/proton.h @@ -61,13 +61,13 @@ private: typedef std::map<vespalib::string, DynamicLibrarySP> LibraryMap; using InitializeThreads = std::shared_ptr<vespalib::ThreadStackExecutorBase>; - struct MetricsUpdateHook : metrics::MetricManager::UpdateHook + struct MetricsUpdateHook : metrics::UpdateHook { Proton &self; MetricsUpdateHook(Proton &s) - : metrics::MetricManager::UpdateHook("proton-hook"), + : metrics::UpdateHook("proton-hook"), self(s) {} - void updateMetrics(const MetricLockGuard &guard) override { self.updateMetrics(guard); } + void updateMetrics(const vespalib::MonitorGuard &guard) override { self.updateMetrics(guard); } }; friend struct MetricsUpdateHook; @@ -166,7 +166,7 @@ private: * the metric manager). Do not call this function in multiple * threads at once. **/ - void updateMetrics(const metrics::MetricLockGuard &guard); + void updateMetrics(const vespalib::MonitorGuard &guard); void waitForInitDone(); void waitForOnlineState(); diff --git a/searchcore/src/vespa/searchcore/proton/server/replaypacketdispatcher.cpp b/searchcore/src/vespa/searchcore/proton/server/replaypacketdispatcher.cpp index 394292f86e6..e4db294eb3c 100644 --- a/searchcore/src/vespa/searchcore/proton/server/replaypacketdispatcher.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/replaypacketdispatcher.cpp @@ -1,10 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.server.replaypacketdispatcher"); #include "replaypacketdispatcher.h" #include <vespa/vespalib/util/stringfmt.h> +#include <vespa/vespalib/util/exceptions.h> +#include <vespa/document/util/serializableexceptions.h> using vespalib::make_string; using vespalib::IllegalStateException; diff --git a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h index d0332a2b391..c481c05b421 100644 --- a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h +++ b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h @@ -18,7 +18,7 @@ namespace proton { class Proton; class DocsumByRPC; -class RPCHooksBase : public FRT_Invokable, public vespalib::noncopyable +class RPCHooksBase : public FRT_Invokable { private: class Session { @@ -101,6 +101,8 @@ public: my_oos_name.append("/feed-destination"); } }; + RPCHooksBase(const RPCHooksBase &) = delete; + RPCHooksBase & operator = (const RPCHooksBase &) = delete; RPCHooksBase(Params ¶ms); virtual ~RPCHooksBase(); void close(); diff --git a/searchcore/src/vespa/searchcore/proton/server/schema_config_validator.cpp b/searchcore/src/vespa/searchcore/proton/server/schema_config_validator.cpp index e0bb45e63c4..f970161bfdb 100644 --- a/searchcore/src/vespa/searchcore/proton/server/schema_config_validator.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/schema_config_validator.cpp @@ -1,12 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.server.schema_config_validator"); #include "schema_config_validator.h" #include <vespa/vespalib/util/stringfmt.h> +#include <vespa/log/log.h> +LOG_SETUP(".proton.server.schema_config_validator"); -using search::index::Schema; +using namespace search::index; using vespalib::make_string; namespace proton { @@ -189,8 +189,8 @@ checkDataTypeFunc(const Schema::Field &oldField, make_string("Trying to add %s field `%s' of data type %s, " "but it has been of of data type %s earlier", fieldClass.c_str(), newField.getName().c_str(), - Schema::getTypeName(newField.getDataType()).c_str(), - Schema::getTypeName(oldField.getDataType()).c_str())); + schema::getTypeName(newField.getDataType()).c_str(), + schema::getTypeName(oldField.getDataType()).c_str())); } return CV::Result(); } @@ -205,8 +205,8 @@ checkCollectionTypeFunc(const Schema::Field &oldField, make_string("Trying to add %s field `%s' of collection type %s, " "but it has been of of collection type %s earlier", fieldClass.c_str(), newField.getName().c_str(), - Schema::getTypeName(newField.getCollectionType()).c_str(), - Schema::getTypeName(oldField.getCollectionType()).c_str())); + schema::getTypeName(newField.getCollectionType()).c_str(), + schema::getTypeName(oldField.getCollectionType()).c_str())); } return CV::Result(); } diff --git a/searchcore/src/vespa/searchcore/proton/server/searchable_feed_view.cpp b/searchcore/src/vespa/searchcore/proton/server/searchable_feed_view.cpp index 75ab2181db6..16554a5c439 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchable_feed_view.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/searchable_feed_view.cpp @@ -1,14 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.server.searchable_feed_view"); #include "searchable_feed_view.h" #include "ireplayconfig.h" -#include <vespa/documentapi/messagebus/documentprotocol.h> -#include <vespa/documentapi/messagebus/messages/documentreply.h> -#include <vespa/documentapi/messagebus/messages/removedocumentreply.h> -#include <vespa/documentapi/messagebus/messages/updatedocumentreply.h> +#include "forcecommitcontext.h" +#include "operationdonecontext.h" +#include "removedonecontext.h" #include <vespa/searchcore/proton/common/bucketfactory.h> #include <vespa/searchcore/proton/metrics/feed_metrics.h> #include <vespa/searchcore/proton/matching/match_context.h> @@ -17,20 +13,15 @@ LOG_SETUP(".proton.server.searchable_feed_view"); #include <vespa/vespalib/text/stringtokenizer.h> #include <vespa/vespalib/util/closuretask.h> #include <vespa/searchlib/common/lambdatask.h> -#include "forcecommitcontext.h" -#include "operationdonecontext.h" -#include "removedonecontext.h" +#include <vespa/vespalib/util/exceptions.h> +#include <vespa/log/log.h> +LOG_SETUP(".proton.server.searchable_feed_view"); using document::BucketId; using document::Document; using document::DocumentId; using document::DocumentTypeRepo; using document::DocumentUpdate; -using documentapi::DocumentProtocol; -using documentapi::DocumentReply; -using documentapi::RemoveDocumentReply; -using documentapi::UpdateDocumentReply; -using proton::matching::ISearchContext; using proton::matching::MatchContext; using proton::matching::Matcher; using search::index::Schema; diff --git a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp index 6d664e675aa..1fe64739d2d 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp @@ -1,19 +1,14 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.server.searchabledocsubdb"); - #include "searchabledocsubdb.h" #include "fast_access_document_retriever.h" +#include "document_subdb_initializer.h" #include <vespa/searchcore/proton/attribute/attribute_writer.h> #include <vespa/searchcore/proton/flushengine/threadedflushtarget.h> #include <vespa/searchcore/proton/index/index_manager_initializer.h> #include <vespa/searchcore/proton/index/index_writer.h> #include <vespa/searchcore/proton/metrics/legacy_documentdb_metrics.h> -#include <vespa/searchcore/proton/metrics/metricswireservice.h> #include <vespa/searchcorespi/plugin/iindexmanagerfactory.h> -#include <vespa/searchlib/common/indexmetainfo.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/util/closuretask.h> #include <vespa/vespalib/tensor/default_tensor_engine.h> @@ -36,13 +31,10 @@ using vespalib::IllegalStateException; using vespalib::ThreadStackExecutorBase; using namespace searchcorespi; - namespace proton { -SearchableDocSubDB::SearchableDocSubDB(const Config &cfg, - const Context &ctx) - : FastAccessDocSubDB(cfg._fastUpdCfg, - ctx._fastUpdCtx), +SearchableDocSubDB::SearchableDocSubDB(const Config &cfg, const Context &ctx) + : FastAccessDocSubDB(cfg._fastUpdCfg, ctx._fastUpdCtx), IIndexManager::Reconfigurer(), _indexMgr(), _indexWriter(), @@ -55,8 +47,7 @@ SearchableDocSubDB::SearchableDocSubDB(const Config &cfg, getSubDbName(), ctx._fastUpdCtx._storeOnlyCtx._owner.getDistributionKey()), _numSearcherThreads(cfg._numSearcherThreads), _warmupExecutor(ctx._warmupExecutor) -{ -} +{ } SearchableDocSubDB::~SearchableDocSubDB() { diff --git a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h index ac7ba612120..f3b5854395b 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h @@ -48,12 +48,10 @@ public: const FastAccessDocSubDB::Config _fastUpdCfg; const size_t _numSearcherThreads; - Config(const FastAccessDocSubDB::Config &fastUpdCfg, - size_t numSearcherThreads) + Config(const FastAccessDocSubDB::Config &fastUpdCfg, size_t numSearcherThreads) : _fastUpdCfg(fastUpdCfg), _numSearcherThreads(numSearcherThreads) - { - } + { } }; struct Context { @@ -70,8 +68,7 @@ public: _queryLimiter(queryLimiter), _clock(clock), _warmupExecutor(warmupExecutor) - { - } + { } }; private: @@ -89,49 +86,34 @@ private: vespalib::ThreadExecutor &_warmupExecutor; // Note: lifetime of indexManager must be handled by caller. - initializer::InitializerTask::SP + std::shared_ptr<initializer::InitializerTask> createIndexManagerInitializer(const DocumentDBConfig &configSnapshot, const search::index::Schema::SP &unionSchema, const vespa::config::search::core::ProtonConfig::Index &indexCfg, std::shared_ptr<searchcorespi::IIndexManager::SP> indexManager) const; void setupIndexManager(searchcorespi::IIndexManager::SP indexManager); - - void - initFeedView(const IAttributeWriter::SP &attrWriter, - const DocumentDBConfig &configSnapshot); - - void - reconfigureMatchingMetrics(const vespa::config::search::RankProfilesConfig &config); + void initFeedView(const IAttributeWriter::SP &attrWriter, const DocumentDBConfig &configSnapshot); + void reconfigureMatchingMetrics(const vespa::config::search::RankProfilesConfig &config); /** * Implements IndexManagerReconfigurer API. */ - virtual bool - reconfigure(vespalib::Closure0<bool>::UP closure); - - void - reconfigureIndexSearchable(); - - void - syncViews(); - + bool reconfigure(vespalib::Closure0<bool>::UP closure) override; + void reconfigureIndexSearchable(); + void syncViews(); protected: - virtual IFlushTarget::List - getFlushTargetsInternal(); + IFlushTarget::List getFlushTargetsInternal(); using Parent::updateLidReuseDelayer; - virtual void - updateLidReuseDelayer(const LidReuseDelayerConfig &config) override; + void updateLidReuseDelayer(const LidReuseDelayerConfig &config) override; public: - SearchableDocSubDB(const Config &cfg, - const Context &ctx); + SearchableDocSubDB(const Config &cfg, const Context &ctx); - virtual ~SearchableDocSubDB(); - virtual DocumentSubDbInitializer::UP + std::unique_ptr<DocumentSubDbInitializer> createInitializer(const DocumentDBConfig &configSnapshot, SerialNum configSerialNum, const search::index::Schema::SP &unionSchema, diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp index c6d827359e5..c89db63024c 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp @@ -1,15 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.server.storeonlydocsubdb"); - #include "emptysearchview.h" #include "docstorevalidator.h" #include "document_subdb_initializer_result.h" #include "minimal_document_retriever.h" #include "storeonlydocsubdb.h" -#include <vespa/searchcore/proton/common/eventlogger.h> +#include "document_subdb_initializer.h" +#include "reconfig_params.h" #include <vespa/searchcore/proton/attribute/attribute_writer.h> #include <vespa/searchcore/proton/bucketdb/ibucketdbhandlerinitializer.h> #include <vespa/searchcore/proton/docsummary/summarymanagerinitializer.h> @@ -19,14 +16,13 @@ LOG_SETUP(".proton.server.storeonlydocsubdb"); #include <vespa/searchcore/proton/index/index_writer.h> #include <vespa/searchcore/proton/metrics/legacy_documentdb_metrics.h> #include <vespa/searchcore/proton/metrics/metricswireservice.h> -#include <vespa/searchcorespi/index/iindexmanager.h> #include <vespa/searchlib/attribute/configconverter.h> -#include <vespa/searchlib/common/lambdatask.h> #include <vespa/searchlib/docstore/document_store_visitor_progress.h> #include <vespa/searchlib/util/fileheadertk.h> -#include <vespa/vespalib/data/fileheader.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/util/closuretask.h> +#include <vespa/log/log.h> +LOG_SETUP(".proton.server.storeonlydocsubdb"); using vespa::config::search::AttributesConfig; using vespa::config::search::core::ProtonConfig; @@ -50,19 +46,16 @@ using proton::documentmetastore::LidReuseDelayer; using fastos::TimeStamp; using proton::initializer::InitializerTask; -namespace proton -{ +namespace proton { -namespace -{ +namespace { IIndexManager::SP nullIndexManager; IIndexWriter::SP nullIndexWriter; } -StoreOnlyDocSubDB::StoreOnlyDocSubDB(const Config &cfg, - const Context &ctx) +StoreOnlyDocSubDB::StoreOnlyDocSubDB(const Config &cfg, const Context &ctx) : DocSubDB(ctx._owner, ctx._tlSyncer), _docTypeName(cfg._docTypeName), _subName(cfg._subName), @@ -361,6 +354,10 @@ StoreOnlyDocSubDB::initFeedView(const DocumentDBConfig &configSnapshot) _iFeedView.set(StoreOnlyFeedView::SP(feedView.release())); } +vespalib::string +StoreOnlyDocSubDB::getSubDbName() const { + return vespalib::make_string("%s.%s", _owner.getName().c_str(), _subName.c_str()); +} void StoreOnlyDocSubDB::updateLidReuseDelayer(const DocumentDBConfig * diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h index 49e8a03c8ec..00dcb10941c 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h @@ -3,12 +3,9 @@ #include "documentdbconfig.h" #include "idocumentsubdb.h" -#include "ifeedview.h" +#include "storeonlyfeedview.h" #include "summaryadapter.h" #include "tlssyncer.h" -#include <memory> -#include <vector> -#include <vespa/searchcore/config/config-proton.h> #include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h> #include <vespa/searchcore/proton/common/doctypename.h> #include <vespa/searchcore/proton/common/subdbtype.h> @@ -19,24 +16,19 @@ #include <vespa/searchcore/proton/matchengine/imatchhandler.h> #include <vespa/searchcore/proton/summaryengine/isearchhandler.h> #include <vespa/searchcore/proton/common/commit_time_tracker.h> +#include <vespa/searchcore/proton/persistenceengine/i_document_retriever.h> #include <vespa/searchlib/common/fileheadercontext.h> #include <vespa/vespalib/util/varholder.h> - -namespace proton -{ +namespace proton { class MetricsWireService; class LegacyDocumentDBMetrics; class FeedHandler; +class DocumentMetaStoreInitializerResult; +namespace initializer { class InitializerTask; } -namespace bucketdb -{ - -class IBucketDBHandlerInitializer; - -} - +namespace bucketdb { class IBucketDBHandlerInitializer; } namespace documentmetastore { class LidReuseDelayerConfig; } /** @@ -59,7 +51,6 @@ public: void close() override { } }; - class StoreOnlyDocSubDB; /** @@ -77,10 +68,9 @@ class StoreOnlySubDBFileHeaderContext : public search::common::FileHeaderContext public: StoreOnlySubDBFileHeaderContext(StoreOnlyDocSubDB &owner, - const search::common::FileHeaderContext & - parentFileHeaderContext, - const DocTypeName &docTypeName, - const vespalib::string &baseDir) + const search::common::FileHeaderContext & parentFileHeaderContext, + const DocTypeName &docTypeName, + const vespalib::string &baseDir) : search::common::FileHeaderContext(), _owner(owner), _parentFileHeaderContext(parentFileHeaderContext), @@ -94,9 +84,7 @@ public: _subDB = baseDir; } - virtual void - addTags(vespalib::GenericHeader &header, - const vespalib::string &name) const; + void addTags(vespalib::GenericHeader &header, const vespalib::string &name) const override; }; /** @@ -132,8 +120,7 @@ public: _attributeGrowNumDocs(attributeGrowNumDocs), _subDbId(subDbId), _subDbType(subDbType) - { - } + { } }; struct Context { @@ -172,8 +159,7 @@ public: _metrics(metrics), _configLock(configLock), _hwInfo(hwInfo) - { - } + { } }; @@ -208,104 +194,65 @@ private: TlsSyncer _tlsSyncer; DocumentMetaStoreFlushTarget::SP _dmsFlushTarget; - virtual IFlushTarget::List - getFlushTargets(); + IFlushTarget::List getFlushTargets() override; protected: - const uint32_t _subDbId; - const SubDbType _subDbType; + const uint32_t _subDbId; + const SubDbType _subDbType; StoreOnlySubDBFileHeaderContext _fileHeaderContext; std::unique_ptr<documentmetastore::ILidReuseDelayer> _lidReuseDelayer; CommitTimeTracker _commitTimeTracker; - initializer::InitializerTask::SP - createSummaryManagerInitializer(const vespa::config::search::core:: - ProtonConfig::Summary protonSummaryCfg, + std::shared_ptr<initializer::InitializerTask> + createSummaryManagerInitializer(const ProtonConfig::Summary protonSummaryCfg, const search::TuneFileSummary &tuneFile, search::IBucketizer::SP bucketizer, - std::shared_ptr<SummaryManager::SP> result) - const; + std::shared_ptr<SummaryManager::SP> result) const; - void - setupSummaryManager(SummaryManager::SP summaryManager); + void setupSummaryManager(SummaryManager::SP summaryManager); - initializer::InitializerTask::SP + std::shared_ptr<initializer::InitializerTask> createDocumentMetaStoreInitializer(const search::TuneFileAttributes &tuneFile, - std::shared_ptr<DocumentMetaStoreInitializerResult::SP> result) const; - - void - setupDocumentMetaStore(DocumentMetaStoreInitializerResult::SP dmsResult); - - void - initFeedView(const DocumentDBConfig &configSnapshot); - - virtual IFlushTarget::List - getFlushTargetsInternal(); + std::shared_ptr<std::shared_ptr<DocumentMetaStoreInitializerResult>> result) const; + void setupDocumentMetaStore(std::shared_ptr<DocumentMetaStoreInitializerResult> dmsResult); + void initFeedView(const DocumentDBConfig &configSnapshot); + virtual IFlushTarget::List getFlushTargetsInternal(); StoreOnlyFeedView::Context getStoreOnlyFeedViewContext(const DocumentDBConfig &configSnapshot); - StoreOnlyFeedView::PersistentParams getFeedViewPersistentParams(); - - vespalib::string getSubDbName() const { - return vespalib::make_string("%s.%s", - _owner.getName().c_str(), _subName.c_str()); - } - - void - updateLidReuseDelayer(const DocumentDBConfig *newConfigSnapshot); + vespalib::string getSubDbName() const; + void updateLidReuseDelayer(const DocumentDBConfig *newConfigSnapshot); using LidReuseDelayerConfig = documentmetastore::LidReuseDelayerConfig; - virtual void - updateLidReuseDelayer(const LidReuseDelayerConfig &config); + virtual void updateLidReuseDelayer(const LidReuseDelayerConfig &config); public: - StoreOnlyDocSubDB(const Config &cfg, - const Context &ctx); - - virtual + StoreOnlyDocSubDB(const Config &cfg, const Context &ctx); ~StoreOnlyDocSubDB(); - virtual uint32_t getSubDbId() const { return _subDbId; } + uint32_t getSubDbId() const override { return _subDbId; } + vespalib::string getName() const override { return _subName; } - virtual vespalib::string getName() const { return _subName; } - - virtual DocumentSubDbInitializer::UP + std::unique_ptr<DocumentSubDbInitializer> createInitializer(const DocumentDBConfig &configSnapshot, SerialNum configSerialNum, - const search::index::Schema::SP &unionSchema, - const vespa::config::search::core:: - ProtonConfig::Summary &protonSummaryCfg, - const vespa::config::search::core:: - ProtonConfig::Index &indexCfg) const override; - - virtual void setup(const DocumentSubDbInitializerResult &initResult) - override; + const Schema::SP &unionSchema, + const ProtonConfig::Summary &protonSummaryCfg, + const ProtonConfig::Index &indexCfg) const override; - virtual void - initViews(const DocumentDBConfig &configSnapshot, - const matching::SessionManager::SP &sessionManager); + void setup(const DocumentSubDbInitializerResult &initResult) override; + void initViews(const DocumentDBConfig &configSnapshot, const std::shared_ptr<matching::SessionManager> &sessionManager) override; - virtual IReprocessingTask::List + IReprocessingTask::List applyConfig(const DocumentDBConfig &newConfigSnapshot, const DocumentDBConfig &oldConfigSnapshot, SerialNum serialNum, - const ReconfigParams params); - - virtual ISearchHandler::SP - getSearchView() const - { - return _iSearchView.get(); - } + const ReconfigParams params) override; - virtual IFeedView::SP - getFeedView() const - { - return _iFeedView.get(); - } + ISearchHandler::SP getSearchView() const override { return _iSearchView.get(); } + IFeedView::SP getFeedView() const override { return _iFeedView.get(); } - virtual void - clearViews() - { + void clearViews() override { _iFeedView.clear(); _iSearchView.clear(); } @@ -316,74 +263,26 @@ public: * * @return The summary manager. */ - virtual const ISummaryManager::SP & - getSummaryManager() const - { - return _iSummaryMgr; - } - - virtual proton::IAttributeManager::SP - getAttributeManager() const; - - virtual const IIndexManager::SP & - getIndexManager() const; - - virtual const ISummaryAdapter::SP & - getSummaryAdapter() const - { - return _summaryAdapter; - } - - virtual const IIndexWriter::SP & - getIndexWriter() const; - - virtual IDocumentMetaStoreContext & - getDocumentMetaStoreContext() - { - return *_metaStoreCtx; - } - - virtual size_t - getNumDocs() const; - - virtual size_t - getNumActiveDocs() const override; - - virtual bool - hasDocument(const document::DocumentId &id); - - virtual void - onReplayDone(); - - virtual void - onReprocessDone(SerialNum serialNum); - - virtual SerialNum - getOldestFlushedSerial(); - - virtual SerialNum - getNewestFlushedSerial(); - - virtual void - wipeHistory(SerialNum wipeSerial, - const search::index::Schema &newHistorySchema, - const search::index::Schema &wipeSchema); - - virtual void - setIndexSchema(const search::index::Schema::SP &schema, - const search::index::Schema::SP &fusionSchema); - - virtual search::SearchableStats - getSearchableStats() const; - - virtual IDocumentRetriever::UP - getDocumentRetriever(); - - virtual matching::MatchingStats - getMatcherStats(const vespalib::string &rankProfile) const; - + const ISummaryManager::SP &getSummaryManager() const override { return _iSummaryMgr; } + IAttributeManager::SP getAttributeManager() const override; + const std::shared_ptr<searchcorespi::IIndexManager> & getIndexManager() const override; + const ISummaryAdapter::SP & getSummaryAdapter() const override { return _summaryAdapter; } + const std::shared_ptr<IIndexWriter> & getIndexWriter() const override; + IDocumentMetaStoreContext & getDocumentMetaStoreContext() override { return *_metaStoreCtx; } + size_t getNumDocs() const override; + size_t getNumActiveDocs() const override; + bool hasDocument(const document::DocumentId &id) override; + void onReplayDone() override; + void onReprocessDone(SerialNum serialNum) override; + SerialNum getOldestFlushedSerial() override; + SerialNum getNewestFlushedSerial() override; + + void wipeHistory(SerialNum wipeSerial, const Schema &newHistorySchema, const Schema &wipeSchema) override; + void setIndexSchema(const Schema::SP &schema, const Schema::SP &fusionSchema) override; + search::SearchableStats getSearchableStats() const override; + IDocumentRetriever::UP getDocumentRetriever() override; + matching::MatchingStats getMatcherStats(const vespalib::string &rankProfile) const override; void close() override; }; -} // namespace proton - +} // namespace proton
\ No newline at end of file diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp index b01ffc38622..31bcaca5014 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp @@ -1,14 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.server.storeonlyfeedview"); #include "ireplayconfig.h" #include "storeonlyfeedview.h" -#include <vespa/documentapi/messagebus/documentprotocol.h> -#include <vespa/documentapi/messagebus/messages/documentreply.h> -#include <vespa/documentapi/messagebus/messages/removedocumentreply.h> -#include <vespa/documentapi/messagebus/messages/updatedocumentreply.h> #include <vespa/searchcore/proton/common/bucketfactory.h> #include <vespa/searchcore/proton/common/commit_time_tracker.h> #include <vespa/searchcore/proton/metrics/feed_metrics.h> @@ -24,16 +17,15 @@ LOG_SETUP(".proton.server.storeonlyfeedview"); #include "putdonecontext.h" #include <vespa/searchlib/common/lambdatask.h> #include <vespa/searchlib/common/scheduletaskcallback.h> +#include <vespa/vespalib/util/exceptions.h> +#include <vespa/log/log.h> +LOG_SETUP(".proton.server.storeonlyfeedview"); using document::BucketId; using document::DocumentTypeRepo; using document::Document; using document::DocumentId; using document::DocumentUpdate; -using documentapi::DocumentProtocol; -using documentapi::DocumentReply; -using documentapi::RemoveDocumentReply; -using documentapi::UpdateDocumentReply; using search::index::Schema; using storage::spi::BucketInfoResult; using storage::spi::Timestamp; diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.h b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.h index 11c588eb2ab..78fa702f19e 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.h +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.h @@ -8,7 +8,6 @@ #include "replaypacketdispatcher.h" #include "searchcontext.h" #include "tlcproxy.h" -#include <vespa/documentapi/messagebus/documentprotocol.h> #include <vespa/searchcore/proton/common/doctypename.h> #include <vespa/searchcore/proton/common/feeddebugger.h> #include <vespa/searchcore/proton/documentmetastore/documentmetastore.h> @@ -18,17 +17,14 @@ #include <vespa/searchcorespi/index/ithreadingservice.h> #include <vespa/searchlib/query/base.h> #include <vespa/vespalib/util/threadstackexecutorbase.h> -#include <vespa/log/log.h> -namespace search -{ +namespace search { class IDestructorCallback; } -namespace proton -{ +namespace proton { class IReplayConfig; class PerDocTypeFeedMetrics; diff --git a/searchcore/src/vespa/searchcore/proton/server/tlcproxy.cpp b/searchcore/src/vespa/searchcore/proton/server/tlcproxy.cpp index b4c509744f7..47889ea9cb8 100644 --- a/searchcore/src/vespa/searchcore/proton/server/tlcproxy.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/tlcproxy.cpp @@ -1,12 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.server.tlcproxy"); #include "tlcproxy.h" #include <vespa/vespalib/objects/nbostream.h> #include <vespa/searchlib/common/bitvector.h> #include <vespa/document/bucket/bucketid.h> +#include <vespa/vespalib/util/exceptions.h> +#include <vespa/log/log.h> +LOG_SETUP(".proton.server.tlcproxy"); using vespalib::nbostream; diff --git a/searchcore/src/vespa/searchcore/proton/server/tlssyncer.h b/searchcore/src/vespa/searchcore/proton/server/tlssyncer.h index 1010755b493..31dbd4ca383 100644 --- a/searchcore/src/vespa/searchcore/proton/server/tlssyncer.h +++ b/searchcore/src/vespa/searchcore/proton/server/tlssyncer.h @@ -24,13 +24,13 @@ class TlsSyncer : public ITlsSyncer const IGetSerialNum &_getSerialNum; search::transactionlog::SyncProxy &_proxy; public: - virtual ~TlsSyncer(void) = default; + virtual ~TlsSyncer() = default; TlsSyncer(vespalib::ThreadExecutor &executor, const IGetSerialNum &getSerialNum, search::transactionlog::SyncProxy &proxy); - virtual void sync() override; + void sync() override; }; } diff --git a/searchcore/src/vespa/searchcore/proton/server/transactionlogmanagerbase.cpp b/searchcore/src/vespa/searchcore/proton/server/transactionlogmanagerbase.cpp index afab869e177..2b7f5ff7944 100644 --- a/searchcore/src/vespa/searchcore/proton/server/transactionlogmanagerbase.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/transactionlogmanagerbase.cpp @@ -1,11 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.server.transactionlogmanagerbase"); #include "transactionlogmanagerbase.h" #include <vespa/searchcore/proton/common/eventlogger.h> #include <stdexcept> +#include <vespa/vespalib/util/stringfmt.h> + +#include <vespa/log/log.h> +LOG_SETUP(".proton.server.transactionlogmanagerbase"); using search::transactionlog::TransLogClient; diff --git a/searchcore/src/vespa/searchcore/proton/test/documentdb_config_builder.cpp b/searchcore/src/vespa/searchcore/proton/test/documentdb_config_builder.cpp index 4ec0ae006ea..5deb59aad6f 100644 --- a/searchcore/src/vespa/searchcore/proton/test/documentdb_config_builder.cpp +++ b/searchcore/src/vespa/searchcore/proton/test/documentdb_config_builder.cpp @@ -1,7 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "documentdb_config_builder.h" +#include <vespa/config-summary.h> +#include <vespa/config-summarymap.h> +#include <vespa/config-rank-profiles.h> +#include <vespa/config-attributes.h> +#include <vespa/config-indexschema.h> +#include <vespa/searchsummary/config/config-juniperrc.h> +#include <vespa/document/config/config-documenttypes.h> using document::DocumenttypesConfig; using search::TuneFileDocumentDB; @@ -36,8 +42,7 @@ DocumentDBConfigBuilder::DocumentDBConfigBuilder(int64_t generation, _configId(configId), _docTypeName(docTypeName), _extraConfig() -{ -} +{ } DocumentDBConfig::SP DocumentDBConfigBuilder::build() diff --git a/searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h b/searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h index 454e0dc01fb..d1f84031417 100644 --- a/searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h +++ b/searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h @@ -3,6 +3,19 @@ #include <vespa/searchcore/proton/server/idocumentsubdb.h> #include <vespa/searchcore/proton/server/executorthreadingservice.h> +#include <vespa/searchcore/proton/docsummary/isummarymanager.h> +#include <vespa/searchcorespi/index/iindexmanager.h> +#include <vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h> +#include <vespa/searchcore/proton/server/document_subdb_initializer.h> +#include <vespa/searchcore/proton/server/isummaryadapter.h> +#include <vespa/searchcore/proton/index/i_index_writer.h> +#include <vespa/searchcore/proton/server/ifeedview.h> +#include <vespa/searchcore/proton/matching/sessionmanager.h> +#include <vespa/searchcore/proton/summaryengine/isearchhandler.h> +#include <vespa/searchcore/proton/persistenceengine/i_document_retriever.h> +#include <vespa/searchcore/proton/server/reconfig_params.h> + + namespace proton { @@ -10,6 +23,7 @@ namespace test { struct DummyDocumentSubDb : public IDocumentSubDB { + using IIndexManager = searchcorespi::IIndexManager; uint32_t _subDbId; DocumentMetaStoreContext _metaStoreCtx; ISummaryManager::SP _summaryManager; @@ -18,8 +32,7 @@ struct DummyDocumentSubDb : public IDocumentSubDB IIndexWriter::SP _indexWriter; std::unique_ptr<ExecutorThreadingService> _writeService; - DummyDocumentSubDb(std::shared_ptr<BucketDBOwner> bucketDB, - uint32_t subDbId) + DummyDocumentSubDb(std::shared_ptr<BucketDBOwner> bucketDB, uint32_t subDbId) : _subDbId(subDbId), _metaStoreCtx(bucketDB), _summaryManager(), |