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

Commit 73b4f73

Browse files
yingjunwupervazea
authored andcommitted
fix halloween under snapshot isolation (#1272)
* fix halloween under snapshot isolation * fix halloween in update_executor. add empty version into write set
1 parent 801df5f commit 73b4f73

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/codegen/updater.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ char *Updater::PreparePK(uint32_t tile_group_id, uint32_t tuple_offset) {
113113
}
114114
auto &txn_manager = concurrency::TransactionManagerFactory::GetInstance();
115115
txn_manager.PerformDelete(txn, old_location, empty_location);
116+
AddToStatementWriteSet(empty_location);
116117

117118
// Get the tuple data pointer for a new version
118119
new_location_ = table_->GetEmptyTupleSlot(nullptr);
@@ -138,6 +139,8 @@ void Updater::Update() {
138139
// Either update in-place
139140
if (is_owner_ == true) {
140141
txn_manager.PerformUpdate(txn, old_location_);
142+
// we do not need to add any item pointer to statement-level write set
143+
// here, because we do not generate any new version
141144
executor_context_->num_processed++;
142145
return;
143146
}

src/executor/update_executor.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ bool UpdateExecutor::PerformUpdatePrimaryKey(
9292
return false;
9393
}
9494
transaction_manager.PerformDelete(current_txn, old_location, new_location);
95+
statement_write_set_.insert(new_location);
9596

9697
////////////////////////////////////////////
9798
// Insert tuple rather than install version
@@ -191,9 +192,6 @@ bool UpdateExecutor::DExecute() {
191192
oid_t physical_tuple_id = pos_lists[0][visible_tuple_id];
192193

193194
ItemPointer old_location(tile_group->GetTileGroupId(), physical_tuple_id);
194-
if (IsInStatementWriteSet(old_location)) {
195-
continue;
196-
}
197195

198196
LOG_TRACE("Visible Tuple id : %u, Physical Tuple id : %u ",
199197
visible_tuple_id, physical_tuple_id);
@@ -221,6 +219,11 @@ bool UpdateExecutor::DExecute() {
221219
}
222220
///////////////////////////////////////////////////////////
223221

222+
223+
if (IsInStatementWriteSet(old_location)) {
224+
continue;
225+
}
226+
224227
if (trigger_list != nullptr) {
225228
LOG_TRACE("size of trigger list in target table: %d",
226229
trigger_list->GetTriggerListSize());
@@ -268,7 +271,8 @@ bool UpdateExecutor::DExecute() {
268271
executor_context_);
269272

270273
transaction_manager.PerformUpdate(current_txn, old_location);
271-
statement_write_set_.insert(old_location);
274+
// we do not need to add any item pointer to statement-level write set
275+
// here, because we do not generate any new version
272276
}
273277
}
274278
// if we have already obtained the ownership

0 commit comments

Comments
 (0)