This repository was archived by the owner on Sep 27, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +16
-20
lines changed Expand file tree Collapse file tree 3 files changed +16
-20
lines changed Original file line number Diff line number Diff line change @@ -73,23 +73,18 @@ ValueType LOCK_FREE_ARRAY_TYPE::FindValid(
73
73
const std::size_t &offset, const ValueType &invalid_value) const {
74
74
LOG_TRACE (" Find Valid at %lu" , offset);
75
75
76
- std::size_t valid_array_itr = 0 ;
77
- std::size_t array_itr;
78
- auto lock_free_array_offset = lock_free_array.size ();
79
- for (array_itr = 0 ; array_itr < lock_free_array_offset; array_itr++) {
80
- auto value = lock_free_array.at (array_itr);
81
- if (value != invalid_value) {
82
- // Check offset
83
- if (valid_array_itr == offset) {
84
- return value;
85
- }
86
-
87
- // Update valid value count
88
- valid_array_itr++;
89
- }
76
+ ValueType value = invalid_value;
77
+ if ((lock_free_array.size () > offset)) {
78
+ value = lock_free_array.at (offset);
79
+ } else {
80
+ return invalid_value;
81
+ }
82
+
83
+ if (value != invalid_value)
84
+ return value;
85
+ else {
86
+ return invalid_value;
90
87
}
91
-
92
- return invalid_value;
93
88
}
94
89
95
90
template <typename ValueType>
Original file line number Diff line number Diff line change @@ -95,10 +95,11 @@ RWType TransactionContext::GetRWType(const ItemPointer &location) {
95
95
void TransactionContext::RecordRead (const ItemPointer &location) {
96
96
PELOTON_ASSERT (rw_set_.count (location) == 0 ||
97
97
(rw_set_[location] != RWType::DELETE && rw_set_[location] != RWType::INS_DEL));
98
-
99
- if (rw_set_.count (location) == 0 ) {
100
- rw_set_[location] = RWType::READ ;
98
+ auto rw_set_it = rw_set_. find (location);
99
+ if (rw_set_it != rw_set_.end () ) {
100
+ return ;
101
101
}
102
+ rw_set_[location] = RWType::READ;
102
103
}
103
104
104
105
void TransactionContext::RecordReadOwn (const ItemPointer &location) {
Original file line number Diff line number Diff line change @@ -1002,7 +1002,7 @@ std::shared_ptr<storage::TileGroup> DataTable::GetTileGroup(
1002
1002
PELOTON_ASSERT (tile_group_offset < GetTileGroupCount ());
1003
1003
1004
1004
auto tile_group_id =
1005
- tile_groups_.Find (tile_group_offset);
1005
+ tile_groups_.FindValid (tile_group_offset, invalid_tile_group_id );
1006
1006
1007
1007
return GetTileGroupById (tile_group_id);
1008
1008
}
You can’t perform that action at this time.
0 commit comments