diff options
author | Tor Egge <Tor.Egge@yahoo-inc.com> | 2017-03-17 14:26:36 +0000 |
---|---|---|
committer | Tor Egge <Tor.Egge@yahoo-inc.com> | 2017-03-17 14:26:36 +0000 |
commit | 3c7c0aadfc30d6348ffa61e4da66a742f415e0db (patch) | |
tree | e14fa019c12b11e3646ca2357cb039252cf9b72b /searchcorespi | |
parent | 467bc3bfff814aa6dd5756b0cf44d444b15ae47f (diff) |
Trim down schema in existing disk indexes when setting new schema, to
eliminate removed fields and fields with mismatching data type or collection
type.
Diffstat (limited to 'searchcorespi')
-rw-r--r-- | searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp | 11 | ||||
-rw-r--r-- | searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h | 1 |
2 files changed, 9 insertions, 3 deletions
diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp index 64a58da3757..c075e98e1fc 100644 --- a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp +++ b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp @@ -1182,8 +1182,8 @@ IndexMaintainer::getFlushTargets(void) void IndexMaintainer::setSchema(const Schema & schema, SerialNum serialNum) { - (void) serialNum; assert(_ctx.getThreadingService().master().isCurrentThread()); + internalWipeHistory(schema, serialNum); IMemoryIndex::SP new_index(_operations.createMemoryIndex(schema, _current_serial_num)); SetSchemaArgs args; @@ -1198,11 +1198,10 @@ IndexMaintainer::setSchema(const Schema & schema, SerialNum serialNum) } void -IndexMaintainer::wipeHistory(SerialNum wipeSerial) +IndexMaintainer::internalWipeHistory(const Schema &schema, SerialNum wipeSerial) { assert(_ctx.getThreadingService().master().isCurrentThread()); ISearchableIndexCollection::SP new_source_list; - const Schema schema = getSchema(); IIndexCollection::SP coll = getSourceCollection(); updateIndexSchemas(*coll, schema, wipeSerial); updateActiveFusionWipeTimeSchema(schema); @@ -1225,5 +1224,11 @@ IndexMaintainer::wipeHistory(SerialNum wipeSerial) } } +void +IndexMaintainer::wipeHistory(SerialNum wipeSerial) +{ + internalWipeHistory(getSchema(), wipeSerial); +} + } // namespace index } // namespace searchcorespi diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h index b242a4a0933..34c25632012 100644 --- a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h +++ b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h @@ -287,6 +287,7 @@ class IndexMaintainer : public IIndexManager, bool makeSureAllRemainingWarmupIsDone(ISearchableIndexCollection::SP keepAlive); void scheduleCommit(); void commit(); + void internalWipeHistory(const Schema &schema, SerialNum wipeSerial); public: IndexMaintainer(const IndexMaintainer &) = delete; |