Files
scylladb/init.cc
Calle Wilund 945d2f73b3 Main: Do not actually stop any services on exit.
* Issue the "stop" method on DB (flushed CL + tables (partially))
* Do hard exit (_exit) to escape destructors and sanity checks.

This patch is horrible but sort of a workaround for various interdepdency
shutdown issues. Until services can actually be turned off, this might be
a viable option.

Refs #293. I will not call it a fix.
2015-09-08 11:13:34 +02:00

54 lines
2.1 KiB
C++

/*
* Copyright (C) 2015 Cloudius Systems, Ltd.
*/
#include "init.hh"
#include "message/messaging_service.hh"
#include "gms/failure_detector.hh"
#include "gms/gossiper.hh"
#include "service/storage_service.hh"
future<> init_storage_service(distributed<database>& db) {
return service::init_storage_service(db).then([] {
// #293 - do not stop anything
//engine().at_exit([] { return service::deinit_storage_service(); });
});
}
future<> init_ms_fd_gossiper(sstring listen_address, db::seed_provider_type seed_provider, sstring cluster_name) {
const gms::inet_address listen(listen_address);
// Init messaging_service
return net::get_messaging_service().start(listen).then([]{
// #293 - do not stop anything
//engine().at_exit([] { return net::get_messaging_service().stop(); });
}).then([] {
// Init failure_detector
return gms::get_failure_detector().start().then([] {
// #293 - do not stop anything
//engine().at_exit([]{ return gms::get_failure_detector().stop(); });
});
}).then([listen_address, seed_provider, cluster_name] {
// Init gossiper
std::set<gms::inet_address> seeds;
if (seed_provider.parameters.count("seeds") > 0) {
size_t begin = 0;
size_t next = 0;
sstring seeds_str = seed_provider.parameters.find("seeds")->second;
while (begin < seeds_str.length() && begin != (next=seeds_str.find(",",begin))) {
seeds.emplace(gms::inet_address(seeds_str.substr(begin,next-begin)));
begin = next+1;
}
}
if (seeds.empty()) {
seeds.emplace(gms::inet_address("127.0.0.1"));
}
return gms::get_gossiper().start().then([seeds, cluster_name] {
auto& gossiper = gms::get_local_gossiper();
gossiper.set_seeds(seeds);
gossiper.set_cluster_name(cluster_name);
// #293 - do not stop anything
//engine().at_exit([]{ return gms::get_gossiper().stop(); });
});
});
}