Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Commit 5739f18

Browse files
committed
undo formatting changes
1 parent 9b29a4c commit 5739f18

File tree

5 files changed

+61
-54
lines changed

5 files changed

+61
-54
lines changed

src/concurrency/timestamp_ordering_transaction_manager.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,10 @@ void TimestampOrderingTransactionManager::YieldOwnership(
148148
tile_group_header->SetTransactionId(tuple_id, INITIAL_TXN_ID);
149149
}
150150

151-
bool TimestampOrderingTransactionManager::PerformRead(
152-
TransactionContext *const current_txn, const ItemPointer &read_location,
153-
storage::TileGroupHeader *tile_group_header, bool acquire_ownership) {
151+
bool TimestampOrderingTransactionManager::PerformRead(TransactionContext *const current_txn,
152+
const ItemPointer &read_location,
153+
storage::TileGroupHeader *tile_group_header,
154+
bool acquire_ownership) {
154155
ItemPointer location = read_location;
155156

156157
//////////////////////////////////////////////////////////
@@ -346,8 +347,7 @@ void TimestampOrderingTransactionManager::PerformInsert(
346347
oid_t tuple_id = location.offset;
347348

348349
auto storage_manager = storage::StorageManager::GetInstance();
349-
auto tile_group_header =
350-
storage_manager->GetTileGroup(tile_group_id)->GetHeader();
350+
auto tile_group_header = storage_manager->GetTileGroup(tile_group_id)->GetHeader();
351351
auto transaction_id = current_txn->GetTransactionId();
352352

353353
// check MVCC info
@@ -391,8 +391,9 @@ void TimestampOrderingTransactionManager::PerformUpdate(
391391
// version.
392392
PELOTON_ASSERT(tile_group_header->GetTransactionId(old_location.offset) ==
393393
transaction_id);
394-
PELOTON_ASSERT(tile_group_header->GetPrevItemPointer(old_location.offset)
395-
.IsNull() == true);
394+
PELOTON_ASSERT(
395+
tile_group_header->GetPrevItemPointer(old_location.offset).IsNull() ==
396+
true);
396397

397398
// check whether the new version is empty.
398399
PELOTON_ASSERT(new_tile_group_header->GetTransactionId(new_location.offset) ==
@@ -496,8 +497,9 @@ void TimestampOrderingTransactionManager::PerformDelete(
496497
PELOTON_ASSERT(tile_group_header->GetTransactionId(old_location.offset) ==
497498
transaction_id);
498499
// we must be deleting the latest version.
499-
PELOTON_ASSERT(tile_group_header->GetPrevItemPointer(old_location.offset)
500-
.IsNull() == true);
500+
PELOTON_ASSERT(
501+
tile_group_header->GetPrevItemPointer(old_location.offset).IsNull() ==
502+
true);
501503

502504
// check whether the new version is empty.
503505
PELOTON_ASSERT(new_tile_group_header->GetTransactionId(new_location.offset) ==
@@ -552,8 +554,7 @@ void TimestampOrderingTransactionManager::PerformDelete(
552554
oid_t tuple_id = location.offset;
553555

554556
auto storage_manager = storage::StorageManager::GetInstance();
555-
auto tile_group_header =
556-
storage_manager->GetTileGroup(tile_group_id)->GetHeader();
557+
auto tile_group_header = storage_manager->GetTileGroup(tile_group_id)->GetHeader();
557558

558559
PELOTON_ASSERT(tile_group_header->GetTransactionId(tuple_id) ==
559560
current_txn->GetTransactionId());
@@ -595,8 +596,6 @@ ResultType TimestampOrderingTransactionManager::CommitTransaction(
595596
return ResultType::SUCCESS;
596597
}
597598

598-
auto &rw_set = current_txn->GetReadWriteSet();
599-
600599
auto storage_manager = storage::StorageManager::GetInstance();
601600
auto &log_manager = logging::LogManager::GetInstance();
602601

@@ -605,6 +604,7 @@ ResultType TimestampOrderingTransactionManager::CommitTransaction(
605604
// generate transaction id.
606605
cid_t end_commit_id = current_txn->GetCommitId();
607606

607+
auto &rw_set = current_txn->GetReadWriteSet();
608608
auto &rw_object_set = current_txn->GetCreateDropSet();
609609

610610
auto gc_set = current_txn->GetGCSetPtr();

src/concurrency/transaction_manager.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,8 @@ bool TransactionManager::IsOccupied(TransactionContext *const current_txn,
9999
const void *position_ptr) {
100100
ItemPointer &position = *((ItemPointer *)position_ptr);
101101

102-
auto tile_group_header = storage::StorageManager::GetInstance()
103-
->GetTileGroup(position.block)
104-
->GetHeader();
102+
auto tile_group_header =
103+
storage::StorageManager::GetInstance()->GetTileGroup(position.block)->GetHeader();
105104
auto tuple_id = position.offset;
106105

107106
txn_id_t tuple_txn_id = tile_group_header->GetTransactionId(tuple_id);

src/include/concurrency/transaction_context.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,8 @@ class TransactionContext : public Printable {
118118
*
119119
* @return The query strings.
120120
*/
121-
inline const std::vector<std::string> &GetQueryStrings() const {
122-
return query_strings_;
123-
}
121+
inline const std::vector<std::string>& GetQueryStrings() const {
122+
return query_strings_; }
124123

125124
/**
126125
* @brief Sets the commit identifier.
@@ -135,7 +134,7 @@ class TransactionContext : public Printable {
135134
* @param[in] epoch_id The epoch identifier
136135
*/
137136
inline void SetEpochId(const eid_t epoch_id) { epoch_id_ = epoch_id; }
138-
137+
139138
/**
140139
* @brief Sets the timestamp.
141140
*
@@ -148,18 +147,18 @@ class TransactionContext : public Printable {
148147
*
149148
* @param[in] query_string The query string
150149
*/
151-
inline void AddQueryString(const char *query_string) {
150+
inline void AddQueryString(const char* query_string) {
152151
query_strings_.push_back(std::string(query_string));
153152
}
154153

155154
void RecordCreate(oid_t database_oid, oid_t table_oid, oid_t index_oid) {
156-
rw_object_set_.push_back(
157-
std::make_tuple(database_oid, table_oid, index_oid, DDLType::CREATE));
155+
rw_object_set_.push_back(std::make_tuple(database_oid, table_oid,
156+
index_oid, DDLType::CREATE));
158157
}
159158

160159
void RecordDrop(oid_t database_oid, oid_t table_oid, oid_t index_oid) {
161-
rw_object_set_.push_back(
162-
std::make_tuple(database_oid, table_oid, index_oid, DDLType::DROP));
160+
rw_object_set_.push_back(std::make_tuple(database_oid, table_oid,
161+
index_oid, DDLType::DROP));
163162
}
164163

165164
void RecordReadOwn(const ItemPointer &);
@@ -262,7 +261,9 @@ class TransactionContext : public Printable {
262261
*
263262
* @return True if read only, False otherwise.
264263
*/
265-
bool IsReadOnly() const { return read_only_; }
264+
bool IsReadOnly() const {
265+
return read_only_;
266+
}
266267

267268
/**
268269
* @brief Determines if already written.
@@ -325,8 +326,8 @@ class TransactionContext : public Printable {
325326
ReadWriteSet rw_set_;
326327
CreateDropSet rw_object_set_;
327328

328-
/**
329-
* this set contains data location that needs to be gc'd in the transaction.
329+
/**
330+
* this set contains data location that needs to be gc'd in the transaction.
330331
*/
331332
std::shared_ptr<GCSet> gc_set_;
332333
std::shared_ptr<GCObjectSet> gc_object_set_;
@@ -340,8 +341,7 @@ class TransactionContext : public Printable {
340341

341342
std::unique_ptr<trigger::TriggerSet> on_commit_triggers_;
342343

343-
/** one default transaction is NOT 'read only' unless it is marked 'read only'
344-
* explicitly*/
344+
/** one default transaction is NOT 'read only' unless it is marked 'read only' explicitly*/
345345
bool read_only_ = false;
346346
};
347347

src/include/concurrency/transaction_manager.h

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13+
1314
#pragma once
1415

1516
#include <atomic>
@@ -57,7 +58,8 @@ class TransactionManager {
5758
*/
5859
virtual ~TransactionManager() {}
5960

60-
void Init(const ProtocolType protocol, const IsolationLevelType isolation,
61+
void Init(const ProtocolType protocol,
62+
const IsolationLevelType isolation,
6163
const ConflictAvoidanceType conflict) {
6264
protocol_ = protocol;
6365
isolation_level_ = isolation;
@@ -72,8 +74,9 @@ class TransactionManager {
7274
*
7375
* @return True if occupied, False otherwise.
7476
*/
75-
bool IsOccupied(TransactionContext *const current_txn,
76-
const void *position_ptr);
77+
bool IsOccupied(
78+
TransactionContext *const current_txn,
79+
const void *position_ptr);
7780

7881
/**
7982
* @brief Determines if visible.
@@ -100,9 +103,10 @@ class TransactionManager {
100103
*
101104
* @return True if owner, False otherwise.
102105
*/
103-
virtual bool IsOwner(TransactionContext *const current_txn,
104-
const storage::TileGroupHeader *const tile_group_header,
105-
const oid_t &tuple_id) = 0;
106+
virtual bool IsOwner(
107+
TransactionContext *const current_txn,
108+
const storage::TileGroupHeader *const tile_group_header,
109+
const oid_t &tuple_id) = 0;
106110

107111
/**
108112
* This method tests whether any other transaction has owned this version.
@@ -113,9 +117,10 @@ class TransactionManager {
113117
*
114118
* @return True if owned, False otherwise.
115119
*/
116-
virtual bool IsOwned(TransactionContext *const current_txn,
117-
const storage::TileGroupHeader *const tile_group_header,
118-
const oid_t &tuple_id) = 0;
120+
virtual bool IsOwned(
121+
TransactionContext *const current_txn,
122+
const storage::TileGroupHeader *const tile_group_header,
123+
const oid_t &tuple_id) = 0;
119124

120125
/**
121126
* Test whether the current transaction has created this version of the tuple.
@@ -127,9 +132,9 @@ class TransactionManager {
127132
* @return True if written, False otherwise.
128133
*/
129134
virtual bool IsWritten(
130-
TransactionContext *const current_txn,
131-
const storage::TileGroupHeader *const tile_group_header,
132-
const oid_t &tuple_id) = 0;
135+
TransactionContext *const current_txn,
136+
const storage::TileGroupHeader *const tile_group_header,
137+
const oid_t &tuple_id) = 0;
133138

134139
/**
135140
* Test whether it can obtain ownership.
@@ -156,7 +161,7 @@ class TransactionManager {
156161
*/
157162
virtual bool AcquireOwnership(
158163
TransactionContext *const current_txn,
159-
const storage::TileGroupHeader *const tile_group_header,
164+
const storage::TileGroupHeader *const tile_group_header,
160165
const oid_t &tuple_id) = 0;
161166

162167
/**
@@ -168,8 +173,8 @@ class TransactionManager {
168173
*/
169174
virtual void YieldOwnership(
170175
TransactionContext *const current_txn,
171-
// const oid_t &tile_group_id,
172-
const storage::TileGroupHeader *const tile_group_header,
176+
// const oid_t &tile_group_id,
177+
const storage::TileGroupHeader *const tile_group_header,
173178
const oid_t &tuple_id) = 0;
174179

175180
/**
@@ -181,13 +186,14 @@ class TransactionManager {
181186
* @param index_entry_ptr The index entry pointer
182187
*/
183188
virtual void PerformInsert(TransactionContext *const current_txn,
184-
const ItemPointer &location,
189+
const ItemPointer &location,
185190
ItemPointer *index_entry_ptr = nullptr) = 0;
186191

187192
virtual bool PerformRead(TransactionContext *const current_txn,
188-
const ItemPointer &location,
189-
storage::TileGroupHeader *tile_group_header,
190-
bool acquire_ownership) = 0;
193+
const ItemPointer &location,
194+
storage::TileGroupHeader *tile_group_header,
195+
bool acquire_ownership) = 0;
196+
191197

192198
virtual void PerformUpdate(TransactionContext *const current_txn,
193199
const ItemPointer &old_location,
@@ -209,8 +215,7 @@ class TransactionManager {
209215
* @param current_txn The current transaction
210216
* @param[in] result The result
211217
*/
212-
void SetTransactionResult(TransactionContext *const current_txn,
213-
const ResultType result) {
218+
void SetTransactionResult(TransactionContext *const current_txn, const ResultType result) {
214219
current_txn->SetResult(result);
215220
}
216221

@@ -246,8 +251,7 @@ class TransactionManager {
246251
virtual ResultType CommitTransaction(
247252
TransactionContext *const current_txn) = 0;
248253

249-
virtual ResultType AbortTransaction(
250-
TransactionContext *const current_txn) = 0;
254+
virtual ResultType AbortTransaction(TransactionContext *const current_txn) = 0;
251255

252256
/**
253257
* This function generates the maximum commit id of committed transactions.
@@ -265,12 +269,15 @@ class TransactionManager {
265269
*
266270
* @return The isolation level.
267271
*/
268-
IsolationLevelType GetIsolationLevel() { return isolation_level_; }
272+
IsolationLevelType GetIsolationLevel() {
273+
return isolation_level_;
274+
}
269275

270276
protected:
271277
static ProtocolType protocol_;
272278
static IsolationLevelType isolation_level_;
273279
static ConflictAvoidanceType conflict_avoidance_;
280+
274281
};
275282
} // namespace storage
276283
} // namespace peloton

test/include/concurrency/testing_transaction_util.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ class TransactionScheduler {
355355
table(datatable_),
356356
time(0),
357357
concurrent(false) {
358+
358359
for (size_t i = 0; i < num_txn; i++) {
359360
if (read_only_.find(i) != read_only_.end()) {
360361
schedules.emplace_back(i, true);

0 commit comments

Comments
 (0)