Skip to content

Commit

Permalink
database: rename column_family to table
Browse files Browse the repository at this point in the history
The name "column_family" is both awkward and obsolete. Rename to
the modern and accurate "table".

An alias is kept to avoid huge code churn.

To prevent a One Definition Rule violation, a preexisting "table"
type is moved to a new namespace row_cache_stress_test.

Tests: unit (release)
Message-Id: <20180624065238.26481-1-avi@scylladb.com>
  • Loading branch information
avikivity committed Jun 24, 2018
1 parent 2d41773 commit cb549c7
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 108 deletions.
3 changes: 2 additions & 1 deletion compaction_strategy.hh
Expand Up @@ -25,7 +25,8 @@
#include "exceptions/exceptions.hh"
#include "sstables/compaction_backlog_manager.hh"

class column_family;
class table;
using column_family = table;
class schema;
using schema_ptr = lw_shared_ptr<const schema>;

Expand Down
190 changes: 95 additions & 95 deletions database.cc

Large diffs are not rendered by default.

19 changes: 11 additions & 8 deletions database.hh
Expand Up @@ -291,7 +291,10 @@ public:
friend struct ser::serializer<cache_temperature>;
};

class column_family : public enable_lw_shared_from_this<column_family> {
class table;
using column_family = table;

class table : public enable_lw_shared_from_this<table> {
public:
struct config {
sstring datadir;
Expand Down Expand Up @@ -644,14 +647,14 @@ public:

logalloc::occupancy_stats occupancy() const;
private:
column_family(schema_ptr schema, config cfg, db::commitlog* cl, compaction_manager&, cell_locker_stats& cl_stats);
table(schema_ptr schema, config cfg, db::commitlog* cl, compaction_manager&, cell_locker_stats& cl_stats);
public:
column_family(schema_ptr schema, config cfg, db::commitlog& cl, compaction_manager& cm, cell_locker_stats& cl_stats)
: column_family(schema, std::move(cfg), &cl, cm, cl_stats) {}
column_family(schema_ptr schema, config cfg, no_commitlog, compaction_manager& cm, cell_locker_stats& cl_stats)
: column_family(schema, std::move(cfg), nullptr, cm, cl_stats) {}
column_family(column_family&&) = delete; // 'this' is being captured during construction
~column_family();
table(schema_ptr schema, config cfg, db::commitlog& cl, compaction_manager& cm, cell_locker_stats& cl_stats)
: table(schema, std::move(cfg), &cl, cm, cl_stats) {}
table(schema_ptr schema, config cfg, no_commitlog, compaction_manager& cm, cell_locker_stats& cl_stats)
: table(schema, std::move(cfg), nullptr, cm, cl_stats) {}
table(column_family&&) = delete; // 'this' is being captured during construction
~table();
const schema_ptr& schema() const { return _schema; }
void set_schema(schema_ptr);
db::commitlog* commitlog() { return _commitlog; }
Expand Down
3 changes: 2 additions & 1 deletion database_fwd.hh
Expand Up @@ -23,7 +23,8 @@

// database.hh
class database;
class column_family;
class table;
using column_family = table;
class memtable_list;

// mutation.hh
Expand Down
3 changes: 2 additions & 1 deletion sstables/compaction_manager.hh
Expand Up @@ -39,7 +39,8 @@
#include "compaction_backlog_manager.hh"
#include "backlog_controller.hh"

class column_family;
class table;
using column_family = table;
class compacting_sstable_registration;

// Compaction manager is a feature used to manage compaction jobs from multiple
Expand Down
1 change: 0 additions & 1 deletion sstables/compaction_weight_registration.hh
Expand Up @@ -23,7 +23,6 @@
#pragma once

class compaction_manager;
class column_family;

class compaction_weight_registration {
compaction_manager* _cm;
Expand Down
8 changes: 7 additions & 1 deletion tests/row_cache_stress_test.cc
Expand Up @@ -37,6 +37,8 @@ static thread_local bool cancelled = false;

using namespace std::chrono_literals;

namespace row_cache_stress_test {

struct table {
simple_schema s;
std::vector<dht::decorated_key> p_keys;
Expand Down Expand Up @@ -222,6 +224,10 @@ class monotonic_counter {
}
};

}

using namespace row_cache_stress_test;

int main(int argc, char** argv) {
namespace bpo = boost::program_options;
app_template app;
Expand All @@ -246,7 +252,7 @@ int main(int argc, char** argv) {
auto rows = app.configuration()["rows"].as<unsigned>();
auto seconds = app.configuration()["seconds"].as<unsigned>();

table t(partitions, rows);
row_cache_stress_test::table t(partitions, rows);

engine().at_exit([] {
cancelled = true;
Expand Down

0 comments on commit cb549c7

Please sign in to comment.