From 7e5abb509693d1f3ff16b11fd266bb2d02f27557 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Thu, 2 Sep 2021 17:29:38 +0300 Subject: [PATCH] main, scylla-gdb, cql-test-env: Unify debug::the_database All the debug:: inhabitants have their names look like "the_" This patch brings the database piece to this standard. Signed-off-by: Pavel Emelyanov --- debug.hh | 2 +- main.cc | 9 ++------- scylla-gdb.py | 7 ++++++- test/lib/cql_test_env.cc | 6 +++--- test/scylla-gdb/test.py | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/debug.hh b/debug.hh index 4fddb2d1a3..097168cbce 100644 --- a/debug.hh +++ b/debug.hh @@ -27,7 +27,7 @@ class database; namespace debug { -extern seastar::sharded* db; +extern seastar::sharded* the_database; } diff --git a/main.cc b/main.cc index c9608f5baf..956200ef68 100644 --- a/main.cc +++ b/main.cc @@ -409,6 +409,7 @@ sharded* the_query_processor; sharded* the_sl_controller; sharded* the_migration_manager; sharded* the_storage_service; +sharded* the_database; } int main(int ac, char** av) { @@ -485,7 +486,6 @@ int main(int ac, char** av) { distributed db; seastar::sharded cf_cache_hitrate_calculator; service::load_meter load_meter; - debug::db = &db; auto& proxy = service::get_storage_proxy(); sharded ss; sharded mm; @@ -867,6 +867,7 @@ int main(int ac, char** av) { // service_memory_limiter.stop().get(); }); + debug::the_database = &db; db.start(std::ref(*cfg), dbcfg, std::ref(mm_notifier), std::ref(feature_service), std::ref(token_metadata), std::ref(stop_signal.as_sharded_abort_source()), std::ref(sst_dir_semaphore)).get(); start_large_data_handler(db).get(); auto stop_database_and_sstables = defer_verbose_shutdown("database", [&db] { @@ -1456,9 +1457,3 @@ int main(int ac, char** av) { return 7; // 1 has a special meaning for upstart } } - -namespace debug { - -seastar::sharded* db; - -} diff --git a/scylla-gdb.py b/scylla-gdb.py index 76a15e032b..4d2db673cd 100755 --- a/scylla-gdb.py +++ b/scylla-gdb.py @@ -983,7 +983,12 @@ class sharded: def find_db(shard=None): - return sharded(gdb.parse_and_eval('::debug::db')).instance(shard) + try: + db = gdb.parse_and_eval('::debug::the_database') + except Exception as e: + db = gdb.parse_and_eval('::debug::db') + + return sharded(db).instance(shard) def find_dbs(): diff --git a/test/lib/cql_test_env.cc b/test/lib/cql_test_env.cc index a536cd1c8c..284ce0f450 100644 --- a/test/lib/cql_test_env.cc +++ b/test/lib/cql_test_env.cc @@ -464,9 +464,9 @@ public: abort_sources.start().get(); auto stop_abort_sources = defer([&] { abort_sources.stop().get(); }); sharded db; - debug::db = &db; + debug::the_database = &db; auto reset_db_ptr = defer([] { - debug::db = nullptr; + debug::the_database = nullptr; }); auto cfg = cfg_in.db_config; tmpdir data_dir; @@ -827,6 +827,6 @@ cql_test_config raft_cql_test_config() { namespace debug { -seastar::sharded* db; +seastar::sharded* the_database; } diff --git a/test/scylla-gdb/test.py b/test/scylla-gdb/test.py index bb3fa43d69..c2861c9194 100644 --- a/test/scylla-gdb/test.py +++ b/test/scylla-gdb/test.py @@ -28,7 +28,7 @@ do('break sstables::compact_sstables') do('ignore 1 10') do('run') -db = sharded(gdb.parse_and_eval('::debug::db')).local() +db = sharded(gdb.parse_and_eval('::debug::the_database')).local() gdb.set_convenience_variable('db', db) # now try some commands