[PATCH 0/7] Remove unused code here and there

9 views
Skip to first unread message

Pavel Emelyanov

<xemul@scylladb.com>
unread,
Jun 18, 2021, 1:22:56 PM6/18/21
to scylladb-dev@googlegroups.com, Pavel Emelyanov
Few randomly spotted dead code locations over past time.
Compile-test only.

branch: https://github.com/xemul/scylla/tree/br-remove-unused-stuff

Pavel Emelyanov (7):
distributed_loader: Remove unused load-prio manipulations
storage_service: Remove write-only _force_remove_completion
view_update_generator: Remove unused struct sstable_with_table
database: Remove few unused sharded<proxy> captures
schema_tables: Remove unused sharded<proxy> argument
feature: Remove unused friendship with gossiper
database: Remove unused forward declarations

database.hh | 2 --
db/view/view_update_generator.hh | 5 -----
distributed_loader.hh | 9 ---------
gms/feature.hh | 1 -
service/storage_service.hh | 1 -
database.cc | 4 ++--
db/schema_tables.cc | 7 +++----
distributed_loader.cc | 11 -----------
service/storage_service.cc | 3 ---
9 files changed, 5 insertions(+), 38 deletions(-)

--
2.20.1

Pavel Emelyanov

<xemul@scylladb.com>
unread,
Jun 18, 2021, 1:22:57 PM6/18/21
to scylladb-dev@googlegroups.com, Pavel Emelyanov
Mostly this was removed by 6dfeb107 (distributed_loader: remove unused
code).

Signed-off-by: Pavel Emelyanov <xe...@scylladb.com>
---
distributed_loader.hh | 9 ---------
distributed_loader.cc | 11 -----------
2 files changed, 20 deletions(-)

