diff options
author | Tor Egge <Tor.Egge@yahoo-inc.com> | 2017-05-26 10:38:13 +0000 |
---|---|---|
committer | Tor Egge <Tor.Egge@yahoo-inc.com> | 2017-05-26 10:38:13 +0000 |
commit | 41d0d653d5dfc8d2d3b78e979195be2290064abb (patch) | |
tree | 2f73fa6a4fcf94eb0d5d637a40f186dea845e91a /searchcore/src | |
parent | a25bdfc49336fa028557649dbe332c37d79847ee (diff) |
Remove unused schema changes related code. We now use state v1 api to
get component config info.
Diffstat (limited to 'searchcore/src')
16 files changed, 0 insertions, 666 deletions
diff --git a/searchcore/src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp b/searchcore/src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp index 0214913f6ae..2dbd1e9c19b 100644 --- a/searchcore/src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp +++ b/searchcore/src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp @@ -39,11 +39,8 @@ public: { fprintf(stderr, "usage: %s <port|spec|--local|--id=name> <cmd> [args]\n", _argv[0]); fprintf(stderr, "die\n"); - fprintf(stderr, "getConfigTime\n"); fprintf(stderr, "getProtonStatus\n"); fprintf(stderr, "getState\n"); - fprintf(stderr, "listDocTypes\n"); - fprintf(stderr, "listSchema documentType\n"); fprintf(stderr, "monitor\n"); fprintf(stderr, "enableSearching\n"); fprintf(stderr, "disableSearching\n"); @@ -337,71 +334,6 @@ public: if (! _req->IsError()) { printf("OK: prepareRestart enabled\n"); } - } else if (strcmp(_argv[2], "listDocTypes") == 0) { - _req->SetMethodName("proton.listDocTypes"); - invokeRPC(false, 86400.0); - invoked = true; - if (! _req->IsError()) { - FRT_Values &ret = *_req->GetReturn(); - if (strcmp(ret.GetTypeString(), "S") == 0) { - uint32_t dtLen = ret[0]._string_array._len; - const FRT_StringValue *dt = ret[0]._string_array._pt; - for (uint32_t i = 0; i < dtLen; ++i) { - if (i > 0) - printf(" "); - printf("%s", dt[i]._str); - } - printf("\n"); - } else { - fprintf(stderr, "Unexpected return value\n"); - } - } - } else if (strcmp(_argv[2], "listSchema") == 0 && _argc == 4) { - _req->SetMethodName("proton.listSchema"); - FRT_Values &arg = *_req->GetParams(); - arg.AddString(_argv[3]); - invokeRPC(false, 86400.0); - invoked = true; - if (! _req->IsError()) { - FRT_Values &ret = *_req->GetReturn(); - if (strcmp(ret.GetTypeString(), "SSSS") == 0) { - uint32_t fnLen = ret[0]._string_array._len; - const FRT_StringValue *fn = ret[0]._string_array._pt; - uint32_t fdtLen = ret[1]._string_array._len; - const FRT_StringValue *fdt = ret[1]._string_array._pt; - uint32_t fctLen = ret[2]._string_array._len; - const FRT_StringValue *fct = ret[2]._string_array._pt; - uint32_t flLen = ret[3]._string_array._len; - const FRT_StringValue *fl = ret[3]._string_array._pt; - for (uint32_t i = 0; - i < fnLen && i < fdtLen && i < fctLen && i < flLen; - ++i) { - if (i > 0) - printf(" "); - printf("%s/%s/%s/%s", - fn[i]._str, - fdt[i]._str, - fct[i]._str, - fl[i]._str); - } - printf("\n"); - } else { - fprintf(stderr, "Unexpected return value\n"); - } - } - } else if (strcmp(_argv[2], "getConfigTime") == 0) { - _req->SetMethodName("proton.getConfigTime"); - invokeRPC(false, 86400.0); - invoked = true; - if (! _req->IsError()) { - FRT_Values &ret = *_req->GetReturn(); - if (strcmp(ret.GetTypeString(), "l") == 0) { - uint64_t configTime = ret[0]._intval64; - printf("%" PRId64 "\n", configTime); - } else { - fprintf(stderr, "Unexpected return value\n"); - } - } } else if (strcmp(_argv[2], "die") == 0) { _req->SetMethodName("pandora.rtc.die"); diff --git a/searchcore/src/tests/proton/common/.gitignore b/searchcore/src/tests/proton/common/.gitignore index c03144e885d..9ce51ef2178 100644 --- a/searchcore/src/tests/proton/common/.gitignore +++ b/searchcore/src/tests/proton/common/.gitignore @@ -1,3 +1,2 @@ searchcore_cachedselect_test_app -searchcore_schemautil_test_app searchcore_selectpruner_test_app diff --git a/searchcore/src/tests/proton/common/CMakeLists.txt b/searchcore/src/tests/proton/common/CMakeLists.txt index 5f0fa227c88..73f300fd124 100644 --- a/searchcore/src/tests/proton/common/CMakeLists.txt +++ b/searchcore/src/tests/proton/common/CMakeLists.txt @@ -1,11 +1,4 @@ # Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_executable(searchcore_schemautil_test_app TEST - SOURCES - schemautil_test.cpp - DEPENDS - searchcore_pcommon -) -vespa_add_test(NAME searchcore_schemautil_test_app COMMAND searchcore_schemautil_test_app) vespa_add_executable(searchcore_selectpruner_test_app TEST SOURCES selectpruner_test.cpp diff --git a/searchcore/src/tests/proton/common/schemautil_test.cpp b/searchcore/src/tests/proton/common/schemautil_test.cpp deleted file mode 100644 index d21582c5111..00000000000 --- a/searchcore/src/tests/proton/common/schemautil_test.cpp +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -// Unit tests for schemautil. - -#include <vespa/fastos/fastos.h> -#include <vespa/searchcore/proton/common/schemautil.h> -#include <vespa/vespalib/stllike/string.h> -#include <vespa/vespalib/testkit/testapp.h> - -using namespace proton; -using namespace search::index; -using search::index::schema::CollectionType; -using search::index::schema::DataType; -using vespalib::string; - - -namespace { - -void addAllFieldTypes(const string &name, Schema &schema, - fastos::TimeStamp timestamp) -{ - Schema::IndexField index_field(name, DataType::STRING); - index_field.setTimestamp(timestamp); - schema.addIndexField(index_field); - - Schema::AttributeField attribute_field(name, DataType::STRING); - attribute_field.setTimestamp(timestamp); - schema.addAttributeField(attribute_field); - - Schema::SummaryField summary_field(name, DataType::STRING); - summary_field.setTimestamp(timestamp); - schema.addSummaryField(summary_field); -} - -TEST("require that makeHistorySchema sets timestamp") -{ - Schema old_schema; - Schema new_schema; - Schema old_history; - - const fastos::TimeStamp now(84); - const string name = "foo"; - addAllFieldTypes(name, old_schema, fastos::TimeStamp(0)); - - Schema::SP schema = SchemaUtil::makeHistorySchema(new_schema, old_schema, - old_history, now); - - ASSERT_EQUAL(1u, schema->getNumIndexFields()); - EXPECT_EQUAL(name, schema->getIndexField(0).getName()); - EXPECT_EQUAL(now, schema->getIndexField(0).getTimestamp()); - - ASSERT_EQUAL(1u, schema->getNumAttributeFields()); - EXPECT_EQUAL(name, schema->getAttributeField(0).getName()); - EXPECT_EQUAL(now, schema->getAttributeField(0).getTimestamp()); - - ASSERT_EQUAL(1u, schema->getNumSummaryFields()); - EXPECT_EQUAL(name, schema->getSummaryField(0).getName()); - EXPECT_EQUAL(now, schema->getSummaryField(0).getTimestamp()); -} - -TEST("require that makeHistorySchema preserves timestamp") -{ - Schema old_schema; - Schema new_schema; - Schema old_history; - - const fastos::TimeStamp timestamp(42); - const string name = "foo"; - addAllFieldTypes("bar", old_schema, fastos::TimeStamp(0)); - addAllFieldTypes(name, old_history, timestamp); - - Schema::SP schema = - SchemaUtil::makeHistorySchema(new_schema, old_schema, old_history); - - ASSERT_EQUAL(2u, schema->getNumIndexFields()); - uint32_t id = schema->getIndexFieldId(name); - ASSERT_NOT_EQUAL(id, Schema::UNKNOWN_FIELD_ID); - EXPECT_EQUAL(timestamp, schema->getIndexField(id).getTimestamp()); - - ASSERT_EQUAL(2u, schema->getNumAttributeFields()); - id = schema->getAttributeFieldId(name); - ASSERT_NOT_EQUAL(id, Schema::UNKNOWN_FIELD_ID); - EXPECT_EQUAL(timestamp, schema->getAttributeField(id).getTimestamp()); - - ASSERT_EQUAL(2u, schema->getNumSummaryFields()); - id = schema->getSummaryFieldId(name); - ASSERT_NOT_EQUAL(id, Schema::UNKNOWN_FIELD_ID); - EXPECT_EQUAL(timestamp, schema->getSummaryField(id).getTimestamp()); -} - -struct ListSchemaResult { - std::vector<vespalib::string> fieldNames; - std::vector<vespalib::string> fieldDataTypes; - std::vector<vespalib::string> fieldCollectionTypes; - std::vector<vespalib::string> fieldLocations; -}; - -void -assertSchemaResult(const vespalib::string &name, - const vespalib::string &dataType, - const vespalib::string &collectionType, - const vespalib::string &location, - const ListSchemaResult &r, - size_t i) -{ - EXPECT_EQUAL(name, r.fieldNames[i]); - EXPECT_EQUAL(dataType, r.fieldDataTypes[i]); - EXPECT_EQUAL(collectionType, r.fieldCollectionTypes[i]); - EXPECT_EQUAL(location, r.fieldLocations[i]); -} - -TEST("require that listSchema can list all fields") -{ - Schema schema; - schema.addIndexField(Schema::IndexField("if", DataType::STRING)); - schema.addAttributeField(Schema::AttributeField("af", DataType::INT32)); - schema.addSummaryField(Schema::SummaryField("sf", DataType::FLOAT, CollectionType::ARRAY)); - - ListSchemaResult r; - SchemaUtil::listSchema(schema, r.fieldNames, r.fieldDataTypes, r.fieldCollectionTypes, r.fieldLocations); - EXPECT_EQUAL(3u, r.fieldNames.size()); - EXPECT_EQUAL(3u, r.fieldDataTypes.size()); - EXPECT_EQUAL(3u, r.fieldCollectionTypes.size()); - EXPECT_EQUAL(3u, r.fieldLocations.size()); - assertSchemaResult("af", "INT32", "SINGLE", "a", r, 0); - assertSchemaResult("if", "STRING", "SINGLE", "i", r, 1); - assertSchemaResult("sf", "FLOAT", "ARRAY", "s", r, 2); -} - -} // namespace - -TEST_MAIN() { TEST_RUN_ALL(); } diff --git a/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp b/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp index 10d8cc8c3a2..89d6716c081 100644 --- a/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp +++ b/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp @@ -8,7 +8,6 @@ #include <vespa/config-summary.h> #include <vespa/config-summarymap.h> #include <vespa/config/helper/configgetter.hpp> -#include <vespa/searchcore/proton/common/schemautil.h> #include <vespa/searchcore/proton/server/bootstrapconfig.h> #include <vespa/searchcore/proton/server/fileconfigmanager.h> #include <vespa/searchcore/proton/test/documentdb_config_builder.h> diff --git a/searchcore/src/tests/proton/server/memoryconfigstore_test.cpp b/searchcore/src/tests/proton/server/memoryconfigstore_test.cpp index 8fc1bd2d9ed..52ac7650ada 100644 --- a/searchcore/src/tests/proton/server/memoryconfigstore_test.cpp +++ b/searchcore/src/tests/proton/server/memoryconfigstore_test.cpp @@ -9,7 +9,6 @@ LOG_SETUP("memoryconfigstore_test"); #include <vespa/searchcore/proton/server/memoryconfigstore.h> #include <vespa/searchcore/proton/test/documentdb_config_builder.h> #include <vespa/vespalib/testkit/testapp.h> -#include <vespa/searchcore/proton/common/schemautil.h> using search::SerialNum; using search::index::Schema; diff --git a/searchcore/src/vespa/searchcore/proton/common/CMakeLists.txt b/searchcore/src/vespa/searchcore/proton/common/CMakeLists.txt index d89eb91cf6f..48c87616b9b 100644 --- a/searchcore/src/vespa/searchcore/proton/common/CMakeLists.txt +++ b/searchcore/src/vespa/searchcore/proton/common/CMakeLists.txt @@ -15,7 +15,6 @@ vespa_add_library(searchcore_pcommon STATIC hw_info_sampler.cpp indexschema_inspector.cpp monitored_refcount.cpp - schemautil.cpp selectpruner.cpp selectcontext.cpp state_reporter_utils.cpp diff --git a/searchcore/src/vespa/searchcore/proton/common/schemautil.cpp b/searchcore/src/vespa/searchcore/proton/common/schemautil.cpp deleted file mode 100644 index 2fcf4a11c9b..00000000000 --- a/searchcore/src/vespa/searchcore/proton/common/schemautil.cpp +++ /dev/null @@ -1,211 +0,0 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include "schemautil.h" - -#include <vespa/log/log.h> -LOG_SETUP(".proton.common.schemautil"); - -using namespace search::index; - -namespace proton { - -namespace { - -class FieldQuad -{ -public: - vespalib::string _name; - vespalib::string _dataType; - vespalib::string _collectionType; - vespalib::string _location; - - FieldQuad(const vespalib::string &name, - const vespalib::string &dataType, - const vespalib::string &collectionType, - const vespalib::string &location); - ~FieldQuad(); - - bool - operator<(const FieldQuad &rhs) const - { - if (_name != rhs._name) - return _name < rhs._name; - if (_dataType != rhs._dataType) - return _dataType < rhs._dataType; - if (_collectionType != rhs._collectionType) - return _collectionType < rhs._collectionType; - return _location < rhs._location; - } -}; - -FieldQuad::FieldQuad(const vespalib::string &name, - const vespalib::string &dataType, - const vespalib::string &collectionType, - const vespalib::string &location) - : _name(name), - _dataType(dataType), - _collectionType(collectionType), - _location(location) -{ -} -FieldQuad::~FieldQuad() {} - -} - - -Schema::SP -SchemaUtil::makeHistorySchema(const Schema &newSchema, - const Schema &oldSchema, - const Schema &oldHistory) -{ - return makeHistorySchema(newSchema, oldSchema, oldHistory, - fastos::ClockSystem::now()); -} - -Schema::SP -SchemaUtil::makeHistorySchema(const Schema &newSchema, - const Schema &oldSchema, - const Schema &oldHistory, - int64_t now) -{ - Schema::SP history(new Schema); - - uint32_t fields = oldHistory.getNumIndexFields(); - for (uint32_t fieldId = 0; fieldId < fields; ++fieldId) { - const Schema::IndexField &field = oldHistory.getIndexField(fieldId); - uint32_t nFieldId = newSchema.getIndexFieldId(field.getName()); - if (nFieldId == Schema::UNKNOWN_FIELD_ID) { - // Field not re-added, keep it in history - history->addIndexField(field); - } - } - fields = oldHistory.getNumAttributeFields(); - for (uint32_t fieldId = 0; fieldId < fields; ++fieldId) { - const Schema::AttributeField &field = - oldHistory.getAttributeField(fieldId); - uint32_t nFieldId = - newSchema.getAttributeFieldId(field.getName()); - if (nFieldId == Schema::UNKNOWN_FIELD_ID) { - // Field not re-added, keep it in history - history->addAttributeField(field); - } - } - fields = oldHistory.getNumSummaryFields(); - for (uint32_t fieldId = 0; fieldId < fields; ++fieldId) { - const Schema::SummaryField &field = - oldHistory.getSummaryField(fieldId); - uint32_t nFieldId = - newSchema.getSummaryFieldId(field.getName()); - if (nFieldId == Schema::UNKNOWN_FIELD_ID) { - // Field not re-added, keep it in history - history->addSummaryField(field); - } - } - fields = oldSchema.getNumIndexFields(); - for (uint32_t fieldId = 0; fieldId < fields; ++fieldId) { - Schema::IndexField field = oldSchema.getIndexField(fieldId); - uint32_t nFieldId = newSchema.getIndexFieldId(field.getName()); - if (nFieldId == Schema::UNKNOWN_FIELD_ID) { - // Field removed, add to history - uint32_t oFieldId = history->getIndexFieldId(field.getName()); - if (oFieldId == Schema::UNKNOWN_FIELD_ID) { - field.setTimestamp(now); - history->addIndexField(field); - } - } - } - fields = oldSchema.getNumAttributeFields(); - for (uint32_t fieldId = 0; fieldId < fields; ++fieldId) { - Schema::AttributeField field = oldSchema.getAttributeField(fieldId); - uint32_t nFieldId = - newSchema.getAttributeFieldId(field.getName()); - if (nFieldId == Schema::UNKNOWN_FIELD_ID) { - // Field removed, add to history - uint32_t oFieldId = history->getAttributeFieldId(field.getName()); - if (oFieldId == Schema::UNKNOWN_FIELD_ID) { - field.setTimestamp(now); - history->addAttributeField(field); - } - } - } - fields = oldSchema.getNumSummaryFields(); - for (uint32_t fieldId = 0; fieldId < fields; ++fieldId) { - Schema::SummaryField field = oldSchema.getSummaryField(fieldId); - uint32_t nFieldId = - newSchema.getSummaryFieldId(field.getName()); - if (nFieldId == Schema::UNKNOWN_FIELD_ID) { - // Field removed, add to history - uint32_t oFieldId = history->getSummaryFieldId(field.getName()); - if (oFieldId == Schema::UNKNOWN_FIELD_ID) { - field.setTimestamp(now); - history->addSummaryField(field); - } - } - } - return history; -} - - -void -SchemaUtil::listSchema(const Schema &schema, - std::vector<vespalib::string> &fieldNames, - std::vector<vespalib::string> &fieldDataTypes, - std::vector<vespalib::string> &fieldCollectionTypes, - std::vector<vespalib::string> &fieldLocations) -{ - std::vector<FieldQuad> quads; - for (uint32_t i = 0; i < schema.getNumAttributeFields(); ++i) { - const Schema::AttributeField &field = schema.getAttributeField(i); - quads.push_back( - FieldQuad(field.getName(), - 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()), - "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()), - "s")); - } - std::sort(quads.begin(), quads.end()); - std::string name; - std::string dataType; - std::string collectionType; - std::string location; - for (std::vector<FieldQuad>::const_iterator - it = quads.begin(), ite = quads.end(); it != ite; ++it) { - if (it->_name != name || it->_dataType != dataType || - it->_collectionType != collectionType) { - if (!name.empty()) { - fieldNames.push_back(name); - fieldDataTypes.push_back(dataType); - fieldCollectionTypes.push_back(collectionType); - fieldLocations.push_back(location); - } - name = it->_name; - dataType = it->_dataType; - collectionType = it->_collectionType; - location.clear(); - } - location += it->_location; - } - if (!name.empty()) { - fieldNames.push_back(name); - fieldDataTypes.push_back(dataType); - fieldCollectionTypes.push_back(collectionType); - fieldLocations.push_back(location); - } -} - - -} // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/common/schemautil.h b/searchcore/src/vespa/searchcore/proton/common/schemautil.h deleted file mode 100644 index 36cc952f921..00000000000 --- a/searchcore/src/vespa/searchcore/proton/common/schemautil.h +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#pragma once - -#include <vespa/searchcommon/common/schema.h> -#include <vespa/vespalib/stllike/string.h> -#include <vector> - -namespace proton -{ - -class SchemaUtil -{ -public: - /** - * Make new history schema based on new and old schema and old history. - */ - static search::index::Schema::SP - makeHistorySchema(const search::index::Schema &newSchema, - const search::index::Schema &oldSchema, - const search::index::Schema &oldHistory); - - static search::index::Schema::SP - makeHistorySchema(const search::index::Schema &newSchema, - const search::index::Schema &oldSchema, - const search::index::Schema &oldHistory, - int64_t timestamp); - - /** - * Iterate through the given schema and fill out the given string vectors. - */ - static void - listSchema(const search::index::Schema &schema, - std::vector<vespalib::string> &fieldNames, - std::vector<vespalib::string> &fieldDataTypes, - std::vector<vespalib::string> &fieldCollectionTypes, - std::vector<vespalib::string> &fieldLocations); -}; - -} // namespace proton - diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp index 77060956799..092aab38ec8 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp @@ -13,7 +13,6 @@ #include <vespa/searchcore/proton/attribute/attribute_writer.h> #include <vespa/searchcore/proton/attribute/imported_attributes_repo.h> #include <vespa/searchcore/proton/common/eventlogger.h> -#include <vespa/searchcore/proton/common/schemautil.h> #include <vespa/searchcore/proton/common/statusreport.h> #include <vespa/searchcore/proton/index/index_writer.h> #include <vespa/searchcore/proton/initializer/task_runner.h> @@ -906,25 +905,6 @@ DocumentDB::replayConfig(search::SerialNum serialNum) _docTypeName.toString().c_str(), serialNum); } -void -DocumentDB::listSchema(std::vector<vespalib::string> &fieldNames, - std::vector<vespalib::string> &fieldDataTypes, - std::vector<vespalib::string> &fieldCollectionTypes, - std::vector<vespalib::string> &fieldLocations) -{ - DocumentDBConfig::SP activeSnapshot = getActiveConfig(); - if (activeSnapshot.get() == NULL || - activeSnapshot->getSchemaSP().get() == NULL) - { - return; - } - SchemaUtil::listSchema(*activeSnapshot->getSchemaSP(), - fieldNames, - fieldDataTypes, - fieldCollectionTypes, - fieldLocations); -} - int64_t DocumentDB::getActiveGeneration() const { lock_guard guard(_configMutex); return _activeConfigSnapshotGeneration; diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.h b/searchcore/src/vespa/searchcore/proton/server/documentdb.h index 3f090e5d3c8..1fe634fcf4c 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.h @@ -397,12 +397,6 @@ public: const DocTypeName & getDocTypeName() const { return _docTypeName; } - void - listSchema(std::vector<vespalib::string> &fieldNames, - std::vector<vespalib::string> &fieldDataTypes, - std::vector<vespalib::string> &fieldCollectionTypes, - std::vector<vespalib::string> &fieldLocations); - void newConfigSnapshot(DocumentDBConfig::SP snapshot); // Implements DocumentDBConfigOwner diff --git a/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp index 9c95b094623..2b8209d9e4e 100644 --- a/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp @@ -6,7 +6,6 @@ #include <vespa/config/print/fileconfigsnapshotreader.h> #include <vespa/config/print/fileconfigsnapshotwriter.h> #include <vespa/searchcommon/common/schemaconfigurer.h> -#include <vespa/searchlib/index/schemautil.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/config-summarymap.h> #include <vespa/config-rank-profiles.h> diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.cpp b/searchcore/src/vespa/searchcore/proton/server/proton.cpp index e5456355f2a..c7ae1e0c3d8 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp @@ -680,45 +680,6 @@ Proton::prepareRestart() return true; } -void -Proton::listDocTypes(std::vector<vespalib::string> &documentTypes) -{ - DocumentDBMap dbs; - { - std::shared_lock<std::shared_timed_mutex> guard(_mutex); - dbs = _documentDBMap; - } - for (const auto &kv : dbs) { - vespalib::string documentType; - const DocTypeName &docTypeName = - kv.second->getDocTypeName(); - documentTypes.push_back(docTypeName.getName()); - } -} - - -void -Proton::listSchema(const vespalib::string &documentType, - std::vector<vespalib::string> &fieldNames, - std::vector<vespalib::string> &fieldDataTypes, - std::vector<vespalib::string> &fieldCollectionTypes, - std::vector<vespalib::string> &fieldLocations) -{ - DocumentDB::SP ddb; - DocTypeName docTypeName(documentType); - { - std::shared_lock<std::shared_timed_mutex> guard(_mutex); - DocumentDBMap::const_iterator it = _documentDBMap.find(docTypeName); - if (it != _documentDBMap.end()) - ddb = it->second; - } - if (ddb.get() == NULL) - return; - ddb->listSchema(fieldNames, fieldDataTypes, fieldCollectionTypes, - fieldLocations); -} - - namespace { int countOpenFiles() diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.h b/searchcore/src/vespa/searchcore/proton/server/proton.h index 701ce284a5c..5c4181ab5b6 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton.h +++ b/searchcore/src/vespa/searchcore/proton/server/proton.h @@ -199,15 +199,6 @@ public: bool triggerFlush(); bool prepareRestart(); - void listDocTypes(std::vector<vespalib::string> &documentTypes); - - void - listSchema(const vespalib::string &documentType, - std::vector<vespalib::string> &fieldNames, - std::vector<vespalib::string> &fieldDataTypes, - std::vector<vespalib::string> &fieldCollectionTypes, - std::vector<vespalib::string> &fieldLocations); - // implements ComponentConfigProducer interface virtual void getComponentConfig(Consumer &consumer) override; diff --git a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp index 58c2fd90625..dec20b1650a 100644 --- a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp @@ -181,30 +181,6 @@ RPCHooksBase::initRPC() "such that TLS replay time + time spent flushing components is as low as possible"); rb.ReturnDesc("success", "Whether or not prepare for restart was triggered."); //------------------------------------------------------------------------- - rb.DefineMethod("proton.listDocTypes", "", "S", true, - FRT_METHOD(RPCHooksBase::rpc_listDocTypes), this); - rb.MethodDesc("Get the current list of document types"); - rb.ReturnDesc("documentTypes", "Current list of document types"); - //------------------------------------------------------------------------- - rb.DefineMethod("proton.listSchema", "s", "SSSS", true, - FRT_METHOD(RPCHooksBase::rpc_listSchema), this); - rb.MethodDesc("Get the current schema for given document type"); - rb.ParamDesc("documentType", "Document type name"); - rb.ReturnDesc("fieldNames", "Schema field names"); - rb.ReturnDesc("fieldDataTypes", "Schema field data types"); - rb.ReturnDesc("fieldCollTypes", "Schema field collection types"); - rb.ReturnDesc("fieldLocation", "Schema field locations"); - //------------------------------------------------------------------------- - rb.DefineMethod("proton.getConfigTime", "", "l", true, - FRT_METHOD(RPCHooksBase::rpc_getConfigGeneration), this); - rb.MethodDesc("Get the oldest active config generation"); - rb.ReturnDesc("configTime", "Oldest active config generation"); - //------------------------------------------------------------------------- - rb.DefineMethod("proton.getConfigGeneration", "", "l", true, - FRT_METHOD(RPCHooksBase::rpc_getConfigGeneration), this); - rb.MethodDesc("Get the oldest active config generation"); - rb.ReturnDesc("configTime", "Oldest active config generation"); - //------------------------------------------------------------------------- rb.DefineMethod("proton.getDocsums", "bix", "bix", true, FRT_METHOD(RPCHooksBase::rpc_getDocSums), this); rb.MethodDesc("Get list of document summaries"); rb.ParamDesc("encoding", "0=raw, 6=lz4"); @@ -443,96 +419,6 @@ RPCHooksBase::rpc_prepareRestart(FRT_RPCRequest *req) } void -RPCHooksBase::listDocTypes(FRT_RPCRequest *req) -{ - std::vector<string> documentTypes; - - _proton.listDocTypes(documentTypes); - - FRT_Values &ret = *req->GetReturn(); - FRT_StringValue *dt = ret.AddStringArray(documentTypes.size()); - for (uint32_t i = 0; i < documentTypes.size(); ++i) - ret.SetString(&dt[i], documentTypes[i].c_str()); - - LOG(info, - "RPCHooksBase::listDocTypes finished successfully"); - req->Return(); -} - - -void -RPCHooksBase::rpc_listDocTypes(FRT_RPCRequest *req) -{ - LOG(info, - "RPCHooksBase::rpc_listDocTypes started"); - req->Detach(); - letProtonDo(makeClosure(this, &RPCHooksBase::listDocTypes, req)); -} - - -void -RPCHooksBase::listSchema(FRT_RPCRequest *req) -{ - std::vector<string> fieldNames; - std::vector<string> fieldDataTypes; - std::vector<string> fieldCollectionTypes; - std::vector<string> fieldLocations; - - FRT_Values &arg = *req->GetParams(); - string documentType(arg[0]._string._str, arg[0]._string._len); - - _proton.listSchema(documentType, - fieldNames, fieldDataTypes, fieldCollectionTypes, - fieldLocations); - - FRT_Values &ret = *req->GetReturn(); - FRT_StringValue *fn = ret.AddStringArray(fieldNames.size()); - for (uint32_t i = 0; i < fieldNames.size(); ++i) - ret.SetString(&fn[i], fieldNames[i].c_str()); - - FRT_StringValue *fdt = ret.AddStringArray(fieldDataTypes.size()); - for (uint32_t i = 0; i < fieldDataTypes.size(); ++i) - ret.SetString(&fdt[i], fieldDataTypes[i].c_str()); - - FRT_StringValue *fct = ret.AddStringArray(fieldCollectionTypes.size()); - for (uint32_t i = 0; i < fieldCollectionTypes.size(); ++i) - ret.SetString(&fct[i], fieldCollectionTypes[i].c_str()); - - FRT_StringValue *fl = ret.AddStringArray(fieldLocations.size()); - for (uint32_t i = 0; i < fieldLocations.size(); ++i) - ret.SetString(&fl[i], fieldLocations[i].c_str()); - - LOG(info, - "RPCHooksBase::listSchema finished successfully"); - req->Return(); -} - - -void -RPCHooksBase::rpc_listSchema(FRT_RPCRequest *req) -{ - LOG(info, - "RPCHooksBase::rpc_listSchema started"); - req->Detach(); - letProtonDo(makeClosure(this, &RPCHooksBase::listSchema, req)); -} - - -void -RPCHooksBase::getConfigGeneration(FRT_RPCRequest *req) -{ - int64_t configGeneration = _proton.getConfigGeneration(); - FRT_Values &ret = *req->GetReturn(); - ret.AddInt64(configGeneration); - - LOG(info, - "RPCHooksBase::getConfigGeneration finished successfully, " - "configGeneration=%" PRId64, - configGeneration); - req->Return(); -} - -void RPCHooksBase::rpc_getDocSums(FRT_RPCRequest *req) { LOG(debug, "proton.getDocsums()"); @@ -547,16 +433,6 @@ RPCHooksBase::getDocsums(FRT_RPCRequest *req) req->Return(); } -void -RPCHooksBase::rpc_getConfigGeneration(FRT_RPCRequest *req) -{ - LOG(info, - "RPCHooksBase::rpc_getConfigGeneration started"); - req->Detach(); - letProtonDo(makeClosure(this, &RPCHooksBase::getConfigGeneration, req)); -} - - const RPCHooksBase::Session::SP & RPCHooksBase::getSession(FRT_RPCRequest *req) { diff --git a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h index 1dd92922a36..0af5eeaed77 100644 --- a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h +++ b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h @@ -79,9 +79,6 @@ private: void checkState(StateArg::UP arg); void reportState(Session & session, FRT_RPCRequest * req) __attribute__((noinline)); void getProtonStatus(FRT_RPCRequest * req); - void listDocTypes(FRT_RPCRequest *req); - void listSchema(FRT_RPCRequest *req); - void getConfigGeneration(FRT_RPCRequest *req); void getDocsums(FRT_RPCRequest *req); static const Session::SP & getSession(FRT_RPCRequest *req); @@ -115,9 +112,6 @@ public: void rpc_die(FRT_RPCRequest *req); void rpc_triggerFlush(FRT_RPCRequest *req); void rpc_prepareRestart(FRT_RPCRequest *req); - void rpc_listDocTypes(FRT_RPCRequest *req); - void rpc_listSchema(FRT_RPCRequest *req); - void rpc_getConfigGeneration(FRT_RPCRequest *req); void rpc_getDocSums(FRT_RPCRequest *req); void initSession(FRT_RPCRequest *req); |