@@ -170,9 +170,10 @@ void TimestampOrderingTransactionManager::YieldOwnership(
170
170
tile_group_header->SetTransactionId (tuple_id, INITIAL_TXN_ID);
171
171
}
172
172
173
- bool TimestampOrderingTransactionManager::PerformRead (
174
- TransactionContext *const current_txn, const ItemPointer &read_location,
175
- bool acquire_ownership) {
173
+ bool TimestampOrderingTransactionManager::PerformRead (TransactionContext *const current_txn,
174
+ const ItemPointer &read_location,
175
+ storage::TileGroupHeader *tile_group_header,
176
+ bool acquire_ownership) {
176
177
ItemPointer location = read_location;
177
178
178
179
// ////////////////////////////////////////////////////////
@@ -189,24 +190,18 @@ bool TimestampOrderingTransactionManager::PerformRead(
189
190
190
191
// TODO: what if we want to read a version that we write?
191
192
else if (current_txn->GetIsolationLevel () == IsolationLevelType::SNAPSHOT) {
192
- oid_t tile_group_id = location.block ;
193
193
oid_t tuple_id = location.offset ;
194
194
195
195
LOG_TRACE (" PerformRead (%u, %u)\n " , location.block , location.offset );
196
- auto &manager = catalog::Manager::GetInstance ();
197
- auto tile_group_header = manager.GetTileGroup (tile_group_id)->GetHeader ();
198
196
199
197
// Check if it's select for update before we check the ownership
200
198
// and modify the last reader cid
201
199
if (acquire_ownership == true ) {
202
200
// get the latest version of this tuple.
203
201
location = *(tile_group_header->GetIndirection (location.offset ));
204
202
205
- tile_group_id = location.block ;
206
203
tuple_id = location.offset ;
207
204
208
- tile_group_header = manager.GetTileGroup (tile_group_id)->GetHeader ();
209
-
210
205
if (IsOwner (current_txn, tile_group_header, tuple_id) == false ) {
211
206
// Acquire ownership if we haven't
212
207
if (IsOwnable (current_txn, tile_group_header, tuple_id) == false ) {
@@ -225,27 +220,11 @@ bool TimestampOrderingTransactionManager::PerformRead(
225
220
226
221
// if we have already owned the version.
227
222
PELOTON_ASSERT (IsOwner (current_txn, tile_group_header, tuple_id) == true );
228
-
229
- // Increment table read op stats
230
- if (static_cast <StatsType>(settings::SettingsManager::GetInt (
231
- settings::SettingId::stats_mode)) != StatsType::INVALID) {
232
- stats::BackendStatsContext::GetInstance ()->IncrementTableReads (
233
- location.block );
234
- }
235
-
236
223
return true ;
237
224
238
225
} else {
239
226
// if it's not select for update, then update read set and return true.
240
-
241
227
current_txn->RecordRead (location);
242
-
243
- // Increment table read op stats
244
- if (static_cast <StatsType>(settings::SettingsManager::GetInt (
245
- settings::SettingId::stats_mode)) != StatsType::INVALID) {
246
- stats::BackendStatsContext::GetInstance ()->IncrementTableReads (
247
- location.block );
248
- }
249
228
return true ;
250
229
}
251
230
@@ -256,12 +235,9 @@ bool TimestampOrderingTransactionManager::PerformRead(
256
235
// ////////////////////////////////////////////////////////
257
236
else if (current_txn->GetIsolationLevel () ==
258
237
IsolationLevelType::READ_COMMITTED) {
259
- oid_t tile_group_id = location.block ;
260
238
oid_t tuple_id = location.offset ;
261
239
262
240
LOG_TRACE (" PerformRead (%u, %u)\n " , location.block , location.offset );
263
- auto &manager = catalog::Manager::GetInstance ();
264
- auto tile_group_header = manager.GetTileGroup (tile_group_id)->GetHeader ();
265
241
266
242
// Check if it's select for update before we check the ownership.
267
243
if (acquire_ownership == true ) {
@@ -283,26 +259,13 @@ bool TimestampOrderingTransactionManager::PerformRead(
283
259
}
284
260
// if we have already owned the version.
285
261
PELOTON_ASSERT (IsOwner (current_txn, tile_group_header, tuple_id) == true );
286
- // Increment table read op stats
287
- if (static_cast <StatsType>(settings::SettingsManager::GetInt (
288
- settings::SettingId::stats_mode)) != StatsType::INVALID) {
289
- stats::BackendStatsContext::GetInstance ()->IncrementTableReads (
290
- location.block );
291
- }
292
262
return true ;
293
263
294
264
} else {
295
265
// a transaction can never read an uncommitted version.
296
266
if (IsOwner (current_txn, tile_group_header, tuple_id) == false ) {
297
267
if (IsOwned (current_txn, tile_group_header, tuple_id) == false ) {
298
268
current_txn->RecordRead (location);
299
-
300
- // Increment table read op stats
301
- if (static_cast <StatsType>(settings::SettingsManager::GetInt (
302
- settings::SettingId::stats_mode)) != StatsType::INVALID) {
303
- stats::BackendStatsContext::GetInstance ()->IncrementTableReads (
304
- location.block );
305
- }
306
269
return true ;
307
270
308
271
} else {
@@ -315,14 +278,6 @@ bool TimestampOrderingTransactionManager::PerformRead(
315
278
} else {
316
279
// this version must already be in the read/write set.
317
280
// so no need to update read set.
318
- // current_txn->RecordRead(location);
319
-
320
- // Increment table read op stats
321
- if (static_cast <StatsType>(settings::SettingsManager::GetInt (
322
- settings::SettingId::stats_mode)) != StatsType::INVALID) {
323
- stats::BackendStatsContext::GetInstance ()->IncrementTableReads (
324
- location.block );
325
- }
326
281
return true ;
327
282
}
328
283
}
@@ -338,13 +293,9 @@ bool TimestampOrderingTransactionManager::PerformRead(
338
293
current_txn->GetIsolationLevel () ==
339
294
IsolationLevelType::REPEATABLE_READS);
340
295
341
- oid_t tile_group_id = location.block ;
342
296
oid_t tuple_id = location.offset ;
343
297
344
298
LOG_TRACE (" PerformRead (%u, %u)\n " , location.block , location.offset );
345
- auto &manager = catalog::Manager::GetInstance ();
346
- auto tile_group_header = manager.GetTileGroup (tile_group_id)->GetHeader ();
347
-
348
299
// Check if it's select for update before we check the ownership
349
300
// and modify the last reader cid.
350
301
if (acquire_ownership == true ) {
@@ -379,12 +330,6 @@ bool TimestampOrderingTransactionManager::PerformRead(
379
330
PELOTON_ASSERT (GetLastReaderCommitId (tile_group_header, tuple_id) ==
380
331
current_txn->GetCommitId () ||
381
332
GetLastReaderCommitId (tile_group_header, tuple_id) == 0 );
382
- // Increment table read op stats
383
- if (static_cast <StatsType>(settings::SettingsManager::GetInt (
384
- settings::SettingId::stats_mode)) != StatsType::INVALID) {
385
- stats::BackendStatsContext::GetInstance ()->IncrementTableReads (
386
- location.block );
387
- }
388
333
return true ;
389
334
390
335
} else {
@@ -395,13 +340,6 @@ bool TimestampOrderingTransactionManager::PerformRead(
395
340
current_txn->GetCommitId (), false ) == true ) {
396
341
// update read set.
397
342
current_txn->RecordRead (location);
398
-
399
- // Increment table read op stats
400
- if (static_cast <StatsType>(settings::SettingsManager::GetInt (
401
- settings::SettingId::stats_mode)) != StatsType::INVALID) {
402
- stats::BackendStatsContext::GetInstance ()->IncrementTableReads (
403
- location.block );
404
- }
405
343
return true ;
406
344
} else {
407
345
// if the tuple has been owned by some concurrent transactions,
@@ -419,14 +357,6 @@ bool TimestampOrderingTransactionManager::PerformRead(
419
357
420
358
// this version must already be in the read/write set.
421
359
// so no need to update read set.
422
- // current_txn->RecordRead(location);
423
-
424
- // Increment table read op stats
425
- if (static_cast <StatsType>(settings::SettingsManager::GetInt (
426
- settings::SettingId::stats_mode)) != StatsType::INVALID) {
427
- stats::BackendStatsContext::GetInstance ()->IncrementTableReads (
428
- location.block );
429
- }
430
360
return true ;
431
361
}
432
362
}
@@ -464,13 +394,6 @@ void TimestampOrderingTransactionManager::PerformInsert(
464
394
465
395
// Write down the head pointer's address in tile group header
466
396
tile_group_header->SetIndirection (tuple_id, index_entry_ptr);
467
-
468
- // Increment table insert op stats
469
- if (static_cast <StatsType>(settings::SettingsManager::GetInt (
470
- settings::SettingId::stats_mode)) != StatsType::INVALID) {
471
- stats::BackendStatsContext::GetInstance ()->IncrementTableInserts (
472
- location.block );
473
- }
474
397
}
475
398
476
399
void TimestampOrderingTransactionManager::PerformUpdate (
@@ -548,13 +471,6 @@ void TimestampOrderingTransactionManager::PerformUpdate(
548
471
549
472
// Add the old tuple into the update set
550
473
current_txn->RecordUpdate (old_location);
551
-
552
- // Increment table update op stats
553
- if (static_cast <StatsType>(settings::SettingsManager::GetInt (
554
- settings::SettingId::stats_mode)) != StatsType::INVALID) {
555
- stats::BackendStatsContext::GetInstance ()->IncrementTableUpdates (
556
- new_location.block );
557
- }
558
474
}
559
475
560
476
void TimestampOrderingTransactionManager::PerformUpdate (
@@ -581,13 +497,6 @@ void TimestampOrderingTransactionManager::PerformUpdate(
581
497
// transaction
582
498
// is updating a version that is installed by itself.
583
499
// in this case, nothing needs to be performed.
584
-
585
- // Increment table update op stats
586
- if (static_cast <StatsType>(settings::SettingsManager::GetInt (
587
- settings::SettingId::stats_mode)) != StatsType::INVALID) {
588
- stats::BackendStatsContext::GetInstance ()->IncrementTableUpdates (
589
- location.block );
590
- }
591
500
}
592
501
593
502
void TimestampOrderingTransactionManager::PerformDelete (
@@ -669,13 +578,6 @@ void TimestampOrderingTransactionManager::PerformDelete(
669
578
}
670
579
671
580
current_txn->RecordDelete (old_location);
672
-
673
- // Increment table delete op stats
674
- if (static_cast <StatsType>(settings::SettingsManager::GetInt (
675
- settings::SettingId::stats_mode)) != StatsType::INVALID) {
676
- stats::BackendStatsContext::GetInstance ()->IncrementTableDeletes (
677
- old_location.block );
678
- }
679
581
}
680
582
681
583
void TimestampOrderingTransactionManager::PerformDelete (
@@ -703,13 +605,6 @@ void TimestampOrderingTransactionManager::PerformDelete(
703
605
// if this version is newly inserted.
704
606
current_txn->RecordDelete (location);
705
607
}
706
-
707
- // Increment table delete op stats
708
- if (static_cast <StatsType>(settings::SettingsManager::GetInt (
709
- settings::SettingId::stats_mode)) != StatsType::INVALID) {
710
- stats::BackendStatsContext::GetInstance ()->IncrementTableDeletes (
711
- location.block );
712
- }
713
608
}
714
609
715
610
ResultType TimestampOrderingTransactionManager::CommitTransaction (
@@ -752,20 +647,6 @@ ResultType TimestampOrderingTransactionManager::CommitTransaction(
752
647
gc_object_set->emplace_back (database_oid, table_oid, index_oid);
753
648
}
754
649
755
- oid_t database_id = 0 ;
756
- if (static_cast <StatsType>(settings::SettingsManager::GetInt (
757
- settings::SettingId::stats_mode)) != StatsType::INVALID) {
758
- for (const auto &tuple_entry : rw_set) {
759
- // Call the GetConstIterator() function to explicitly lock the cuckoohash
760
- // and initilaize the iterator
761
- const auto tile_group_id = tuple_entry.first .block ;
762
- database_id = manager.GetTileGroup (tile_group_id)->GetDatabaseId ();
763
- if (database_id != CATALOG_DATABASE_OID) {
764
- break ;
765
- }
766
- }
767
- }
768
-
769
650
// install everything.
770
651
// 1. install a new version for update operations;
771
652
// 2. install an empty version for delete operations;
@@ -896,13 +777,6 @@ ResultType TimestampOrderingTransactionManager::CommitTransaction(
896
777
897
778
EndTransaction (current_txn);
898
779
899
- // Increment # txns committed metric
900
- if (static_cast <StatsType>(settings::SettingsManager::GetInt (
901
- settings::SettingId::stats_mode)) != StatsType::INVALID) {
902
- stats::BackendStatsContext::GetInstance ()->IncrementTxnCommitted (
903
- database_id);
904
- }
905
-
906
780
return result;
907
781
}
908
782
@@ -930,20 +804,6 @@ ResultType TimestampOrderingTransactionManager::AbortTransaction(
930
804
gc_object_set->emplace_back (database_oid, table_oid, index_oid);
931
805
}
932
806
933
- oid_t database_id = 0 ;
934
- if (static_cast <StatsType>(settings::SettingsManager::GetInt (
935
- settings::SettingId::stats_mode)) != StatsType::INVALID) {
936
- for (const auto &tuple_entry : rw_set) {
937
- // Call the GetConstIterator() function to explicitly lock the cuckoohash
938
- // and initilaize the iterator
939
- const auto tile_group_id = tuple_entry.first .block ;
940
- database_id = manager.GetTileGroup (tile_group_id)->GetDatabaseId ();
941
- if (database_id != CATALOG_DATABASE_OID) {
942
- break ;
943
- }
944
- }
945
- }
946
-
947
807
// Iterate through each item pointer in the read write set
948
808
// TODO (Pooja): This might be inefficient since we will have to get the
949
809
// tile_group_header for each entry. Check if this needs to be consolidated
@@ -1085,12 +945,6 @@ ResultType TimestampOrderingTransactionManager::AbortTransaction(
1085
945
current_txn->SetResult (ResultType::ABORTED);
1086
946
EndTransaction (current_txn);
1087
947
1088
- // Increment # txns aborted metric
1089
- if (static_cast <StatsType>(settings::SettingsManager::GetInt (
1090
- settings::SettingId::stats_mode)) != StatsType::INVALID) {
1091
- stats::BackendStatsContext::GetInstance ()->IncrementTxnAborted (database_id);
1092
- }
1093
-
1094
948
return ResultType::ABORTED;
1095
949
}
1096
950
0 commit comments