Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frozen features #15610

Merged
merged 90 commits into from
Jan 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
be36dc9
initial commit
gnusi Jan 22, 2022
8e7581f
wip
gnusi Jan 23, 2022
2759bad
wip
gnusi Jan 23, 2022
f38bc68
wip
gnusi Jan 23, 2022
81caa1f
wip
gnusi Jan 23, 2022
de9be3f
wip
gnusi Jan 23, 2022
1b9c99c
Merge branch 'devel' of https://github.com/arangodb/arangodb into fea…
gnusi Jan 24, 2022
4ac869e
wip
gnusi Jan 24, 2022
44d4347
wip
gnusi Jan 24, 2022
81f4ddd
wip
gnusi Jan 24, 2022
ada8804
wip
gnusi Jan 24, 2022
01a7ba2
wip
gnusi Jan 24, 2022
e729dbe
wip
gnusi Jan 24, 2022
dab8961
Merge branch 'devel' of https://github.com/arangodb/arangodb into fea…
gnusi Jan 24, 2022
0a18808
Merge branch 'devel' of https://github.com/arangodb/arangodb into fea…
gnusi Jan 24, 2022
e74d1ac
wip
gnusi Jan 24, 2022
5a0702d
wip
gnusi Jan 25, 2022
485dc2f
wip
gnusi Jan 25, 2022
e228b3d
wip
gnusi Jan 25, 2022
cbf4f17
wip
gnusi Jan 25, 2022
0e82ce6
wip
gnusi Jan 25, 2022
9230c96
wip
gnusi Jan 25, 2022
c02365f
wip
gnusi Jan 25, 2022
9d212ed
wip
gnusi Jan 25, 2022
2a9e9e9
Merge branch 'devel' of https://github.com/arangodb/arangodb into fea…
gnusi Jan 25, 2022
e9e7c99
wip
gnusi Jan 25, 2022
0d2da9c
wip
gnusi Jan 26, 2022
1d97e72
wip
gnusi Jan 26, 2022
cc22221
wip
gnusi Jan 26, 2022
f4d4a1d
wip
gnusi Jan 26, 2022
dbb946c
wip
gnusi Jan 26, 2022
ce0a551
wip
gnusi Jan 26, 2022
482ef8f
wip
gnusi Jan 26, 2022
1db5cbf
wip
gnusi Jan 26, 2022
280a2f3
wip
gnusi Jan 26, 2022
5e1bd02
wip
gnusi Jan 26, 2022
871d34b
wip
gnusi Jan 26, 2022
21f15fb
wip
gnusi Jan 26, 2022
bc8b310
Merge branch 'devel' of https://github.com/arangodb/arangodb into fea…
gnusi Jan 26, 2022
1f19438
wip
gnusi Jan 26, 2022
f255f99
wip
gnusi Jan 26, 2022
9a1129b
wip
gnusi Jan 26, 2022
6e88128
get rid of virtual inheritance
gnusi Jan 26, 2022
7752ecf
wip
gnusi Jan 26, 2022
7d97ca8
wip
gnusi Jan 26, 2022
0ccbe4c
wip
gnusi Jan 26, 2022
5405acb
wup
gnusi Jan 27, 2022
5b687e9
wip
gnusi Jan 27, 2022
3da6cd8
wip
gnusi Jan 27, 2022
c544aea
wip
gnusi Jan 27, 2022
08e0796
wip
gnusi Jan 27, 2022
c270e77
wip
gnusi Jan 27, 2022
534937f
wip
gnusi Jan 27, 2022
5e57f80
Merge branch 'devel' of https://github.com/arangodb/arangodb into fea…
gnusi Jan 27, 2022
b0980e9
wip
gnusi Jan 27, 2022
a9849b1
wip
gnusi Jan 27, 2022
ad9eb7f
Merge branch 'devel' of https://github.com/arangodb/arangodb into fea…
gnusi Jan 28, 2022
9e04236
wip
gnusi Jan 28, 2022
23e648c
wip
gnusi Jan 28, 2022
5fb19ff
Merge branch 'devel' of https://github.com/arangodb/arangodb into fea…
gnusi Jan 28, 2022
4fc9103
finally made it to compile
gnusi Jan 28, 2022
2056192
wip
gnusi Jan 28, 2022
9494b11
wip
gnusi Jan 28, 2022
c05e8b0
wip
gnusi Jan 29, 2022
27af8bc
wip
gnusi Jan 29, 2022
f88645b
wip
gnusi Jan 29, 2022
f2db307
wip
gnusi Jan 29, 2022
f501bf9
wip
gnusi Jan 29, 2022
ff9127f
fix tests
gnusi Jan 29, 2022
7ed0620
wip
gnusi Jan 29, 2022
c2e1618
fix compilation
gnusi Jan 29, 2022
638c5e4
fix msvc build
gnusi Jan 29, 2022
6f87d04
remove unused code
gnusi Jan 30, 2022
5ee88e2
wip
gnusi Jan 30, 2022
404aeba
wip
gnusi Jan 30, 2022
e5b992e
wip
gnusi Jan 30, 2022
ae94da2
address review comments
gnusi Jan 30, 2022
00ddb31
wip
gnusi Jan 30, 2022
c4bcb4c
Merge branch 'devel' of https://github.com/arangodb/arangodb into fea…
gnusi Jan 30, 2022
fd95726
wip
gnusi Jan 30, 2022
79e73d8
wip
gnusi Jan 30, 2022
fc8a867
wip
gnusi Jan 30, 2022
7fee8ce
wip
gnusi Jan 31, 2022
0b0aa28
wip
gnusi Jan 31, 2022
db51706
wip
gnusi Jan 31, 2022
068bcf6
Merge branch 'devel' of https://github.com/arangodb/arangodb into fea…
gnusi Jan 31, 2022
a9d6128
wip
gnusi Jan 31, 2022
8f60724
Merge branch 'devel' of https://github.com/arangodb/arangodb into fea…
gnusi Jan 31, 2022
199f11b
wip
gnusi Jan 31, 2022
92ee15b
wip
gnusi Jan 31, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1365,6 +1365,7 @@ list(INSERT SYSTEM_LIBRARIES 0
${SYS_LIBS}
${CMAKE_DL_LIBS}
${CMAKE_THREAD_LIBS_INIT}
absl-static
)

