summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2021-09-13 17:36:45 +0200
committerTor Egge <Tor.Egge@online.no>2021-09-13 17:37:42 +0200
commitb9854217ba4dac2d0b4244b2ceb458cc55594efc (patch)
tree28262e395f2bc50cdffe7ed2564064f58e06eb27 /searchcore
parent92ad19102e936032fe61fa5a93bc88a2fc246a22 (diff)
Use uint32_t for node index and number of nodes.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/apps/vespa-feed-bm/vespa_feed_bm.cpp1
-rw-r--r--searchcore/src/vespa/searchcore/bmcluster/bm_cluster.cpp10
-rw-r--r--searchcore/src/vespa/searchcore/bmcluster/bm_cluster.h4
-rw-r--r--searchcore/src/vespa/searchcore/bmcluster/bm_cluster_controller.cpp6
-rw-r--r--searchcore/src/vespa/searchcore/bmcluster/bm_cluster_controller.h8
-rw-r--r--searchcore/src/vespa/searchcore/bmcluster/bm_node.cpp16
-rw-r--r--searchcore/src/vespa/searchcore/bmcluster/bm_node.h2
7 files changed, 25 insertions, 22 deletions
diff --git a/searchcore/src/apps/vespa-feed-bm/vespa_feed_bm.cpp b/searchcore/src/apps/vespa-feed-bm/vespa_feed_bm.cpp
index 940dcf35449..8ed74d4e92f 100644
--- a/searchcore/src/apps/vespa-feed-bm/vespa_feed_bm.cpp
+++ b/searchcore/src/apps/vespa-feed-bm/vespa_feed_bm.cpp
@@ -395,6 +395,7 @@ App::usage()
"[--indexing-sequencer [latency,throughput,adaptive]]\n"
"[--max-pending max-pending]\n"
"[--documents documents]\n"
+ "[--nodes nodes]\n"
"[--put-passes put-passes]\n"
"[--update-passes update-passes]\n"
"[--remove-passes remove-passes]\n"
diff --git a/searchcore/src/vespa/searchcore/bmcluster/bm_cluster.cpp b/searchcore/src/vespa/searchcore/bmcluster/bm_cluster.cpp
index 58011d9c67a..23f3f6d1e30 100644
--- a/searchcore/src/vespa/searchcore/bmcluster/bm_cluster.cpp
+++ b/searchcore/src/vespa/searchcore/bmcluster/bm_cluster.cpp
@@ -202,7 +202,7 @@ BmCluster::stop_rpc_client()
}
void
-BmCluster::make_node(unsigned int node_idx)
+BmCluster::make_node(uint32_t node_idx)
{
assert(node_idx < _nodes.size());
assert(!_nodes[node_idx]);
@@ -216,13 +216,13 @@ BmCluster::make_node(unsigned int node_idx)
void
BmCluster::make_nodes()
{
- for (unsigned int node_idx = 0; node_idx < _nodes.size(); ++node_idx) {
+ for (uint32_t node_idx = 0; node_idx < _nodes.size(); ++node_idx) {
make_node(node_idx);
}
}
BmNode&
-BmCluster::get_node(unsigned int node_idx)
+BmCluster::get_node(uint32_t node_idx)
{
assert(node_idx < _nodes.size());
assert(_nodes[node_idx]);
@@ -271,7 +271,7 @@ BmCluster::start_service_layers()
}
}
BmClusterController fake_controller(get_rpc_client(), _params.get_num_nodes());
- unsigned int node_idx = 0;
+ uint32_t node_idx = 0;
for (const auto &node : _nodes) {
if (node) {
fake_controller.set_cluster_up(node_idx, false);
@@ -294,7 +294,7 @@ BmCluster::start_distributors()
}
}
BmClusterController fake_controller(get_rpc_client(), _params.get_num_nodes());
- unsigned int node_idx = 0;
+ uint32_t node_idx = 0;
for (const auto &node : _nodes) {
if (node) {
fake_controller.set_cluster_up(node_idx, true);
diff --git a/searchcore/src/vespa/searchcore/bmcluster/bm_cluster.h b/searchcore/src/vespa/searchcore/bmcluster/bm_cluster.h
index 0e2e138ab08..f1978dfe0bc 100644
--- a/searchcore/src/vespa/searchcore/bmcluster/bm_cluster.h
+++ b/searchcore/src/vespa/searchcore/bmcluster/bm_cluster.h
@@ -70,9 +70,9 @@ public:
void stop();
storage::rpc::SharedRpcResources &get_rpc_client() { return *_rpc_client; }
BmMessageBus& get_message_bus() { return *_message_bus; }
- void make_node(unsigned int node_idx);
+ void make_node(uint32_t node_idx);
void make_nodes();
- BmNode& get_node(unsigned int node_idx);
+ BmNode& get_node(uint32_t node_idx);
IBmFeedHandler* get_feed_handler();
};
diff --git a/searchcore/src/vespa/searchcore/bmcluster/bm_cluster_controller.cpp b/searchcore/src/vespa/searchcore/bmcluster/bm_cluster_controller.cpp
index bdf4b5fed58..e4e85e0273f 100644
--- a/searchcore/src/vespa/searchcore/bmcluster/bm_cluster_controller.cpp
+++ b/searchcore/src/vespa/searchcore/bmcluster/bm_cluster_controller.cpp
@@ -19,7 +19,7 @@ namespace search::bmcluster {
namespace {
FRT_RPCRequest *
-make_set_cluster_state_request(unsigned int num_nodes)
+make_set_cluster_state_request(uint32_t num_nodes)
{
vespalib::asciistream s;
s << "version:2 distributor:" << num_nodes << " storage:" << num_nodes;
@@ -37,14 +37,14 @@ make_set_cluster_state_request(unsigned int num_nodes)
}
-BmClusterController::BmClusterController(SharedRpcResources& shared_rpc_resources_in, unsigned int num_nodes)
+BmClusterController::BmClusterController(SharedRpcResources& shared_rpc_resources_in, uint32_t num_nodes)
: _shared_rpc_resources(shared_rpc_resources_in),
_num_nodes(num_nodes)
{
}
void
-BmClusterController::set_cluster_up(unsigned int node_idx, bool distributor)
+BmClusterController::set_cluster_up(uint32_t node_idx, bool distributor)
{
static vespalib::string _storage("storage");
StorageMessageAddress storage_address(&_storage, distributor ? NodeType::DISTRIBUTOR : NodeType::STORAGE, node_idx);
diff --git a/searchcore/src/vespa/searchcore/bmcluster/bm_cluster_controller.h b/searchcore/src/vespa/searchcore/bmcluster/bm_cluster_controller.h
index 7b4313453f1..d3e261ab72f 100644
--- a/searchcore/src/vespa/searchcore/bmcluster/bm_cluster_controller.h
+++ b/searchcore/src/vespa/searchcore/bmcluster/bm_cluster_controller.h
@@ -2,6 +2,8 @@
#pragma once
+#include <cstdint>
+
namespace storage::api { class StorageMessageAddress; }
namespace storage::rpc { class SharedRpcResources; }
@@ -13,10 +15,10 @@ namespace search::bmcluster {
class BmClusterController
{
storage::rpc::SharedRpcResources& _shared_rpc_resources;
- unsigned int _num_nodes;
+ uint32_t _num_nodes;
public:
- BmClusterController(storage::rpc::SharedRpcResources& shared_rpc_resources_in, unsigned int num_nodes);
- void set_cluster_up(unsigned int node_idx, bool distributor);
+ BmClusterController(storage::rpc::SharedRpcResources& shared_rpc_resources_in, uint32_t num_nodes);
+ void set_cluster_up(uint32_t node_idx, bool distributor);
};
}
diff --git a/searchcore/src/vespa/searchcore/bmcluster/bm_node.cpp b/searchcore/src/vespa/searchcore/bmcluster/bm_node.cpp
index 84bd921620d..bc407321937 100644
--- a/searchcore/src/vespa/searchcore/bmcluster/bm_node.cpp
+++ b/searchcore/src/vespa/searchcore/bmcluster/bm_node.cpp
@@ -279,7 +279,7 @@ struct StorageConfigSet
SlobroksConfigBuilder slobroks;
MessagebusConfigBuilder messagebus;
- StorageConfigSet(const vespalib::string &base_dir, unsigned int node_idx, bool distributor, const vespalib::string& config_id_in, const DocumenttypesConfig& documenttypes_in,
+ StorageConfigSet(const vespalib::string &base_dir, uint32_t node_idx, bool distributor, const vespalib::string& config_id_in, const DocumenttypesConfig& documenttypes_in,
int slobrok_port, int mbus_port, int rpc_port, int status_port, const BmClusterParams& params)
: config_id(config_id_in),
documenttypes(documenttypes_in),
@@ -301,7 +301,7 @@ struct StorageConfigSet
{
StorDistributionConfigBuilder::Group group;
{
- for (unsigned int i = 0; i < params.get_num_nodes(); ++i) {
+ for (uint32_t i = 0; i < params.get_num_nodes(); ++i) {
StorDistributionConfigBuilder::Group::Nodes node;
node.index = i;
group.nodes.push_back(std::move(node));
@@ -364,7 +364,7 @@ struct ServiceLayerConfigSet : public StorageConfigSet
StorBucketInitConfigBuilder stor_bucket_init;
StorVisitorConfigBuilder stor_visitor;
- ServiceLayerConfigSet(const vespalib::string& base_dir, unsigned int node_idx, const vespalib::string& config_id_in, const DocumenttypesConfig& documenttypes_in,
+ ServiceLayerConfigSet(const vespalib::string& base_dir, uint32_t node_idx, const vespalib::string& config_id_in, const DocumenttypesConfig& documenttypes_in,
int slobrok_port, int mbus_port, int rpc_port, int status_port, const BmClusterParams& params)
: StorageConfigSet(base_dir, node_idx, false, config_id_in, documenttypes_in, slobrok_port, mbus_port, rpc_port, status_port, params),
persistence(),
@@ -395,7 +395,7 @@ struct DistributorConfigSet : public StorageConfigSet
StorDistributormanagerConfigBuilder stor_distributormanager;
StorVisitordispatcherConfigBuilder stor_visitordispatcher;
- DistributorConfigSet(const vespalib::string& base_dir, unsigned int node_idx, const vespalib::string& config_id_in, const DocumenttypesConfig& documenttypes_in,
+ DistributorConfigSet(const vespalib::string& base_dir, uint32_t node_idx, const vespalib::string& config_id_in, const DocumenttypesConfig& documenttypes_in,
int slobrok_port, int mbus_port, int rpc_port, int status_port, const BmClusterParams& params)
: StorageConfigSet(base_dir, node_idx, true, config_id_in, documenttypes_in, slobrok_port, mbus_port, rpc_port, status_port, params),
stor_distributormanager(),
@@ -428,7 +428,7 @@ class MyBmNode : public BmNode
std::shared_ptr<DocumentDBConfig> _document_db_config;
vespalib::string _base_dir;
search::index::DummyFileHeaderContext _file_header_context;
- unsigned int _node_idx;
+ uint32_t _node_idx;
int _tls_listen_port;
int _slobrok_port;
int _service_layer_mbus_port;
@@ -465,7 +465,7 @@ class MyBmNode : public BmNode
void create_document_db(const BmClusterParams& params);
public:
- MyBmNode(const vespalib::string &base_dir, int base_port, unsigned int node_idx, BmCluster& cluster, const BmClusterParams& params, std::shared_ptr<document::DocumenttypesConfig> document_types, int slobrok_port);
+ MyBmNode(const vespalib::string &base_dir, int base_port, uint32_t node_idx, BmCluster& cluster, const BmClusterParams& params, std::shared_ptr<document::DocumenttypesConfig> document_types, int slobrok_port);
~MyBmNode() override;
void initialize_persistence_provider() override;
void create_bucket(const document::Bucket& bucket) override;
@@ -482,7 +482,7 @@ public:
PersistenceProvider* get_persistence_provider() override;
};
-MyBmNode::MyBmNode(const vespalib::string& base_dir, int base_port, unsigned int node_idx, BmCluster& cluster, const BmClusterParams& params, std::shared_ptr<document::DocumenttypesConfig> document_types, int slobrok_port)
+MyBmNode::MyBmNode(const vespalib::string& base_dir, int base_port, uint32_t node_idx, BmCluster& cluster, const BmClusterParams& params, std::shared_ptr<document::DocumenttypesConfig> document_types, int slobrok_port)
: BmNode(),
_cluster(cluster),
_document_types(std::move(document_types)),
@@ -730,7 +730,7 @@ BmNode::num_ports()
}
std::unique_ptr<BmNode>
-BmNode::create(const vespalib::string& base_dir, int base_port, unsigned int node_idx, BmCluster &cluster, const BmClusterParams& params, std::shared_ptr<document::DocumenttypesConfig> document_types, int slobrok_port)
+BmNode::create(const vespalib::string& base_dir, int base_port, uint32_t node_idx, BmCluster &cluster, const BmClusterParams& params, std::shared_ptr<document::DocumenttypesConfig> document_types, int slobrok_port)
{
return std::make_unique<MyBmNode>(base_dir, base_port, node_idx, cluster, params, std::move(document_types), slobrok_port);
}
diff --git a/searchcore/src/vespa/searchcore/bmcluster/bm_node.h b/searchcore/src/vespa/searchcore/bmcluster/bm_node.h
index 3647981f58b..2287ac90dec 100644
--- a/searchcore/src/vespa/searchcore/bmcluster/bm_node.h
+++ b/searchcore/src/vespa/searchcore/bmcluster/bm_node.h
@@ -47,7 +47,7 @@ public:
virtual IBmFeedHandler* get_feed_handler() = 0;
virtual storage::spi::PersistenceProvider *get_persistence_provider() = 0;
static unsigned int num_ports();
- static std::unique_ptr<BmNode> create(const vespalib::string &base_dir, int base_port, unsigned int node_idx, BmCluster& cluster, const BmClusterParams& params, std::shared_ptr<const document::internal::InternalDocumenttypesType> document_types, int slobrok_port);
+ static std::unique_ptr<BmNode> create(const vespalib::string &base_dir, int base_port, uint32_t node_idx, BmCluster& cluster, const BmClusterParams& params, std::shared_ptr<const document::internal::InternalDocumenttypesType> document_types, int slobrok_port);
};
}