summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@yahoo-inc.com>2017-03-17 13:45:59 +0000
committerTor Egge <Tor.Egge@yahoo-inc.com>2017-03-17 13:45:59 +0000
commit4c4291043b03b292b7e9cbb44056d9388b2473f4 (patch)
treecb7a244ba920830f672b55943492cb90e596a957
parent8b8d2fd29f88296fc6b50074e9de7c6a237a6c4c (diff)
Add serial number to index maintainer setSchema method, to allow for
implicit immediate history wipe later on.
-rw-r--r--searchcore/src/tests/proton/index/indexmanager_test.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/index/indexmanager.h4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentdb.cpp6
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentdb.h2
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h2
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h2
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp3
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h2
-rw-r--r--searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h2
-rw-r--r--searchcore/src/vespa/searchcore/proton/test/mock_index_manager.h2
-rw-r--r--searchcorespi/src/tests/plugin/plugin.cpp2
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/iindexmanager.h2
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp3
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h2
15 files changed, 21 insertions, 19 deletions
diff --git a/searchcore/src/tests/proton/index/indexmanager_test.cpp b/searchcore/src/tests/proton/index/indexmanager_test.cpp
index 77d52d46cb4..b1081eb3338 100644
--- a/searchcore/src/tests/proton/index/indexmanager_test.cpp
+++ b/searchcore/src/tests/proton/index/indexmanager_test.cpp
@@ -694,7 +694,7 @@ TEST_F("require that wipeHistory updates schema on disk", Fixture) {
Schema empty_schema;
f.addDocument(docid);
f.flushIndexManager();
- f.runAsMaster([&]() { f._index_manager->setSchema(empty_schema); });
+ f.runAsMaster([&]() { f._index_manager->setSchema(empty_schema, 1000); });
f.addDocument(docid);
f.flushIndexManager();
diff --git a/searchcore/src/vespa/searchcore/proton/index/indexmanager.h b/searchcore/src/vespa/searchcore/proton/index/indexmanager.h
index b28df9fa02c..55f16047183 100644
--- a/searchcore/src/vespa/searchcore/proton/index/indexmanager.h
+++ b/searchcore/src/vespa/searchcore/proton/index/indexmanager.h
@@ -114,8 +114,8 @@ public:
return _maintainer.getFlushTargets();
}
- virtual void setSchema(const Schema &schema) {
- _maintainer.setSchema(schema);
+ virtual void setSchema(const Schema &schema, SerialNum serialNum) {
+ _maintainer.setSchema(schema, serialNum);
}
virtual void wipeHistory(SerialNum wipeSerial) {
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
index ff1724c30e8..61799861171 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
@@ -531,7 +531,7 @@ DocumentDB::applyConfig(DocumentDBConfig::SP configSnapshot,
}
}
if (params.shouldIndexManagerChange()) {
- setIndexSchema(*configSnapshot);
+ setIndexSchema(*configSnapshot, serialNum);
}
if (!fallbackConfig) {
if (_state.getRejectedConfig()) {
@@ -873,10 +873,10 @@ DocumentDB::flushDone(SerialNum flushedSerial)
}
void
-DocumentDB::setIndexSchema(const DocumentDBConfig &configSnapshot)
+DocumentDB::setIndexSchema(const DocumentDBConfig &configSnapshot, SerialNum serialNum)
{
// Called by executor thread
- _subDBs.getReadySubDB()->setIndexSchema(configSnapshot.getSchemaSP());
+ _subDBs.getReadySubDB()->setIndexSchema(configSnapshot.getSchemaSP(), serialNum);
// TODO: Adjust tune.
}
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.h b/searchcore/src/vespa/searchcore/proton/server/documentdb.h
index 43509cde8e3..ec1c7963dd8 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentdb.h
+++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.h
@@ -186,7 +186,7 @@ private:
reconfigureSchema(const DocumentDBConfig &configSnapshot,
const DocumentDBConfig &oldConfigSnapshot);
- void setIndexSchema(const DocumentDBConfig &configSnapshot);
+ void setIndexSchema(const DocumentDBConfig &configSnapshot, SerialNum serialNum);
/**
* Redo interrupted reprocessing if last entry in transaction log
diff --git a/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h b/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h
index 075e1068690..b0e73bc5c72 100644
--- a/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h
+++ b/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h
@@ -123,7 +123,7 @@ public:
*/
virtual SerialNum getNewestFlushedSerial() = 0;
virtual void wipeHistory(SerialNum wipeSerial, const Schema &wipeSchema) = 0;
- virtual void setIndexSchema(const SchemaSP &schema) = 0;
+ virtual void setIndexSchema(const SchemaSP &schema, SerialNum serialNum) = 0;
virtual search::SearchableStats getSearchableStats() const = 0;
virtual std::unique_ptr<IDocumentRetriever> getDocumentRetriever() = 0;
diff --git a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp
index 0c63b2d32e6..2713b61880b 100644
--- a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp
@@ -309,14 +309,14 @@ SearchableDocSubDB::wipeHistory(SerialNum wipeSerial,
}
void
-SearchableDocSubDB::setIndexSchema(const Schema::SP &schema)
+SearchableDocSubDB::setIndexSchema(const Schema::SP &schema, SerialNum serialNum)
{
assert(_writeService.master().isCurrentThread());
SearchView::SP oldSearchView = _rSearchView.get();
IFeedView::SP oldFeedView = _iFeedView.get();
- _indexMgr->setSchema(*schema);
+ _indexMgr->setSchema(*schema, serialNum);
reconfigureIndexSearchable();
}
diff --git a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h
index 5d4bdd9e64c..9d2b45fa3ac 100644
--- a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h
+++ b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h
@@ -155,7 +155,7 @@ public:
SerialNum getOldestFlushedSerial() override;
SerialNum getNewestFlushedSerial() override;
void wipeHistory(SerialNum wipeSerial, const Schema &wipeSchema) override;
- void setIndexSchema(const Schema::SP &schema) override;
+ void setIndexSchema(const Schema::SP &schema, SerialNum serialNum) override;
size_t getNumActiveDocs() const override;
search::SearchableStats getSearchableStats() const override ;
IDocumentRetriever::UP getDocumentRetriever() override;
diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp
index e1ed63dc8d8..06bcd509522 100644
--- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp
@@ -463,10 +463,11 @@ StoreOnlyDocSubDB::wipeHistory(SerialNum, const Schema &)
}
void
-StoreOnlyDocSubDB::setIndexSchema(const Schema::SP &schema)
+StoreOnlyDocSubDB::setIndexSchema(const Schema::SP &schema, SerialNum serialNum)
{
assert(_writeService.master().isCurrentThread());
(void) schema;
+ (void) serialNum;
}
search::SearchableStats
diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h
index 53dcb51643b..11b0db61576 100644
--- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h
+++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h
@@ -250,7 +250,7 @@ public:
SerialNum getNewestFlushedSerial() override;
void wipeHistory(SerialNum wipeSerial, const Schema &wipeSchema) override;
- void setIndexSchema(const Schema::SP &schema) override;
+ void setIndexSchema(const Schema::SP &schema, SerialNum serialNum) override;
search::SearchableStats getSearchableStats() const override;
IDocumentRetriever::UP getDocumentRetriever() override;
matching::MatchingStats getMatcherStats(const vespalib::string &rankProfile) const override;
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 05c63a4ef48..e2638b617b3 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
@@ -82,7 +82,7 @@ struct DummyDocumentSubDb : public IDocumentSubDB
SerialNum getOldestFlushedSerial() override { return 0; }
SerialNum getNewestFlushedSerial() override { return 0; }
void wipeHistory(SerialNum, const Schema &) override { }
- void setIndexSchema(const Schema::SP &) override { }
+ void setIndexSchema(const Schema::SP &, SerialNum) override { }
search::SearchableStats getSearchableStats() const override {
return search::SearchableStats();
}
diff --git a/searchcore/src/vespa/searchcore/proton/test/mock_index_manager.h b/searchcore/src/vespa/searchcore/proton/test/mock_index_manager.h
index b40b15eb429..34b246a1d1b 100644
--- a/searchcore/src/vespa/searchcore/proton/test/mock_index_manager.h
+++ b/searchcore/src/vespa/searchcore/proton/test/mock_index_manager.h
@@ -26,7 +26,7 @@ struct MockIndexManager : public IIndexManager
virtual searchcorespi::IFlushTarget::List getFlushTargets() override {
return searchcorespi::IFlushTarget::List();
}
- virtual void setSchema(const Schema &) override {}
+ virtual void setSchema(const Schema &, SerialNum) override {}
virtual void wipeHistory(SerialNum) override {}
virtual void heartBeat(SerialNum) override {}
};
diff --git a/searchcorespi/src/tests/plugin/plugin.cpp b/searchcorespi/src/tests/plugin/plugin.cpp
index 90aca88cdc6..eff33e69464 100644
--- a/searchcorespi/src/tests/plugin/plugin.cpp
+++ b/searchcorespi/src/tests/plugin/plugin.cpp
@@ -34,7 +34,7 @@ public:
searchcorespi::IFlushTarget::List l;
return l;
}
- virtual void setSchema(const Schema &) override { }
+ virtual void setSchema(const Schema &, SerialNum) override { }
virtual void wipeHistory(SerialNum) override { }
};
diff --git a/searchcorespi/src/vespa/searchcorespi/index/iindexmanager.h b/searchcorespi/src/vespa/searchcorespi/index/iindexmanager.h
index d4999a2dd1f..c2976699edb 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/iindexmanager.h
+++ b/searchcorespi/src/vespa/searchcorespi/index/iindexmanager.h
@@ -156,7 +156,7 @@ public:
*
* @param schema The new schema to start using.
**/
- virtual void setSchema(const Schema &schema) = 0;
+ virtual void setSchema(const Schema &schema, SerialNum serialNum) = 0;
/**
* Wipes remains of removed fields from this index manager.
diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp
index 642261fa4b5..76586bedf47 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp
+++ b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp
@@ -1180,8 +1180,9 @@ IndexMaintainer::getFlushTargets(void)
}
void
-IndexMaintainer::setSchema(const Schema & schema)
+IndexMaintainer::setSchema(const Schema & schema, SerialNum serialNum)
{
+ (void) serialNum;
assert(_ctx.getThreadingService().master().isCurrentThread());
IMemoryIndex::SP new_index(_operations.createMemoryIndex(schema, _current_serial_num));
SetSchemaArgs args;
diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h
index 3106b4ae374..b242a4a0933 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h
+++ b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h
@@ -381,7 +381,7 @@ public:
}
IFlushTarget::List getFlushTargets() override;
- void setSchema(const Schema & schema) override ;
+ void setSchema(const Schema & schema, SerialNum serialNum) override ;
void wipeHistory(SerialNum wipeSerial) override;
};