summaryrefslogtreecommitdiffstats
path: root/searchcorespi
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-11-18 14:30:35 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2019-11-18 14:30:35 +0000
commita65c5f165553d4b954151e671b770706a749b727 (patch)
tree6429f124ff8b109289fdb911d74cc2128a4c8393 /searchcorespi
parent24be87327ebbff702d113084b0ef87fd194c0ef4 (diff)
Specify UTC explicit
Diffstat (limited to 'searchcorespi')
-rw-r--r--searchcorespi/src/vespa/searchcorespi/flush/iflushtarget.h10
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/indexflushtarget.cpp11
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/indexfusiontarget.cpp28
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp6
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h18
5 files changed, 32 insertions, 41 deletions
diff --git a/searchcorespi/src/vespa/searchcorespi/flush/iflushtarget.h b/searchcorespi/src/vespa/searchcorespi/flush/iflushtarget.h
index aab16ab107f..6d3313b4cf2 100644
--- a/searchcorespi/src/vespa/searchcorespi/flush/iflushtarget.h
+++ b/searchcorespi/src/vespa/searchcorespi/flush/iflushtarget.h
@@ -38,7 +38,7 @@ public:
private:
vespalib::string _name;
- Type _type;
+ Type _type;
Component _component;
public:
@@ -57,10 +57,10 @@ public:
T _before;
T _after;
};
- typedef Gain<int64_t> MemoryGain;
- typedef Gain<int64_t> DiskGain;
- typedef search::SerialNum SerialNum;
- typedef fastos::TimeStamp Time;
+ using MemoryGain = Gain<int64_t>;
+ using DiskGain = Gain<int64_t>;
+ using SerialNum = search::SerialNum;
+ using Time = fastos::UTCTimeStamp;
/**
* Convenience typedefs.
diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexflushtarget.cpp b/searchcorespi/src/vespa/searchcorespi/index/indexflushtarget.cpp
index 3486f7167c0..e7bc26b8dd1 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/indexflushtarget.cpp
+++ b/searchcorespi/src/vespa/searchcorespi/index/indexflushtarget.cpp
@@ -8,8 +8,7 @@ LOG_SETUP(".searchcorespi.index.indexflushtarget");
using vespalib::makeClosure;
-namespace searchcorespi {
-namespace index {
+namespace searchcorespi::index {
IndexFlushTarget::IndexFlushTarget(IndexMaintainer &indexMaintainer)
: IFlushTarget("memoryindex.flush", Type::FLUSH, Component::INDEX),
@@ -22,7 +21,7 @@ IndexFlushTarget::IndexFlushTarget(IndexMaintainer &indexMaintainer)
_lastStats.setPathElementsToLog(7);
}
-IndexFlushTarget::~IndexFlushTarget() {}
+IndexFlushTarget::~IndexFlushTarget() = default;
IFlushTarget::MemoryGain
IndexFlushTarget::getApproxMemoryGain() const
@@ -38,7 +37,7 @@ IndexFlushTarget::getApproxDiskGain() const
bool
-IndexFlushTarget::needUrgentFlush(void) const
+IndexFlushTarget::needUrgentFlush() const
{
bool urgent = _numFrozenMemoryIndexes > _maxFrozenMemoryIndexes;
SerialNum flushedSerial = _indexMaintainer.getFlushedSerialNum();
@@ -80,6 +79,4 @@ IndexFlushTarget::getApproxBytesToWriteToDisk() const
}
}
-
-} // namespace index
-} // namespace searchcorespi
+}
diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexfusiontarget.cpp b/searchcorespi/src/vespa/searchcorespi/index/indexfusiontarget.cpp
index 4c01bf83779..a9b4531fe93 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/indexfusiontarget.cpp
+++ b/searchcorespi/src/vespa/searchcorespi/index/indexfusiontarget.cpp
@@ -17,16 +17,18 @@ private:
SerialNum _serialNum;
public:
Fusioner(IndexMaintainer &indexMaintainer, FlushStats &stats, SerialNum serialNum) :
- _indexMaintainer(indexMaintainer), _stats(stats), _serialNum(serialNum) {}
- virtual void run() override {
+ _indexMaintainer(indexMaintainer),
+ _stats(stats),
+ _serialNum(serialNum)
+ {}
+
+ void run() override {
vespalib::string outputFusionDir = _indexMaintainer.doFusion(_serialNum);
// the target must live until this task is done (handled by flush engine).
_stats.setPath(outputFusionDir);
}
- virtual SerialNum
- getFlushSerial(void) const override
- {
+ SerialNum getFlushSerial() const override {
return 0u; // Zero means that no tls syncing is needed
}
};
@@ -42,7 +44,7 @@ IndexFusionTarget::IndexFusionTarget(IndexMaintainer &indexMaintainer)
LOG(debug, "New target, Num flushed: %d, Disk usage: %" PRIu64, _fusionStats.numUnfused, _fusionStats.diskUsage);
}
-IndexFusionTarget::~IndexFusionTarget() {}
+IndexFusionTarget::~IndexFusionTarget() = default;
IFlushTarget::MemoryGain
IndexFusionTarget::getApproxMemoryGain() const
@@ -54,13 +56,7 @@ IFlushTarget::DiskGain
IndexFusionTarget::getApproxDiskGain() const
{
uint64_t diskUsageBefore = _fusionStats.diskUsage;
- uint64_t diskUsageGain =
- static_cast<uint64_t>((0.1 *
- (diskUsageBefore *
- std::max(0,
- static_cast<int>
- (_fusionStats.numUnfused - 1)
- ))));
+ uint64_t diskUsageGain = static_cast<uint64_t>((0.1 * (diskUsageBefore * std::max(0,static_cast<int>(_fusionStats.numUnfused - 1)))));
diskUsageGain = std::min(diskUsageGain, diskUsageBefore);
if (!_fusionStats._canRunFusion)
diskUsageGain = 0;
@@ -70,8 +66,7 @@ IndexFusionTarget::getApproxDiskGain() const
bool
IndexFusionTarget::needUrgentFlush() const
{
- bool urgent = _fusionStats.numUnfused > _fusionStats.maxFlushed &&
- _fusionStats._canRunFusion;
+ bool urgent = (_fusionStats.numUnfused > _fusionStats.maxFlushed) && (_fusionStats._canRunFusion);
LOG(debug, "Num flushed: %d Urgent: %d", _fusionStats.numUnfused, urgent);
return urgent;
}
@@ -93,7 +88,7 @@ IndexFusionTarget::getFlushedSerialNum() const
IFlushTarget::Task::UP
IndexFusionTarget::initFlush(SerialNum serialNum)
{
- return Task::UP(new Fusioner(_indexMaintainer, _lastStats, serialNum));
+ return std::make_unique<Fusioner>(_indexMaintainer, _lastStats, serialNum);
}
uint64_t
@@ -102,5 +97,4 @@ IndexFusionTarget::getApproxBytesToWriteToDisk() const
return _fusionStats.diskUsage;
}
-
}
diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp
index 083fe70969c..45bd2a52349 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp
+++ b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp
@@ -620,8 +620,8 @@ IndexMaintainer::doneFlush(FlushArgs *args, IDiskIndex::SP *disk_index) {
return false; // Must retry operation
}
_flush_serial_num = std::max(_flush_serial_num, args->flush_serial_num);
- fastos::TimeStamp timeStamp = search::FileKit::getModificationTime((*disk_index)->getIndexDir());
- _lastFlushTime = timeStamp.time() > _lastFlushTime.time() ? timeStamp : _lastFlushTime;
+ fastos::UTCTimeStamp timeStamp = search::FileKit::getModificationTime((*disk_index)->getIndexDir());
+ _lastFlushTime = timeStamp > _lastFlushTime ? timeStamp : _lastFlushTime;
const uint32_t old_id = args->old_absolute_id - _last_fusion_id;
replaceSource(old_id, *disk_index);
return true;
@@ -947,7 +947,7 @@ IndexMaintainer::initFlush(SerialNum serialNum, searchcorespi::FlushStats * stat
_lastFlushTime = fastos::ClockSystem::now();
LOG(debug, "No memory index to flush. Update serial number and flush time to current: "
"flushSerialNum(%" PRIu64 "), lastFlushTime(%f)",
- _flush_serial_num, _lastFlushTime.sec());
+ _flush_serial_num, _lastFlushTime.timeSinceEpoch().sec());
return FlushTask::UP();
}
SerialNum realSerialNum = args.flush_serial_num;
diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h
index e95613017fa..a1bf676e48f 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h
+++ b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h
@@ -87,14 +87,14 @@ class IndexMaintainer : public IIndexManager,
// _selector is protected by SL + IUL
ISourceSelector::SP _selector;
ISearchableIndexCollection::SP _source_list; // Protected by SL + NSL, only set by master thread
- uint32_t _last_fusion_id; // Protected by SL + IUL
- uint32_t _next_id; // Protected by SL + IUL
- uint32_t _current_index_id; // Protected by SL + IUL
- IMemoryIndex::SP _current_index; // Protected by SL + IUL
- bool _flush_empty_current_index;
- SerialNum _current_serial_num;// Protected by IUL
- SerialNum _flush_serial_num; // Protected by SL
- fastos::TimeStamp _lastFlushTime; // Protected by SL
+ uint32_t _last_fusion_id; // Protected by SL + IUL
+ uint32_t _next_id; // Protected by SL + IUL
+ uint32_t _current_index_id; // Protected by SL + IUL
+ IMemoryIndex::SP _current_index; // Protected by SL + IUL
+ bool _flush_empty_current_index;
+ SerialNum _current_serial_num;// Protected by IUL
+ SerialNum _flush_serial_num; // Protected by SL
+ fastos::UTCTimeStamp _lastFlushTime; // Protected by SL
// Extra frozen memory indexes. This list is empty unless new
// memory index has been added by force (due to config change or
// data structure limitations).
@@ -335,7 +335,7 @@ public:
uint32_t getNumFrozenMemoryIndexes() const;
uint32_t getMaxFrozenMemoryIndexes() const { return _maxFrozen; }
- fastos::TimeStamp getLastFlushTime() const { return _lastFlushTime; }
+ fastos::UTCTimeStamp getLastFlushTime() const { return _lastFlushTime; }
// Implements IIndexManager
void putDocument(uint32_t lid, const Document &doc, SerialNum serialNum) override;