Skip to content

Commit e956eb0

Browse files
Bustub to BusTub - Naming consistency (#725)
* Bustub to BusTub - Naming consistency * Changing Bustub to BusTub - other places
1 parent 3adc1c0 commit e956eb0

24 files changed

+128
-128
lines changed

src/common/bustub_ddl.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
namespace bustub {
4444

45-
void BustubInstance::HandleCreateStatement(Transaction *txn, const CreateStatement &stmt, ResultWriter &writer) {
45+
void BusTubInstance::HandleCreateStatement(Transaction *txn, const CreateStatement &stmt, ResultWriter &writer) {
4646
std::unique_lock<std::shared_mutex> l(catalog_lock_);
4747
auto info = catalog_->CreateTable(txn, stmt.table_, Schema(stmt.columns_));
4848
IndexInfo *index = nullptr;
@@ -85,7 +85,7 @@ void BustubInstance::HandleCreateStatement(Transaction *txn, const CreateStateme
8585
}
8686
}
8787

88-
void BustubInstance::HandleIndexStatement(Transaction *txn, const IndexStatement &stmt, ResultWriter &writer) {
88+
void BusTubInstance::HandleIndexStatement(Transaction *txn, const IndexStatement &stmt, ResultWriter &writer) {
8989
std::vector<uint32_t> col_ids;
9090
for (const auto &col : stmt.cols_) {
9191
auto idx = stmt.table_->schema_.GetColIdx(col->col_name_.back());
@@ -139,7 +139,7 @@ void BustubInstance::HandleIndexStatement(Transaction *txn, const IndexStatement
139139
WriteOneCell(fmt::format("Index created with id = {} with type = {}", info->index_oid_, info->index_type_), writer);
140140
}
141141

142-
void BustubInstance::HandleExplainStatement(Transaction *txn, const ExplainStatement &stmt, ResultWriter &writer) {
142+
void BusTubInstance::HandleExplainStatement(Transaction *txn, const ExplainStatement &stmt, ResultWriter &writer) {
143143
std::string output;
144144

145145
// Print binder result.
@@ -181,18 +181,18 @@ void BustubInstance::HandleExplainStatement(Transaction *txn, const ExplainState
181181
WriteOneCell(output, writer);
182182
}
183183

184-
void BustubInstance::HandleVariableShowStatement(Transaction *txn, const VariableShowStatement &stmt,
184+
void BusTubInstance::HandleVariableShowStatement(Transaction *txn, const VariableShowStatement &stmt,
185185
ResultWriter &writer) {
186186
auto content = GetSessionVariable(stmt.variable_);
187187
WriteOneCell(fmt::format("{}={}", stmt.variable_, content), writer);
188188
}
189189

190-
void BustubInstance::HandleVariableSetStatement(Transaction *txn, const VariableSetStatement &stmt,
190+
void BusTubInstance::HandleVariableSetStatement(Transaction *txn, const VariableSetStatement &stmt,
191191
ResultWriter &writer) {
192192
session_variables_[stmt.variable_] = stmt.value_;
193193
}
194194

195-
void BustubInstance::HandleTxnStatement(Transaction *txn, const TransactionStatement &stmt, ResultWriter &writer) {
195+
void BusTubInstance::HandleTxnStatement(Transaction *txn, const TransactionStatement &stmt, ResultWriter &writer) {
196196
if (managed_txn_mode_ && current_txn_ != nullptr) {
197197
BUSTUB_ASSERT(current_txn_ == txn, "txn mismatched??");
198198
}

src/common/bustub_instance.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@
4040

4141
namespace bustub {
4242

43-
auto BustubInstance::MakeExecutorContext(Transaction *txn, bool is_modify) -> std::unique_ptr<ExecutorContext> {
43+
auto BusTubInstance::MakeExecutorContext(Transaction *txn, bool is_modify) -> std::unique_ptr<ExecutorContext> {
4444
return std::make_unique<ExecutorContext>(txn, catalog_.get(), buffer_pool_manager_.get(), txn_manager_.get(),
4545
lock_manager_.get(), is_modify);
4646
}
4747

48-
BustubInstance::BustubInstance(const std::string &db_file_name, size_t bpm_size) {
48+
BusTubInstance::BusTubInstance(const std::string &db_file_name, size_t bpm_size) {
4949
enable_logging = false;
5050

5151
// Storage related.
@@ -98,7 +98,7 @@ BustubInstance::BustubInstance(const std::string &db_file_name, size_t bpm_size)
9898
execution_engine_ = std::make_unique<ExecutionEngine>(buffer_pool_manager_.get(), txn_manager_.get(), catalog_.get());
9999
}
100100

101-
BustubInstance::BustubInstance(size_t bpm_size) {
101+
BusTubInstance::BusTubInstance(size_t bpm_size) {
102102
enable_logging = false;
103103

104104
// Storage related.
@@ -149,7 +149,7 @@ BustubInstance::BustubInstance(size_t bpm_size) {
149149
execution_engine_ = std::make_unique<ExecutionEngine>(buffer_pool_manager_.get(), txn_manager_.get(), catalog_.get());
150150
}
151151

152-
void BustubInstance::CmdDbgMvcc(const std::vector<std::string> &params, ResultWriter &writer) {
152+
void BusTubInstance::CmdDbgMvcc(const std::vector<std::string> &params, ResultWriter &writer) {
153153
if (params.size() != 2) {
154154
writer.OneCell("please provide a table name");
155155
return;
@@ -165,7 +165,7 @@ void BustubInstance::CmdDbgMvcc(const std::vector<std::string> &params, ResultWr
165165
TxnMgrDbg("\\dbgmvcc", txn_manager_.get(), table_info, table_info->table_.get());
166166
}
167167

168-
void BustubInstance::CmdDisplayTables(ResultWriter &writer) {
168+
void BusTubInstance::CmdDisplayTables(ResultWriter &writer) {
169169
auto table_names = catalog_->GetTableNames();
170170
writer.BeginTable(false);
171171
writer.BeginHeader();
@@ -184,7 +184,7 @@ void BustubInstance::CmdDisplayTables(ResultWriter &writer) {
184184
writer.EndTable();
185185
}
186186

187-
void BustubInstance::CmdDisplayIndices(ResultWriter &writer) {
187+
void BusTubInstance::CmdDisplayIndices(ResultWriter &writer) {
188188
auto table_names = catalog_->GetTableNames();
189189
writer.BeginTable(false);
190190
writer.BeginHeader();
@@ -206,9 +206,9 @@ void BustubInstance::CmdDisplayIndices(ResultWriter &writer) {
206206
writer.EndTable();
207207
}
208208

209-
void BustubInstance::WriteOneCell(const std::string &cell, ResultWriter &writer) { writer.OneCell(cell); }
209+
void BusTubInstance::WriteOneCell(const std::string &cell, ResultWriter &writer) { writer.OneCell(cell); }
210210

211-
void BustubInstance::CmdDisplayHelp(ResultWriter &writer) {
211+
void BusTubInstance::CmdDisplayHelp(ResultWriter &writer) {
212212
std::string help = R"(Welcome to the BusTub shell!
213213
214214
\dt: show all tables
@@ -231,7 +231,7 @@ see the execution plan of your query.
231231
WriteOneCell(help, writer);
232232
}
233233

234-
auto BustubInstance::ExecuteSql(const std::string &sql, ResultWriter &writer,
234+
auto BusTubInstance::ExecuteSql(const std::string &sql, ResultWriter &writer,
235235
std::shared_ptr<CheckOptions> check_options) -> bool {
236236
bool is_local_txn = current_txn_ != nullptr;
237237
auto *txn = is_local_txn ? current_txn_ : txn_manager_->Begin();
@@ -251,7 +251,7 @@ auto BustubInstance::ExecuteSql(const std::string &sql, ResultWriter &writer,
251251
}
252252
}
253253

254-
auto BustubInstance::ExecuteSqlTxn(const std::string &sql, ResultWriter &writer, Transaction *txn,
254+
auto BusTubInstance::ExecuteSqlTxn(const std::string &sql, ResultWriter &writer, Transaction *txn,
255255
std::shared_ptr<CheckOptions> check_options) -> bool {
256256
if (!sql.empty() && sql[0] == '\\') {
257257
// Internal meta-commands, like in `psql`.
@@ -380,7 +380,7 @@ auto BustubInstance::ExecuteSqlTxn(const std::string &sql, ResultWriter &writer,
380380
* It's used in the shell to predefine some tables, as we don't support
381381
* create / drop table and insert for now. Should remove it in the future.
382382
*/
383-
void BustubInstance::GenerateTestTable() {
383+
void BusTubInstance::GenerateTestTable() {
384384
auto *txn = txn_manager_->Begin();
385385
auto exec_ctx = MakeExecutorContext(txn, false);
386386
TableGenerator gen{exec_ctx.get()};
@@ -397,7 +397,7 @@ void BustubInstance::GenerateTestTable() {
397397
* It's used in the shell to predefine some tables, as we don't support
398398
* create / drop table and insert for now. Should remove it in the future.
399399
*/
400-
void BustubInstance::GenerateMockTable() {
400+
void BusTubInstance::GenerateMockTable() {
401401
// The actual content generated by mock scan executors are described in `mock_scan_executor.cpp`.
402402
auto txn = txn_manager_->Begin();
403403

@@ -410,19 +410,19 @@ void BustubInstance::GenerateMockTable() {
410410
txn_manager_->Commit(txn);
411411
}
412412

413-
BustubInstance::~BustubInstance() {
413+
BusTubInstance::~BusTubInstance() {
414414
if (enable_logging) {
415415
log_manager_->StopFlushThread();
416416
}
417417
}
418418

419419
/** Enable managed txn mode on this BusTub instance, allowing statements like `BEGIN`. */
420-
void BustubInstance::EnableManagedTxn() { managed_txn_mode_ = true; }
420+
void BusTubInstance::EnableManagedTxn() { managed_txn_mode_ = true; }
421421

422422
/** Get the current transaction. */
423-
auto BustubInstance::CurrentManagedTxn() -> Transaction * { return current_txn_; }
423+
auto BusTubInstance::CurrentManagedTxn() -> Transaction * { return current_txn_; }
424424

425-
void BustubInstance::CmdTxn(const std::vector<std::string> &params, ResultWriter &writer) {
425+
void BusTubInstance::CmdTxn(const std::vector<std::string> &params, ResultWriter &writer) {
426426
if (!managed_txn_mode_) {
427427
writer.OneCell("only supported in managed mode, please use bustub-shell");
428428
return;

src/include/common/bustub_instance.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,19 +233,19 @@ class FortTableWriter : public ResultWriter {
233233
std::vector<std::string> tables_;
234234
};
235235

236-
class BustubInstance {
236+
class BusTubInstance {
237237
private:
238238
/**
239239
* Get the executor context from the BusTub instance.
240240
*/
241241
auto MakeExecutorContext(Transaction *txn, bool is_modify) -> std::unique_ptr<ExecutorContext>;
242242

243243
public:
244-
explicit BustubInstance(const std::string &db_file_name, size_t bpm_size = 128);
244+
explicit BusTubInstance(const std::string &db_file_name, size_t bpm_size = 128);
245245

246-
explicit BustubInstance(size_t bpm_size = 128);
246+
explicit BusTubInstance(size_t bpm_size = 128);
247247

248-
~BustubInstance();
248+
~BusTubInstance();
249249

250250
/**
251251
* Execute a SQL query in the BusTub instance.

src/planner/plan_window_function.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ auto Planner::PlanSelectWindow(const SelectStatement &statement, AbstractPlanNod
9898
if (window_call.start_ != WindowBoundary::UNBOUNDED_PRECEDING ||
9999
(window_call.end_ != WindowBoundary::CURRENT_ROW_ROWS &&
100100
window_call.end_ != WindowBoundary::CURRENT_ROW_RANGE)) {
101-
throw Exception("Bustub currently only support window function with default window frame settings");
101+
throw Exception("BusTub currently only support window function with default window frame settings");
102102
}
103103
std::vector<AbstractExpressionRef> partition_by;
104104
for (auto &item : window_call.partition_by_) {

test/concurrency/common_checker.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
namespace bustub {
2323

24-
auto Insert(Transaction *txn, BustubInstance &instance, int v1) -> void {
24+
auto Insert(Transaction *txn, BusTubInstance &instance, int v1) -> void {
2525
std::stringstream ss;
2626
auto writer = bustub::SimpleStreamWriter(ss, true, ",");
2727
fmt::print(stderr, "insert data with v1 = {} in txn {} {}\n", v1, txn->GetTransactionId(), txn->GetIsolationLevel());
@@ -38,7 +38,7 @@ auto Insert(Transaction *txn, BustubInstance &instance, int v1) -> void {
3838
/// This overloaded function will then bound each pair from @v1_vec & @v2_vec as a insert value
3939
/// If flag is set to `true`, v1_vec should contain exactly one element,
4040
/// The insert pair will be {v1_vec[0], v2_vec[0]}, {v1_vec[0], v2_vec[1]} ...
41-
auto Insert(Transaction *txn, BustubInstance &instance, const std::vector<int> &v1_vec, const std::vector<int> &v2_vec,
41+
auto Insert(Transaction *txn, BusTubInstance &instance, const std::vector<int> &v1_vec, const std::vector<int> &v2_vec,
4242
bool flag = false) -> void {
4343
// Check if the input vectors have the same size.
4444
if (!flag) {
@@ -95,7 +95,7 @@ auto Insert(Transaction *txn, BustubInstance &instance, const std::vector<int> &
9595
ASSERT_EQ(ss.str(), fmt::format("{},\n", v2_vec.size()));
9696
}
9797

98-
auto Delete(Transaction *txn, BustubInstance &instance, int v1) -> void {
98+
auto Delete(Transaction *txn, BusTubInstance &instance, int v1) -> void {
9999
std::stringstream ss;
100100
auto writer = bustub::SimpleStreamWriter(ss, true, ",");
101101
fmt::print(stderr, "delete data with v1 = {} in txn {} {}\n", v1, txn->GetTransactionId(), txn->GetIsolationLevel());
@@ -109,7 +109,7 @@ auto Delete(Transaction *txn, BustubInstance &instance, int v1) -> void {
109109
/// @param d_size The size you expect to be deleted from t1, will be used as sanity check, default value is 3
110110
/// This overloaded function performs a vectorized self-constructed deletion to better test the implementation
111111
/// You should calculate the number of elements that logically should be deleted, and pass it in as @d_size.
112-
auto Delete(Transaction *txn, BustubInstance &instance, const std::vector<int> &d_vec, int d_size = 3) -> void {
112+
auto Delete(Transaction *txn, BusTubInstance &instance, const std::vector<int> &d_vec, int d_size = 3) -> void {
113113
if (d_vec.empty()) {
114114
fmt::print(stderr, "Input vec must not be empty\n");
115115
return;
@@ -148,7 +148,7 @@ auto ExpectResult(const std::string &actual_result, const std::string &expected_
148148
return actual_result_rows == expected_result_rows;
149149
}
150150

151-
auto Scan(Transaction *txn, BustubInstance &instance, const std::vector<int> &v1) -> void {
151+
auto Scan(Transaction *txn, BusTubInstance &instance, const std::vector<int> &v1) -> void {
152152
std::stringstream ss;
153153
auto writer = bustub::SimpleStreamWriter(ss, true, ",");
154154
fmt::print(stderr, "scan data expect v1 in range {} in txn {} {}\n", v1, txn->GetTransactionId(),
@@ -166,28 +166,28 @@ auto Scan(Transaction *txn, BustubInstance &instance, const std::vector<int> &v1
166166
}
167167
}
168168

169-
void Commit(BustubInstance &instance, Transaction *&txn) {
169+
void Commit(BusTubInstance &instance, Transaction *&txn) {
170170
fmt::print(stderr, "commit txn {} in {}\n", txn->GetTransactionId(), txn->GetIsolationLevel());
171171
instance.txn_manager_->Commit(txn);
172172
delete txn;
173173
txn = nullptr;
174174
}
175175

176-
void Abort(BustubInstance &instance, Transaction *&txn) {
176+
void Abort(BusTubInstance &instance, Transaction *&txn) {
177177
fmt::print(stderr, "abort txn {} in {}\n", txn->GetTransactionId(), txn->GetIsolationLevel());
178178
instance.txn_manager_->Abort(txn);
179179
delete txn;
180180
txn = nullptr;
181181
}
182182

183-
auto Begin(BustubInstance &instance, IsolationLevel level) -> Transaction * {
183+
auto Begin(BusTubInstance &instance, IsolationLevel level) -> Transaction * {
184184
auto txn = instance.txn_manager_->Begin(nullptr, level);
185185
fmt::print(stderr, "start txn {} in {}\n", txn->GetTransactionId(), txn->GetIsolationLevel());
186186
return txn;
187187
}
188188

189-
auto GetDbForVisibilityTest(const std::string &name) -> std::shared_ptr<BustubInstance> {
190-
auto instance = std::make_unique<BustubInstance>();
189+
auto GetDbForVisibilityTest(const std::string &name) -> std::shared_ptr<BusTubInstance> {
190+
auto instance = std::make_unique<BusTubInstance>();
191191
auto writer = bustub::SimpleStreamWriter(std::cout, true);
192192
fmt::print(stderr, "--- TEST CASE {} ---\n", name);
193193
fmt::print(stderr, "prepare\n");
@@ -196,8 +196,8 @@ auto GetDbForVisibilityTest(const std::string &name) -> std::shared_ptr<BustubIn
196196
return instance;
197197
}
198198

199-
auto GetDbForCommitAbortTest(const std::string &name) -> std::shared_ptr<BustubInstance> {
200-
auto instance = std::make_unique<BustubInstance>();
199+
auto GetDbForCommitAbortTest(const std::string &name) -> std::shared_ptr<BusTubInstance> {
200+
auto instance = std::make_unique<BusTubInstance>();
201201
auto writer = bustub::SimpleStreamWriter(std::cout, true);
202202
fmt::print(stderr, "--- TEST CASE {} ---\n", name);
203203
fmt::print(stderr, "prepare\n");
@@ -213,8 +213,8 @@ enum class ExpectedOutcome {
213213
BlockOnWrite,
214214
};
215215

216-
auto GetDbForIsolationTest() -> std::shared_ptr<BustubInstance> {
217-
auto instance = std::make_unique<BustubInstance>();
216+
auto GetDbForIsolationTest() -> std::shared_ptr<BusTubInstance> {
217+
auto instance = std::make_unique<BusTubInstance>();
218218
auto writer = bustub::SimpleStreamWriter(std::cout, true);
219219
fmt::print(stderr, "0: prepare\n");
220220
// in case you implemented scan filter pushdown... disable it by forcing starter rule!
@@ -226,7 +226,7 @@ auto GetDbForIsolationTest() -> std::shared_ptr<BustubInstance> {
226226
return instance;
227227
}
228228

229-
auto StartReadTxn(IsolationLevel read_txn_level, BustubInstance &instance, bool read_before_write) -> Transaction * {
229+
auto StartReadTxn(IsolationLevel read_txn_level, BusTubInstance &instance, bool read_before_write) -> Transaction * {
230230
fmt::print(stderr, "1: read txn: {}\n", read_txn_level);
231231
auto txn_r = instance.txn_manager_->Begin(nullptr, read_txn_level);
232232
if (read_before_write) {
@@ -253,7 +253,7 @@ auto StartReadTxn(IsolationLevel read_txn_level, BustubInstance &instance, bool
253253
return txn_r;
254254
}
255255

256-
auto StartWriteTxn(IsolationLevel write_txn_level, BustubInstance &instance, bool is_delete) -> Transaction * {
256+
auto StartWriteTxn(IsolationLevel write_txn_level, BusTubInstance &instance, bool is_delete) -> Transaction * {
257257
auto writer = bustub::SimpleStreamWriter(std::cout, true);
258258
fmt::print(stderr, "2: write txn: {}\n", write_txn_level);
259259
auto txn_w = instance.txn_manager_->Begin(nullptr, write_txn_level);
@@ -273,7 +273,7 @@ auto StartWriteTxn(IsolationLevel write_txn_level, BustubInstance &instance, boo
273273
return txn_w;
274274
}
275275

276-
auto TryRead(Transaction *txn_r, BustubInstance &instance, ExpectedOutcome o, bool is_delete,
276+
auto TryRead(Transaction *txn_r, BusTubInstance &instance, ExpectedOutcome o, bool is_delete,
277277
std::atomic<bool> &check_done) -> bool {
278278
bool ret = false;
279279
std::stringstream result;

test/recovery/recovery_test.cpp.disabled

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class RecoveryTest : public ::testing::Test {
5050

5151
// NOLINTNEXTLINE
5252
TEST_F(RecoveryTest, DISABLED_RedoTest) {
53-
auto *bustub_instance = new BustubInstance("test.bustub");
53+
auto *bustub_instance = new BusTubInstance("test.bustub");
5454

5555
ASSERT_FALSE(enable_logging);
5656
LOG_INFO("Skip system recovering...");
@@ -92,7 +92,7 @@ TEST_F(RecoveryTest, DISABLED_RedoTest) {
9292
delete bustub_instance;
9393

9494
LOG_INFO("System restart...");
95-
bustub_instance = new BustubInstance("test.bustub");
95+
bustub_instance = new BusTubInstance("test.bustub");
9696

9797
ASSERT_FALSE(enable_logging);
9898
LOG_INFO("Check if tuple is not in table before recovery");
@@ -139,7 +139,7 @@ TEST_F(RecoveryTest, DISABLED_RedoTest) {
139139

140140
// NOLINTNEXTLINE
141141
TEST_F(RecoveryTest, DISABLED_UndoTest) {
142-
auto *bustub_instance = new BustubInstance("test.bustub");
142+
auto *bustub_instance = new BusTubInstance("test.bustub");
143143

144144
ASSERT_FALSE(enable_logging);
145145
LOG_INFO("Skip system recovering...");
@@ -176,7 +176,7 @@ TEST_F(RecoveryTest, DISABLED_UndoTest) {
176176
delete bustub_instance;
177177

178178
LOG_INFO("System restarted..");
179-
bustub_instance = new BustubInstance("test.bustub");
179+
bustub_instance = new BusTubInstance("test.bustub");
180180

181181
LOG_INFO("Check if tuple exists before recovery");
182182
Tuple old_tuple;
@@ -218,7 +218,7 @@ TEST_F(RecoveryTest, DISABLED_UndoTest) {
218218

219219
// NOLINTNEXTLINE
220220
TEST_F(RecoveryTest, DISABLED_CheckpointTest) {
221-
auto *bustub_instance = new BustubInstance("test.bustub");
221+
auto *bustub_instance = new BusTubInstance("test.bustub");
222222

223223
EXPECT_FALSE(enable_logging);
224224
LOG_INFO("Skip system recovering...");

0 commit comments

Comments
 (0)