blob: 5d61c86d48a27b0daf858f50c92be338e0f72956 (
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
/**
* \class storage::DistributorNode
* \ingroup storageserver
*
* \brief Class for setting up a distributor node.
*/
#pragma once
#include "distributornodecontext.h"
#include "storagenode.h"
#include "vespa/vespalib/util/jsonstream.h"
#include <vespa/storage/common/distributorcomponent.h>
#include <vespa/storageframework/generic/thread/tickingthread.h>
#include <mutex>
namespace storage {
namespace distributor { class DistributorStripePool; }
class IStorageChainBuilder;
class DistributorNode
: public StorageNode,
private UniqueTimeCalculator,
private NodeStateReporter
{
framework::TickingThreadPool::UP _threadPool;
std::unique_ptr<distributor::DistributorStripePool> _stripe_pool;
DistributorNodeContext& _context;
std::mutex _timestamp_mutex;
uint64_t _timestamp_second_counter;
uint32_t _intra_second_pseudo_usec_counter;
uint32_t _num_distributor_stripes;
std::unique_ptr<StorageLink> _retrievedCommunicationManager;
// If the current wall clock is more than the below number of seconds into the
// past when compared to the highest recorded wall clock second time stamp, abort
// the process. This is a sanity checking measure to prevent a process running
// on a wall clock that transiently is set far into the future from (hopefully)
// generating a massive amount of broken future timestamps.
constexpr static uint32_t SanityCheckMaxWallClockSecondSkew = 120;
public:
using UP = std::unique_ptr<DistributorNode>;
DistributorNode(const config::ConfigUri & configUri,
DistributorNodeContext&,
ApplicationGenerationFetcher& generationFetcher,
uint32_t num_distributor_stripes,
std::unique_ptr<StorageLink> communicationManager,
std::unique_ptr<IStorageChainBuilder> storage_chain_builder);
~DistributorNode() override;
const lib::NodeType& getNodeType() const override { return lib::NodeType::DISTRIBUTOR; }
ResumeGuard pause() override;
void handleConfigChange(vespa::config::content::core::StorDistributormanagerConfig&);
void handleConfigChange(vespa::config::content::core::StorVisitordispatcherConfig&);
private:
void report(vespalib::JsonStream &) const override { /* no-op */ }
void perform_post_chain_creation_init_steps() override { /* no-op */ }
void initializeNodeSpecific() override;
void createChain(IStorageChainBuilder &builder) override;
api::Timestamp generate_unique_timestamp() override;
/**
* Shut down necessary distributor-specific components before shutting
* down general content node components.
*/
void shutdownDistributor();
};
} // storage
|