blob: dafb50f7299cf0665dee5b0ce441ec9898f8d491 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "iflushstrategy.h"
#include <vespa/vespalib/stllike/string.h>
#include <map>
namespace proton {
/**
* Flush strategy that is used to find flush targets to be flushed before a restart.
*
* For each flush handler, flush targets are chosen such that the cost of flushing them +
* the cost of replaying the transaction log after replay is as low as possible.
*
* The cost of replaying the transaction log is: the number of bytes to replay * a replay speed factor.
* The cost of flushing a flush target is: the number of bytes to write * a write speed factor.
*/
class PrepareRestartFlushStrategy : public IFlushStrategy
{
public:
struct Config
{
double tlsReplayByteCost;
double tlsReplayOperationCost;
double flushTargetWriteCost;
Config(double tlsReplayByteCost_,
double tlsReplayOperationCost_,
double flushTargetWriteCost_);
};
private:
Config _cfg;
public:
PrepareRestartFlushStrategy(const Config &cfg);
virtual FlushContext::List getFlushTargets(const FlushContext::List &targetList,
const flushengine::TlsStatsMap &tlsStatsMap,
const flushengine::ActiveFlushStats&) const override;
};
} // namespace proton
|