diff --git a/distributed_loader.hh b/distributed_loader.hh
index ab205e939e..613e53166c 100644
--- a/distributed_loader.hh
+++ b/distributed_loader.hh
@@ -83,15 +83,6 @@ class distributed_loader {
static future<> init_system_keyspace(distributed<database>& db);
static future<> ensure_system_table_directories(distributed<database>& db);
static future<> init_non_system_keyspaces(distributed<database>& db, distributed<service::storage_proxy>& proxy, distributed<service::migration_manager>& mm);
- /**
- * Marks a keyspace (by name) as "prioritized" on bootstrap.
- * This will effectively let it bypass concurrency control.
- * The only real use for this is to avoid certain chicken and
- * egg issues.
- *
- * May only be called pre-bootstrap on main shard.
- */
- static void mark_keyspace_as_load_prio(const sstring&);
private:
static future<> cleanup_column_family_temp_sst_dirs(sstring sstdir);
static future<> handle_sstables_pending_delete(sstring pending_deletes_dir);
diff --git a/distributed_loader.cc b/distributed_loader.cc
index f0a00c2d59..8075875992 100644
--- a/distributed_loader.cc
+++ b/distributed_loader.cc
@@ -46,15 +46,6 @@ static const std::unordered_set<std::string_view> system_keyspaces = {
db::system_keyspace::NAME, db::schema_tables::NAME
};

-// Not super nice. Adding statefulness to the file.
-static std::unordered_set<sstring> load_prio_keyspaces;
-static bool population_started = false;
-
-void distributed_loader::mark_keyspace_as_load_prio(const sstring& ks) {
- assert(!population_started);
- load_prio_keyspaces.insert(ks);
-}
-
bool is_system_keyspace(std::string_view name) {
return system_keyspaces.contains(name);
}
@@ -633,8 +624,6 @@ future<> distributed_loader::populate_keyspace(distributed<database>& db, sstrin
}

future<> distributed_loader::init_system_keyspace(distributed<database>& db) {
- population_started = true;
-
return seastar::async([&db] {
// We need to init commitlog on shard0 before it is inited on other shards
// because it obtains the list of pre-existing segments for replay, which must
--
2.20.1

Pavel Emelyanov

<xemul@scylladb.com>
unread,
Jun 18, 2021, 1:22:58 PM6/18/21
to scylladb-dev@googlegroups.com, Pavel Emelyanov
This boolean became effectively unused after 829b4c14 (repair:
Make removenode safe by default)

Signed-off-by: Pavel Emelyanov <xe...@scylladb.com>
---
service/storage_service.hh | 1 -
service/storage_service.cc | 3 ---
2 files changed, 4 deletions(-)

diff --git a/service/storage_service.hh b/service/storage_service.hh
index ffa2e684f8..64f00b0b91 100644
--- a/service/storage_service.hh
+++ b/service/storage_service.hh
@@ -188,7 +188,6 @@ class storage_service : public service::migration_listener, public gms::i_endpoi
// ever arise.
bool _loading_new_sstables = false;
sstring _operation_in_progress;
- bool _force_remove_completion = false;
bool _ms_stopped = false;
bool _stream_manager_stopped = false;
seastar::metrics::metric_groups _metrics;
diff --git a/service/storage_service.cc b/service/storage_service.cc
index ee71c24c07..b84217ce93 100644
--- a/service/storage_service.cc
+++ b/service/storage_service.cc
@@ -3633,10 +3633,7 @@ future<> storage_service::force_remove_completion() {
// This flag will make removenode stop waiting for the confirmation,
// wait it to complete
slogger.info("Operation removenode is in progress, wait for it to complete");
-
- ss._force_remove_completion = true;
sleep_abortable(std::chrono::seconds(1), ss._abort_source).get();
- ss._force_remove_completion = false;
}
ss._operation_in_progress = sstring("removenode_force");

--
2.20.1

Pavel Emelyanov

<xemul@scylladb.com>
unread,
Jun 18, 2021, 1:22:59 PM6/18/21
to scylladb-dev@googlegroups.com, Pavel Emelyanov
Signed-off-by: Pavel Emelyanov <xe...@scylladb.com>
---
db/view/view_update_generator.hh | 5 -----
1 file changed, 5 deletions(-)

diff --git a/db/view/view_update_generator.hh b/db/view/view_update_generator.hh
index 8b9826cccc..8a162789e0 100644
--- a/db/view/view_update_generator.hh
+++ b/db/view/view_update_generator.hh
@@ -40,11 +40,6 @@ class view_update_generator {
future<> _started = make_ready_future<>();
seastar::condition_variable _pending_sstables;
named_semaphore _registration_sem{registration_queue_size, named_semaphore_exception_factory{"view update generator"}};
- struct sstable_with_table {
- sstables::shared_sstable sst;
- lw_shared_ptr<table> t;
- sstable_with_table(sstables::shared_sstable sst, lw_shared_ptr<table> t) : sst(std::move(sst)), t(std::move(t)) { }
- };
std::unordered_map<lw_shared_ptr<table>, std::vector<sstables::shared_sstable>> _sstables_with_tables;
std::unordered_map<lw_shared_ptr<table>, std::vector<sstables::shared_sstable>> _sstables_to_move;
metrics::metric_groups _metrics;
--
2.20.1

Pavel Emelyanov

<xemul@scylladb.com>
unread,
Jun 18, 2021, 1:23:00 PM6/18/21
to scylladb-dev@googlegroups.com, Pavel Emelyanov
Signed-off-by: Pavel Emelyanov <xe...@scylladb.com>
---
database.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/database.cc b/database.cc
index ff0c51ddc4..356f1a3650 100644
--- a/database.cc
+++ b/database.cc
@@ -776,7 +776,7 @@ future<> database::parse_system_tables(distributed<service::storage_proxy>& prox
auto ksm = create_keyspace_from_schema_partition(v);
return create_keyspace(ksm, true /* bootstrap. do not mark populated yet */, system_keyspace::no);
}).then([&proxy, this] {
- return do_parse_schema_tables(proxy, db::schema_tables::TYPES, [this, &proxy] (schema_result_value_type &v) {
+ return do_parse_schema_tables(proxy, db::schema_tables::TYPES, [this] (schema_result_value_type &v) {
auto& ks = this->find_keyspace(v.first);
auto&& user_types = create_types_from_schema_partition(*ks.metadata(), v.second);
for (auto&& type : user_types) {
@@ -785,7 +785,7 @@ future<> database::parse_system_tables(distributed<service::storage_proxy>& prox
return make_ready_future<>();
});
}).then([&proxy, this] {
- return do_parse_schema_tables(proxy, db::schema_tables::FUNCTIONS, [this, &proxy] (schema_result_value_type& v) {
+ return do_parse_schema_tables(proxy, db::schema_tables::FUNCTIONS, [this] (schema_result_value_type& v) {
auto&& user_functions = create_functions_from_schema_partition(*this, v.second);
for (auto&& func : user_functions) {
cql3::functions::functions::add_function(func);
--
2.20.1

Pavel Emelyanov

<xemul@scylladb.com>
unread,
Jun 18, 2021, 1:23:01 PM6/18/21
to scylladb-dev@googlegroups.com, Pavel Emelyanov
Signed-off-by: Pavel Emelyanov <xe...@scylladb.com>
---
db/schema_tables.cc | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/db/schema_tables.cc b/db/schema_tables.cc
index 6c162b5941..46543f3803 100644
--- a/db/schema_tables.cc
+++ b/db/schema_tables.cc
@@ -1369,8 +1369,7 @@ struct row_diff {
// Compute which rows have been created, dropped or altered.
// A row is identified by its primary key.
// In the output, all entries of a given keyspace are together.
-static row_diff diff_rows(
- distributed<service::storage_proxy>& proxy, const schema_result& before, const schema_result& after) {
+static row_diff diff_rows(const schema_result& before, const schema_result& after) {
auto diff = difference(before, after, indirect_equal_to<lw_shared_ptr<query::result_set>>());

// For new or empty keyspaces, just record each row.
@@ -1454,7 +1453,7 @@ static std::vector<user_type> create_types(database& db, const std::vector<const
// see the comments for merge_keyspaces()
[[nodiscard]] static user_types_to_drop merge_types(distributed<service::storage_proxy>& proxy, schema_result before, schema_result after)
{
- auto diff = diff_rows(proxy, before, after);
+ auto diff = diff_rows(before, after);

// Create and update user types before any tables/views are created that potentially
// use those types. Similarly, defer dropping until after tables/views that may use
@@ -1574,7 +1573,7 @@ static shared_ptr<cql3::functions::user_function> create_func(database& db, cons

static void merge_functions(distributed<service::storage_proxy>& proxy, schema_result before, schema_result after,
std::function<shared_ptr<cql3::functions::function>(database& db, const query::result_set_row& row)> create) {
- auto diff = diff_rows(proxy, before, after);
+ auto diff = diff_rows(before, after);

proxy.local().get_db().invoke_on_all([&diff, create] (database& db) {
for (const auto& val : diff.created) {
--
2.20.1

Pavel Emelyanov

<xemul@scylladb.com>
unread,
Jun 18, 2021, 1:23:02 PM6/18/21
to scylladb-dev@googlegroups.com, Pavel Emelyanov
Signed-off-by: Pavel Emelyanov <xe...@scylladb.com>
---
gms/feature.hh | 1 -
1 file changed, 1 deletion(-)

diff --git a/gms/feature.hh b/gms/feature.hh
index 071ff50c8f..d66f1bf27c 100644
--- a/gms/feature.hh
+++ b/gms/feature.hh
@@ -50,7 +50,6 @@ class feature final {
sstring _name;
bool _enabled = false;
mutable signal_type _s;
- friend class gossiper;
public:
using listener_registration = std::any;
class listener {
--
2.20.1

Pavel Emelyanov

<xemul@scylladb.com>
unread,
Jun 18, 2021, 1:23:03 PM6/18/21
to scylladb-dev@googlegroups.com, Pavel Emelyanov
Signed-off-by: Pavel Emelyanov <xe...@scylladb.com>
---
database.hh | 2 --
1 file changed, 2 deletions(-)

diff --git a/database.hh b/database.hh
index 3912c56833..a29713df6b 100644
--- a/database.hh
+++ b/database.hh
@@ -101,10 +101,8 @@ class feature_service;
namespace sstables {

class sstable;
-class entry_descriptor;
class compaction_descriptor;
class compaction_completion_desc;
-class foreign_sstable_open_info;
class sstables_manager;

}
--
2.20.1

Raphael S. Carvalho

<raphaelsc@scylladb.com>
unread,
Jun 18, 2021, 3:46:57 PM6/18/21
to Pavel Emelyanov, scylladb-dev
thanks Pavel!
> --
> You received this message because you are subscribed to the Google Groups "ScyllaDB development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to scylladb-dev...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/scylladb-dev/20210618172244.659-2-xemul%40scylladb.com.

Benny Halevy

<bhalevy@scylladb.com>
unread,
Jun 20, 2021, 2:48:31 AM6/20/21
to Pavel Emelyanov, scylladb-dev@googlegroups.com
LGTM

Commit Bot

<bot@cloudius-systems.com>
unread,
Jun 20, 2021, 5:02:19 AM6/20/21
to scylladb-dev@googlegroups.com, Pavel Emelyanov
From: Pavel Emelyanov <xe...@scylladb.com>
Committer: Pavel Emelyanov <xe...@scylladb.com>
Branch: next

distributed_loader: Remove unused load-prio manipulations

Mostly this was removed by 6dfeb107 (distributed_loader: remove unused
code).

Signed-off-by: Pavel Emelyanov <xe...@scylladb.com>

---
diff --git a/distributed_loader.cc b/distributed_loader.cc
--- a/distributed_loader.cc
+++ b/distributed_loader.cc
@@ -46,15 +46,6 @@ static const std::unordered_set<std::string_view> system_keyspaces = {
db::system_keyspace::NAME, db::schema_tables::NAME
};

-// Not super nice. Adding statefulness to the file.
-static std::unordered_set<sstring> load_prio_keyspaces;
-static bool population_started = false;
-
-void distributed_loader::mark_keyspace_as_load_prio(const sstring& ks) {
- assert(!population_started);
- load_prio_keyspaces.insert(ks);
-}
-
bool is_system_keyspace(std::string_view name) {
return system_keyspaces.contains(name);
}
@@ -633,8 +624,6 @@ future<> distributed_loader::populate_keyspace(distributed<database>& db, sstrin
}

future<> distributed_loader::init_system_keyspace(distributed<database>& db) {
- population_started = true;
-
return seastar::async([&db] {
// We need to init commitlog on shard0 before it is inited on other shards
// because it obtains the list of pre-existing segments for replay, which must
diff --git a/distributed_loader.hh b/distributed_loader.hh
--- a/distributed_loader.hh
+++ b/distributed_loader.hh
@@ -83,15 +83,6 @@ public:

Commit Bot

<bot@cloudius-systems.com>
unread,
Jun 20, 2021, 5:02:21 AM6/20/21
to scylladb-dev@googlegroups.com, Pavel Emelyanov
From: Pavel Emelyanov <xe...@scylladb.com>
Committer: Pavel Emelyanov <xe...@scylladb.com>
Branch: next

storage_service: Remove write-only _force_remove_completion

This boolean became effectively unused after 829b4c14 (repair:
Make removenode safe by default)

Signed-off-by: Pavel Emelyanov <xe...@scylladb.com>

---
diff --git a/service/storage_service.cc b/service/storage_service.cc
--- a/service/storage_service.cc
+++ b/service/storage_service.cc
@@ -3633,10 +3633,7 @@ future<> storage_service::force_remove_completion() {
// This flag will make removenode stop waiting for the confirmation,
// wait it to complete
slogger.info("Operation removenode is in progress, wait for it to complete");
-
- ss._force_remove_completion = true;
sleep_abortable(std::chrono::seconds(1), ss._abort_source).get();
- ss._force_remove_completion = false;
}
ss._operation_in_progress = sstring("removenode_force");

diff --git a/service/storage_service.hh b/service/storage_service.hh
--- a/service/storage_service.hh
+++ b/service/storage_service.hh
@@ -188,7 +188,6 @@ private:

Commit Bot

<bot@cloudius-systems.com>
unread,
Jun 20, 2021, 5:02:22 AM6/20/21
to scylladb-dev@googlegroups.com, Pavel Emelyanov
From: Pavel Emelyanov <xe...@scylladb.com>
Committer: Pavel Emelyanov <xe...@scylladb.com>
Branch: next

view_update_generator: Remove unused struct sstable_with_table

Signed-off-by: Pavel Emelyanov <xe...@scylladb.com>

---
diff --git a/db/view/view_update_generator.hh b/db/view/view_update_generator.hh
--- a/db/view/view_update_generator.hh
+++ b/db/view/view_update_generator.hh
@@ -40,11 +40,6 @@ private:

Commit Bot

<bot@cloudius-systems.com>
unread,
Jun 20, 2021, 5:02:23 AM6/20/21
to scylladb-dev@googlegroups.com, Pavel Emelyanov
From: Pavel Emelyanov <xe...@scylladb.com>
Committer: Pavel Emelyanov <xe...@scylladb.com>
Branch: next

database: Remove few unused sharded<proxy> captures

Signed-off-by: Pavel Emelyanov <xe...@scylladb.com>

---
diff --git a/database.cc b/database.cc

Commit Bot

<bot@cloudius-systems.com>
unread,
Jun 20, 2021, 5:02:24 AM6/20/21
to scylladb-dev@googlegroups.com, Pavel Emelyanov
From: Pavel Emelyanov <xe...@scylladb.com>
Committer: Pavel Emelyanov <xe...@scylladb.com>
Branch: next

schema_tables: Remove unused sharded<proxy> argument

Signed-off-by: Pavel Emelyanov <xe...@scylladb.com>

---
diff --git a/db/schema_tables.cc b/db/schema_tables.cc

Commit Bot

<bot@cloudius-systems.com>
unread,
Jun 20, 2021, 5:02:25 AM6/20/21
to scylladb-dev@googlegroups.com, Pavel Emelyanov
From: Pavel Emelyanov <xe...@scylladb.com>
Committer: Pavel Emelyanov <xe...@scylladb.com>
Branch: next

feature: Remove unused friendship with gossiper

Signed-off-by: Pavel Emelyanov <xe...@scylladb.com>

---
diff --git a/gms/feature.hh b/gms/feature.hh

Commit Bot

<bot@cloudius-systems.com>
unread,
Jun 20, 2021, 5:02:26 AM6/20/21
to scylladb-dev@googlegroups.com, Pavel Emelyanov
From: Pavel Emelyanov <xe...@scylladb.com>
Committer: Pavel Emelyanov <xe...@scylladb.com>
Branch: next

database: Remove unused forward declarations

Signed-off-by: Pavel Emelyanov <xe...@scylladb.com>

---
diff --git a/database.hh b/database.hh

Commit Bot

<bot@cloudius-systems.com>
unread,
Jun 20, 2021, 8:58:20 AM6/20/21
to scylladb-dev@googlegroups.com, Pavel Emelyanov
From: Pavel Emelyanov <xe...@scylladb.com>
Committer: Pavel Emelyanov <xe...@scylladb.com>
Branch: master

distributed_loader: Remove unused load-prio manipulations

Mostly this was removed by 6dfeb107 (distributed_loader: remove unused
code).

Signed-off-by: Pavel Emelyanov <xe...@scylladb.com>

---

Commit Bot

<bot@cloudius-systems.com>
unread,
Jun 20, 2021, 8:58:21 AM6/20/21
to scylladb-dev@googlegroups.com, Pavel Emelyanov
From: Pavel Emelyanov <xe...@scylladb.com>
Committer: Pavel Emelyanov <xe...@scylladb.com>
Branch: master

storage_service: Remove write-only _force_remove_completion

This boolean became effectively unused after 829b4c14 (repair:
Make removenode safe by default)

Signed-off-by: Pavel Emelyanov <xe...@scylladb.com>

---

Commit Bot

<bot@cloudius-systems.com>
unread,
Jun 20, 2021, 8:58:22 AM6/20/21
to scylladb-dev@googlegroups.com, Pavel Emelyanov
From: Pavel Emelyanov <xe...@scylladb.com>
Committer: Pavel Emelyanov <xe...@scylladb.com>
Branch: master

view_update_generator: Remove unused struct sstable_with_table

Signed-off-by: Pavel Emelyanov <xe...@scylladb.com>

---

Commit Bot

<bot@cloudius-systems.com>
unread,
Jun 20, 2021, 8:58:25 AM6/20/21
to scylladb-dev@googlegroups.com, Pavel Emelyanov
From: Pavel Emelyanov <xe...@scylladb.com>
Committer: Pavel Emelyanov <xe...@scylladb.com>
Branch: master

schema_tables: Remove unused sharded<proxy> argument

Signed-off-by: Pavel Emelyanov <xe...@scylladb.com>

---

Commit Bot

<bot@cloudius-systems.com>
unread,
Jun 20, 2021, 8:58:26 AM6/20/21
to scylladb-dev@googlegroups.com, Pavel Emelyanov
From: Pavel Emelyanov <xe...@scylladb.com>
Committer: Pavel Emelyanov <xe...@scylladb.com>
Branch: master

feature: Remove unused friendship with gossiper

Signed-off-by: Pavel Emelyanov <xe...@scylladb.com>

---

Commit Bot

<bot@cloudius-systems.com>
unread,
Jun 20, 2021, 8:58:26 AM6/20/21
to scylladb-dev@googlegroups.com, Pavel Emelyanov
From: Pavel Emelyanov <xe...@scylladb.com>
Committer: Pavel Emelyanov <xe...@scylladb.com>
Branch: master

database: Remove few unused sharded<proxy> captures

Signed-off-by: Pavel Emelyanov <xe...@scylladb.com>

---

Commit Bot

<bot@cloudius-systems.com>
unread,
Jun 20, 2021, 8:58:27 AM6/20/21
to scylladb-dev@googlegroups.com, Pavel Emelyanov
From: Pavel Emelyanov <xe...@scylladb.com>
Committer: Pavel Emelyanov <xe...@scylladb.com>
Branch: master

database: Remove unused forward declarations

Signed-off-by: Pavel Emelyanov <xe...@scylladb.com>

---
Reply all
Reply to author
Forward
0 new messages