add_subdirectory(lib)
Expand Down
10 changes: 4 additions & 6 deletions arangod/Actions/ActionFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,19 @@

#include "ActionFeature.h"

#include "Actions/actions.h"
#include "ApplicationFeatures/ApplicationServer.h"
#include "FeaturePhases/ClusterFeaturePhase.h"
#include "Actions/actions.h"
#include "ProgramOptions/ProgramOptions.h"
#include "ProgramOptions/Section.h"

using namespace arangodb::application_features;
using namespace arangodb::options;

namespace arangodb {

ActionFeature::ActionFeature(application_features::ApplicationServer& server)
: ApplicationFeature(server, "Action"), _allowUseDatabase(false) {
ActionFeature::ActionFeature(Server& server)
: ArangodFeature{server, *this}, _allowUseDatabase(false) {
setOptional(true);
startsAfter<ClusterFeaturePhase>();
startsAfter<application_features::ClusterFeaturePhase>();
}

void ActionFeature::collectOptions(std::shared_ptr<ProgramOptions> options) {
Expand Down
11 changes: 8 additions & 3 deletions arangod/Actions/ActionFeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,18 @@

#pragma once

#include "ApplicationFeatures/ApplicationFeature.h"
#include "RestServer/arangod.h"

namespace arangodb {
namespace application_features {
class ClusterFeaturePhase;
}

class ActionFeature final : public application_features::ApplicationFeature {
class ActionFeature final : public ArangodFeature {
public:
explicit ActionFeature(application_features::ApplicationServer& server);
static constexpr std::string_view name() noexcept { return "Action"; }

explicit ActionFeature(Server& server);

void collectOptions(std::shared_ptr<options::ProgramOptions>) override final;
void unprepare() override final;
Expand Down
7 changes: 4 additions & 3 deletions arangod/Actions/RestActionHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include "RestActionHandler.h"

#include "ApplicationFeatures/ApplicationServer.h"
#include "Actions/actions.h"
#include "Basics/StaticStrings.h"
#include "Basics/StringUtils.h"
Expand All @@ -34,9 +35,9 @@ using namespace arangodb;
using namespace arangodb::basics;
using namespace arangodb::rest;

RestActionHandler::RestActionHandler(
application_features::ApplicationServer& server, GeneralRequest* request,
GeneralResponse* response)
RestActionHandler::RestActionHandler(ArangodServer& server,
GeneralRequest* request,
GeneralResponse* response)
: RestVocbaseBaseHandler(server, request, response),
_action(TRI_LookupActionVocBase(request)),
_data(nullptr) {}
Expand Down
3 changes: 1 addition & 2 deletions arangod/Actions/RestActionHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
namespace arangodb {
class RestActionHandler : public RestVocbaseBaseHandler {
public:
RestActionHandler(application_features::ApplicationServer&, GeneralRequest*,
GeneralResponse*);
RestActionHandler(ArangodServer&, GeneralRequest*, GeneralResponse*);

public:
char const* name() const override final { return "RestActionHandler"; }
Expand Down
6 changes: 2 additions & 4 deletions arangod/Agency/AgencyComm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ network::Timeout AgencyCommHelper::defaultTimeout() {

std::string const AgencyComm::AGENCY_URL_PREFIX = "/_api/agency";

AgencyComm::AgencyComm(application_features::ApplicationServer& server)
AgencyComm::AgencyComm(ArangodServer& server)
: _server(server),
_agency_comm_request_time_ms(
_server.getFeature<arangodb::ClusterFeature>()
Expand Down Expand Up @@ -1067,9 +1067,7 @@ AgencyCommResult AgencyComm::sendTransactionWithFailover(
return result;
}

application_features::ApplicationServer& AgencyComm::server() {
return _server;
}
ArangodServer& AgencyComm::server() { return _server; }

bool AgencyComm::ensureStructureInitialized() {
LOG_TOPIC("748e2", TRACE, Logger::AGENCYCOMM)
Expand Down
7 changes: 4 additions & 3 deletions arangod/Agency/AgencyComm.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "Basics/Result.h"
#include "Network/types.h"
#include "Rest/CommonDefines.h"
#include "RestServer/arangod.h"
#include "Metrics/Fwd.h"

namespace arangodb {
Expand Down Expand Up @@ -584,7 +585,7 @@ class AgencyComm {
static uint64_t const MAX_SLEEP_TIME = 50000; // microseconds

public:
explicit AgencyComm(application_features::ApplicationServer&);
explicit AgencyComm(ArangodServer&);

AgencyCommResult sendServerState(double timeout);

Expand Down Expand Up @@ -648,7 +649,7 @@ class AgencyComm {
AgencyCommResult sendTransactionWithFailover(AgencyTransaction const&,
double timeout = 0.0);

application_features::ApplicationServer& server();
ArangodServer& server();

bool ensureStructureInitialized();

Expand All @@ -668,7 +669,7 @@ class AgencyComm {
bool shouldInitializeStructure();

private:
application_features::ApplicationServer& _server;
ArangodServer& _server;
metrics::Histogram<metrics::LogScale<uint64_t>>& _agency_comm_request_time_ms;
};
} // namespace arangodb
Expand Down
31 changes: 13 additions & 18 deletions arangod/Agency/AgencyFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include "Basics/application-exit.h"
#include "Cluster/ClusterFeature.h"
#include "Endpoint/Endpoint.h"
#include "FeaturePhases/FoxxFeaturePhase.h"
#include "IResearch/IResearchAnalyzerFeature.h"
#include "IResearch/IResearchFeature.h"
#include "Logger/Logger.h"
Expand All @@ -51,8 +50,8 @@ using namespace arangodb::rest;

namespace arangodb {

AgencyFeature::AgencyFeature(application_features::ApplicationServer& server)
: ApplicationFeature(server, "Agency"),
AgencyFeature::AgencyFeature(Server& server)
: ArangodFeature{server, *this},
_activated(false),
_size(1),
_poolSize(1),
Expand All @@ -69,11 +68,9 @@ AgencyFeature::AgencyFeature(application_features::ApplicationServer& server)
_supervisionOkThreshold(5.0),
_cmdLineTimings(false) {
setOptional(true);
startsAfter<FoxxFeaturePhase>();
startsAfter<application_features::FoxxFeaturePhase>();
}

AgencyFeature::~AgencyFeature() = default;

void AgencyFeature::collectOptions(std::shared_ptr<ProgramOptions> options) {
options->addSection("agency", "agency");

Expand Down Expand Up @@ -299,25 +296,23 @@ void AgencyFeature::validateOptions(std::shared_ptr<ProgramOptions> options) {
// - ArangoSearch: not needed by agency
// - IResearchAnalyzer: analyzers are not needed by agency
// - Action/Script/FoxxQueues/Frontend: Foxx and JavaScript APIs

std::vector<std::type_index> disabledFeatures(
{std::type_index(typeid(iresearch::IResearchFeature)),
std::type_index(typeid(iresearch::IResearchAnalyzerFeature)),
std::type_index(typeid(ActionFeature)),
std::type_index(typeid(FoxxFeature)),
std::type_index(typeid(FrontendFeature))});
{
server().disableFeatures(std::array{
ArangodServer::id<iresearch::IResearchFeature>(),
ArangodServer::id<iresearch::IResearchAnalyzerFeature>(),
ArangodServer::id<ActionFeature>(), ArangodServer::id<FoxxFeature>(),
ArangodServer::id<FrontendFeature>()});
}

if (!V8DealerFeature::javascriptRequestedViaOptions(options)) {
// specifying --console requires JavaScript, so we can only turn Javascript
// off if not requested

// console mode inactive. so we can turn off V8
disabledFeatures.emplace_back(std::type_index(typeid(ScriptFeature)));
disabledFeatures.emplace_back(std::type_index(typeid(V8PlatformFeature)));
disabledFeatures.emplace_back(std::type_index(typeid(V8DealerFeature)));
server().disableFeatures(std::array{ArangodServer::id<ScriptFeature>(),
ArangodServer::id<V8PlatformFeature>(),
ArangodServer::id<V8DealerFeature>()});
}

server().disableFeatures(disabledFeatures);
}

void AgencyFeature::prepare() {
Expand Down
13 changes: 9 additions & 4 deletions arangod/Agency/AgencyFeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,23 @@

#pragma once

#include "ApplicationFeatures/ApplicationFeature.h"
#include "Agency/Agent.h"
#include "RestServer/arangod.h"

namespace arangodb {
namespace application_features {
class FoxxFeaturePhase;
}

namespace consensus {
class Agent;
}

class AgencyFeature : public application_features::ApplicationFeature {
class AgencyFeature : public ArangodFeature {
public:
explicit AgencyFeature(application_features::ApplicationServer& server);
~AgencyFeature();
static constexpr std::string_view name() { return "Agency"; }

explicit AgencyFeature(Server& server);

void collectOptions(std::shared_ptr<options::ProgramOptions>) override final;
void validateOptions(std::shared_ptr<options::ProgramOptions>) override final;
Expand Down
35 changes: 17 additions & 18 deletions arangod/Agency/Agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,8 @@ std::string const privApiPrefix("/_api/agency_priv/");
std::string const NO_LEADER("");

/// Agent configuration
Agent::Agent(application_features::ApplicationServer& server,
config_t const& config)
: Thread(server, "Agent"),
Agent::Agent(ArangodServer& server, config_t const& config)
: arangodb::ServerThread<ArangodServer>(server, "Agent"),
_constituent(server),
_supervision(server),
_state(server),
Expand All @@ -109,29 +108,29 @@ Agent::Agent(application_features::ApplicationServer& server,
_ready(false),
_preparing(0),
_loaded(false),
_write_ok(_server.getFeature<arangodb::metrics::MetricsFeature>().add(
_write_ok(server.getFeature<arangodb::metrics::MetricsFeature>().add(
arangodb_agency_write_ok_total{})),
_write_no_leader(
_server.getFeature<arangodb::metrics::MetricsFeature>().add(
server.getFeature<arangodb::metrics::MetricsFeature>().add(
arangodb_agency_write_no_leader_total{})),
_read_ok(_server.getFeature<arangodb::metrics::MetricsFeature>().add(
_read_ok(server.getFeature<arangodb::metrics::MetricsFeature>().add(
arangodb_agency_read_ok_total{})),
_read_no_leader(
_server.getFeature<arangodb::metrics::MetricsFeature>().add(
server.getFeature<arangodb::metrics::MetricsFeature>().add(
arangodb_agency_read_no_leader_total{})),
_write_hist_msec(
_server.getFeature<arangodb::metrics::MetricsFeature>().add(
server.getFeature<arangodb::metrics::MetricsFeature>().add(
arangodb_agency_write_hist{})),
_commit_hist_msec(
_server.getFeature<arangodb::metrics::MetricsFeature>().add(
server.getFeature<arangodb::metrics::MetricsFeature>().add(
arangodb_agency_commit_hist{})),
_append_hist_msec(
_server.getFeature<arangodb::metrics::MetricsFeature>().add(
server.getFeature<arangodb::metrics::MetricsFeature>().add(
arangodb_agency_append_hist{})),
_compaction_hist_msec(
_server.getFeature<arangodb::metrics::MetricsFeature>().add(
server.getFeature<arangodb::metrics::MetricsFeature>().add(
arangodb_agency_compaction_hist{})),
_local_index(_server.getFeature<arangodb::metrics::MetricsFeature>().add(
_local_index(server.getFeature<arangodb::metrics::MetricsFeature>().add(
arangodb_agency_local_commit_index{})) {
_state.configure(this);
_constituent.configure(this);
Expand Down Expand Up @@ -591,7 +590,7 @@ priv_rpc_ret_t Agent::recvAppendEntriesRPC(term_t term,

/// Leader's append entries
void Agent::sendAppendEntriesRPC() {
auto const& nf = _server.getFeature<arangodb::NetworkFeature>();
auto const& nf = server().getFeature<arangodb::NetworkFeature>();
network::ConnectionPool* cp = nf.pool();

// _lastSent only accessed in main thread
Expand Down Expand Up @@ -694,7 +693,7 @@ void Agent::sendAppendEntriesRPC() {
}
index_t lowest = unconfirmed.front().index;

Store snapshot(_server, this, "snapshot");
Store snapshot(server(), this, "snapshot");
index_t snapshotIndex;
term_t snapshotTerm;

Expand Down Expand Up @@ -860,7 +859,7 @@ void Agent::sendEmptyAppendEntriesRPC(std::string const& followerId) {

index_t commitIndex = _commitIndex.load(std::memory_order_relaxed);

auto const& nf = _server.getFeature<arangodb::NetworkFeature>();
auto const& nf = server().getFeature<arangodb::NetworkFeature>();
network::ConnectionPool* cp = nf.pool();

// Send request
Expand Down Expand Up @@ -1060,8 +1059,8 @@ void Agent::activateAgency() {
/// Load persistent state called once
void Agent::load() {
arangodb::SystemDatabaseFeature::ptr vocbase =
_server.hasFeature<SystemDatabaseFeature>()
? _server.getFeature<SystemDatabaseFeature>().use()
server().hasFeature<SystemDatabaseFeature>()
? server().getFeature<SystemDatabaseFeature>().use()
: nullptr;
if (vocbase == nullptr) {
LOG_TOPIC("63e36", FATAL, Logger::AGENCY)
Expand Down Expand Up @@ -2387,7 +2386,7 @@ void Agent::emptyCbTrashBin() {
}

query_t Agent::buildDB(arangodb::consensus::index_t index) {
Store store(_server, this);
Store store(server(), this);
index_t oldIndex;
term_t term;
if (!_state.loadLastCompactedSnapshot(store, oldIndex, term)) {
Expand Down
7 changes: 4 additions & 3 deletions arangod/Agency/Agent.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,19 @@
#include "Futures/Promise.h"
#include "Basics/ConditionLocker.h"
#include "Basics/ReadWriteLock.h"
#include "RestServer/arangod.h"
#include "Metrics/Fwd.h"

struct TRI_vocbase_t;

namespace arangodb {
namespace consensus {

class Agent final : public arangodb::Thread, public AgentInterface {
class Agent final : public arangodb::ServerThread<ArangodServer>,
public AgentInterface {
public:
/// @brief Construct with program options
explicit Agent(application_features::ApplicationServer& server,
config_t const&);
explicit Agent(ArangodServer& server, config_t const&);

/// @brief Clean up
~Agent();
Expand Down
7 changes: 2 additions & 5 deletions arangod/Agency/AsyncAgencyComm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,12 +552,9 @@ void AsyncAgencyCommManager::reportRedirect(std::string const& endpoint,
}
}

application_features::ApplicationServer& AsyncAgencyCommManager::server() {
return _server;
}
ArangodServer& AsyncAgencyCommManager::server() { return _server; }

AsyncAgencyCommManager::AsyncAgencyCommManager(
application_features::ApplicationServer& server)
AsyncAgencyCommManager::AsyncAgencyCommManager(ArangodServer& server)
: _server(server) {}

const char* AGENCY_URL_READ = "/_api/agency/read";
Expand Down
Loading