Skip to content

Commit

Permalink
Add the configuration for redis keyspace replication
Browse files Browse the repository at this point in the history
  • Loading branch information
fastio committed Apr 25, 2019
1 parent 49b573d commit 70a3368
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
11 changes: 11 additions & 0 deletions db/config.hh
Original file line number Diff line number Diff line change
Expand Up @@ -753,11 +753,22 @@ public:
val(cpu_scheduler, bool, true, Used, "Enable cpu scheduling") \
val(view_building, bool, true, Used, "Enable view building; should only be set to false when the node is experience issues due to view building") \
val(enable_sstables_mc_format, bool, false, Used, "Enable SSTables 'mc' format to be used as the default file format") \
val(enable_redis_protocol, bool, false, Used, "Enable redis protocol; Scylla will process redis protocol as a redis cluster if enable") \
val(redis_keyspace_replication_properties, string_map, /*none*/, Used, \
"Enable redis protocol, list of properties of replication of redis keyspace. The available options are:\n" \
"\n" \
"\tclass : (Default: SimpleStrategy ).\n" \
"\treplication_factor: (Default: 1) If the class is SimpleStrategy, set the replication factor for the strategy.\n" \
"\tdatacenter_i: (Default: 1) If the class is NetworkTopologyStrategy, set the replication factor per datacenter.\n" \
"\n" \
"The properties of replication for redis keyspace." \
) \
/* done! */

#define _make_value_member(name, type, deflt, status, desc, ...) \
named_value<type, value_status::status> name;

//val(redis_keyspace_replcation_factor_per_datacenter, string_map, /*none*/, Used, "The replication factor per datacenter")
_make_config_values(_make_value_member)

seastar::logging_settings logging_settings(const boost::program_options::variables_map&) const;
Expand Down
29 changes: 15 additions & 14 deletions main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ int main(int ac, char** av) {
seastar::sharded<service::cache_hitrate_calculator> cf_cache_hitrate_calculator;
debug::db = &db;
auto& qp = cql3::get_query_processor();
auto& redis_qp = redis::get_query_processor();
auto& proxy = service::get_storage_proxy();
auto& mm = service::get_migration_manager();
api::http_context ctx(db, proxy);
Expand Down Expand Up @@ -363,7 +362,7 @@ int main(int ac, char** av) {

tcp_syncookies_sanity();

return seastar::async([cfg, ext, &db, &qp, &redis_qp, &proxy, &mm, &ctx, &opts, &dirs, &pctx, &prometheus_server, &return_value, &cf_cache_hitrate_calculator] {
return seastar::async([cfg, ext, &db, &qp, &proxy, &mm, &ctx, &opts, &dirs, &pctx, &prometheus_server, &return_value, &cf_cache_hitrate_calculator] {
read_config(opts, *cfg).get();
configurable::init_all(opts, *cfg, *ext).get();

Expand Down Expand Up @@ -615,10 +614,7 @@ int main(int ac, char** av) {
, cfg->internode_compression()
, seed_provider
, memory::stats().total_memory()
, scfg
, cluster_name
, phi
, cfg->listen_on_broadcast_address());
, scfg , cluster_name , phi , cfg->listen_on_broadcast_address());
supervisor::notify("starting storage proxy");
service::storage_proxy::config spcfg;
spcfg.hinted_handoff_enabled = hinted_handoff_enabled;
Expand All @@ -634,8 +630,11 @@ int main(int ac, char** av) {
supervisor::notify("starting query processor");
cql3::query_processor::memory_config qp_mcfg = {memory::stats().total_memory() / 256, memory::stats().total_memory() / 2560};
qp.start(std::ref(proxy), std::ref(db), qp_mcfg).get();
supervisor::notify("starting redis query processor");
redis_qp.start(std::ref(proxy), std::ref(db)).get();
if (cfg->enable_redis_protocol()) {
supervisor::notify("starting redis query processor");
auto& redis_qp = redis::get_query_processor();
redis_qp.start(std::ref(proxy), std::ref(db)).get();
}
// #293 - do not stop anything
// engine().at_exit([&qp] { return qp.stop(); });
supervisor::notify("initializing batchlog manager");
Expand Down Expand Up @@ -814,12 +813,14 @@ int main(int ac, char** av) {
return service::get_local_storage_service().start_rpc_server();
}).get();
}
supervisor::notify("starting redis transport");
with_scheduling_group(dbcfg.statement_scheduling_group, [&cfg] {
return redis::redis_keyspace_helper::create_if_not_exists(cfg).then([] () {
return service::get_local_storage_service().start_redis_transport();
});
}).get();
if (cfg->enable_redis_protocol()) {
supervisor::notify("starting redis transport");
with_scheduling_group(dbcfg.statement_scheduling_group, [&cfg] {
return redis::redis_keyspace_helper::create_if_not_exists(cfg).then([] () {
return service::get_local_storage_service().start_redis_transport();
});
}).get();
}
if (cfg->defragment_memory_on_idle()) {
smp::invoke_on_all([] () {
engine().set_idle_cpu_handler([] (reactor::work_waiting_on_reactor check_for_work) {
Expand Down

0 comments on commit 70a3368

Please sign in to comment.