aboutsummaryrefslogtreecommitdiffstats
path: root/searchcorespi
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2016-09-02 14:57:08 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2016-09-02 14:57:08 +0000
commit0020a4283b1d89b56c9b84e8a5c2f28754f64220 (patch)
treecdcb6ecb778cead510a43b9def8c3a9e1e6105f0 /searchcorespi
parent6b78066dabd2ecaba25e66832d18ad0dc1697867 (diff)
Add config option to warm up with unpacking too.
Diffstat (limited to 'searchcorespi')
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp6
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h1
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/indexmaintainerconfig.cpp4
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/indexmaintainerconfig.h19
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.cpp14
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.h5
6 files changed, 34 insertions, 15 deletions
diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp
index c8c7fd180a9..1d726a61807 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp
+++ b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp
@@ -374,7 +374,8 @@ IndexMaintainer::swapInNewIndex(LockGuard & guard,
indexes,
static_cast<IDiskIndex &>(source),
_ctx.getWarmupExecutor(),
- *this);
+ *this,
+ _unpackAtWarmup);
} else {
LOG(debug, "No warmup needed as it is a memory index that is mapped in.");
}
@@ -790,7 +791,8 @@ IndexMaintainer::IndexMaintainer(const IndexMaintainerConfig &config,
const IndexMaintainerContext &ctx,
IIndexMaintainerOperations &operations)
: _base_dir(config.getBaseDir()),
- _diskIndexWarmupTime(config.getDiskIndexWarmupTime()),
+ _diskIndexWarmupTime(config.getWarmup().getDuration()),
+ _unpackAtWarmup(config.getWarmup().getUnpack()),
_active_indexes(new ActiveDiskIndexes()),
_layout(config.getBaseDir()),
_schema(config.getSchema()),
diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h
index 6e3b6fa9bdb..cdd87096287 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h
+++ b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h
@@ -88,6 +88,7 @@ class IndexMaintainer : public boost::noncopyable,
typedef search::queryeval::ISourceSelector ISourceSelector;
const vespalib::string _base_dir;
const double _diskIndexWarmupTime;
+ const bool _unpackAtWarmup;
ActiveDiskIndexes::SP _active_indexes;
IndexDiskLayout _layout;
Schema _schema; // Protected by SL + IUL
diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainerconfig.cpp b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainerconfig.cpp
index e2838434a1b..e1e88652bd4 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainerconfig.cpp
+++ b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainerconfig.cpp
@@ -12,13 +12,13 @@ namespace searchcorespi {
namespace index {
IndexMaintainerConfig::IndexMaintainerConfig(const vespalib::string &baseDir,
- double diskIndexWarmupTime,
+ WarmupConfig warmup,
size_t maxFlushed,
const Schema &schema,
const Schema &fusionSchema,
const TuneFileAttributes &tuneFileAttributes)
: _baseDir(baseDir),
- _diskIndexWarmupTime(diskIndexWarmupTime),
+ _warmup(warmup),
_maxFlushed(maxFlushed),
_schema(schema),
_fusionSchema(fusionSchema),
diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainerconfig.h b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainerconfig.h
index 7ee3e0337cc..4f7411b0e44 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainerconfig.h
+++ b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainerconfig.h
@@ -8,13 +8,24 @@
namespace searchcorespi {
namespace index {
+class WarmupConfig {
+public:
+ WarmupConfig() : _duration(0.0), _unpack(false) { }
+ WarmupConfig(double duration, bool unpack) : _duration(duration), _unpack(unpack) { }
+ double getDuration() const { return _duration; }
+ bool getUnpack() const { return _unpack; }
+private:
+ double _duration;
+ bool _unpack;
+};
+
/**
* Class that keeps the config used when constructing an index maintainer.
*/
class IndexMaintainerConfig {
private:
const vespalib::string _baseDir;
- const double _diskIndexWarmupTime;
+ const WarmupConfig _warmup;
const size_t _maxFlushed;
const search::index::Schema _schema;
const search::index::Schema _fusionSchema;
@@ -22,7 +33,7 @@ private:
public:
IndexMaintainerConfig(const vespalib::string &baseDir,
- double diskIndexWarmupTime,
+ WarmupConfig warmup,
size_t maxFlushed,
const search::index::Schema &schema,
const search::index::Schema &fusionSchema,
@@ -35,9 +46,7 @@ public:
return _baseDir;
}
- double getDiskIndexWarmupTime() const {
- return _diskIndexWarmupTime;
- }
+ WarmupConfig getWarmup() const { return _warmup; }
/**
* Returns the initial schema containing all current index fields.
diff --git a/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.cpp b/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.cpp
index 7d630a2c668..083db213a46 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.cpp
+++ b/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.cpp
@@ -26,14 +26,16 @@ WarmupIndexCollection::WarmupIndexCollection(double warmupSeconds,
ISearchableIndexCollection::SP next,
IndexSearchable & warmup,
vespalib::ThreadExecutor & executor,
- IWarmupDone & warmupDone) :
+ IWarmupDone & warmupDone,
+ bool doUnpack) :
_prev(prev),
_next(next),
_warmup(warmup),
_executor(executor),
_warmupDone(warmupDone),
_warmupEndTime(ClockSystem::now() + TimeStamp::Seconds(warmupSeconds)),
- _handledTerms()
+ _handledTerms(),
+ _doUnpack(doUnpack)
{
if (next->valid()) {
setCurrentIndex(next->getCurrentIndex());
@@ -72,8 +74,7 @@ WarmupIndexCollection::toString() const
WarmupIndexCollection::~WarmupIndexCollection()
{
if (_warmupEndTime != 0) {
- LOG(info,
- "Warmup aborted due to new state change or application shutdown");
+ LOG(info, "Warmup aborted due to new state change or application shutdown");
}
_executor.sync();
}
@@ -210,7 +211,10 @@ WarmupIndexCollection::WarmupTask::run()
_bluePrint->fetchPostings(true);
SearchIterator::UP it(_bluePrint->createSearch(*_matchData, true));
it->initFullRange();
- for (it->seek(0); !it->isAtEnd(); it->seek(it->getDocId()+1)) {
+ for (uint32_t docId = it->seekFirst(1); !it->isAtEnd(); docId = it->seekNext(docId+1)) {
+ if (_warmup.doUnpack()) {
+ it->unpack(docId);
+ }
}
} else {
LOG(debug, "Warmup has finished, ignoring task.");
diff --git a/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.h b/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.h
index 7457b676f31..426d0a778ce 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.h
+++ b/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.h
@@ -27,7 +27,8 @@ public:
ISearchableIndexCollection::SP next,
IndexSearchable & warmup,
vespalib::ThreadExecutor & executor,
- IWarmupDone & warmupDone);
+ IWarmupDone & warmupDone,
+ bool doUnpack);
~WarmupIndexCollection();
// Implements IIndexCollection
const ISourceSelector &getSourceSelector() const override;
@@ -56,6 +57,7 @@ public:
const ISearchableIndexCollection::SP & getNextIndexCollection() const { return _next; }
vespalib::string toString() const override;
+ bool doUnpack() const { return _doUnpack; }
private:
typedef search::fef::MatchData MatchData;
typedef search::queryeval::FakeRequestContext FakeRequestContext;
@@ -105,6 +107,7 @@ private:
typedef vespalib::hash_set<vespalib::string> TermMap;
typedef vespalib::hash_map<uint32_t, TermMap> FieldTermMap;
FieldTermMap _handledTerms;
+ bool _doUnpack;
};
} // namespace searchcorespi