Skip to content

Commit

Permalink
nit: copyright and format
Browse files Browse the repository at this point in the history
  • Loading branch information
J-HowHuang committed Nov 14, 2024
1 parent 01a0a99 commit 4df76a1
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
20 changes: 17 additions & 3 deletions src/execution/execution_common.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
//===----------------------------------------------------------------------===//
//
// BusTub
//
// execution_common.cpp
//
// Identification: src/execution/execution_common.cpp
//
// Copyright (c) 2024-2024, Carnegie Mellon University Database Group
//
//===----------------------------------------------------------------------===//

#include "execution/execution_common.h"

#include "catalog/catalog.h"
#include "common/config.h"
#include "common/macros.h"
#include "concurrency/transaction_manager.h"
#include "fmt/core.h"
#include "storage/table/table_heap.h"
#include "type/value.h"
#include "type/value_factory.h"

namespace bustub {

Expand Down Expand Up @@ -38,6 +48,7 @@ auto ReconstructTuple(const Schema *schema, const Tuple &base_tuple, const Tuple
const std::vector<UndoLog> &undo_logs) -> std::optional<Tuple> {
UNIMPLEMENTED("not implemented");
}

/**
* @brief Collects the undo logs sufficient to reconstruct the tuple w.r.t. the txn.
*
Expand All @@ -54,6 +65,7 @@ auto CollectUndoLogs(RID rid, const TupleMeta &base_meta, const Tuple &base_tupl
Transaction *txn, TransactionManager *txn_mgr) -> std::optional<std::vector<UndoLog>> {
UNIMPLEMENTED("not implemented");
}

/**
* @brief Generates a new undo log as the transaction tries to modify this tuple at the first time.
*
Expand All @@ -69,6 +81,7 @@ auto GenerateNewUndoLog(const Schema *schema, const Tuple *base_tuple, const Tup
UndoLink prev_version) -> UndoLog {
UNIMPLEMENTED("not implemented");
}

/**
* @brief Generate the updated undo log to replace the old one, whereas the tuple is already modified by this txn once.
*
Expand All @@ -83,6 +96,7 @@ auto GenerateUpdatedUndoLog(const Schema *schema, const Tuple *base_tuple, const
const UndoLog &log) -> UndoLog {
UNIMPLEMENTED("not implemented");
}

void TxnMgrDbg(const std::string &info, TransactionManager *txn_mgr, const TableInfo *table_info,
TableHeap *table_heap) {
// always use stderr for printing logs...
Expand Down
17 changes: 15 additions & 2 deletions src/include/execution/execution_common.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
//===----------------------------------------------------------------------===//
//
// BusTub
//
// execution_common.h
//
// Identification: src/include/execution/execution_common.h
//
// Copyright (c) 2014-2024, Carnegie Mellon University Database Group
//
//===----------------------------------------------------------------------===//
#pragma once

#include <string>
Expand Down Expand Up @@ -43,12 +54,16 @@ auto GenerateSortKey(const Tuple &tuple, const std::vector<OrderBy> &order_bys,

auto ReconstructTuple(const Schema *schema, const Tuple &base_tuple, const TupleMeta &base_meta,
const std::vector<UndoLog> &undo_logs) -> std::optional<Tuple>;

auto CollectUndoLogs(RID rid, const TupleMeta &base_meta, const Tuple &base_tuple, std::optional<UndoLink> undo_link,
Transaction *txn, TransactionManager *txn_mgr) -> std::optional<std::vector<UndoLog>>;

auto GenerateNewUndoLog(const Schema *schema, const Tuple *base_tuple, const Tuple *target_tuple, timestamp_t ts,
UndoLink prev_version) -> UndoLog;

auto GenerateUpdatedUndoLog(const Schema *schema, const Tuple *base_tuple, const Tuple *target_tuple,
const UndoLog &log) -> UndoLog;

void TxnMgrDbg(const std::string &info, TransactionManager *txn_mgr, const TableInfo *table_info,
TableHeap *table_heap);

Expand All @@ -57,11 +72,9 @@ void TxnMgrDbg(const std::string &info, TransactionManager *txn_mgr, const Table
// To give you a sense of what can be shared across executors / transaction manager, here are the
// list of helper function names that we defined in the reference solution. You should come up with
// your own when you go through the process.
// * CollectUndoLogs
// * WalkUndoLogs
// * Modify
// * IsWriteWriteConflict
// * GenerateDiffLog
// * GenerateNullTupleForSchema
// * GetUndoLogSchema
//
Expand Down

0 comments on commit 4df76a1

Please sign in to comment.