|
10 | 10 | #include "include/scan_callback.hh" |
11 | 11 | #include "include/transaction.hh" |
12 | 12 | #include "include/version.hh" |
| 13 | +#include "../../include/trace.hh" // izanagi: #if TRACE-guarded correctness trace |
13 | 14 |
|
14 | 15 | extern bool chkClkSpan(const uint64_t start, const uint64_t stop, |
15 | 16 | const uint64_t threshold); |
@@ -521,6 +522,37 @@ void TxExecutor::si_commit() { |
521 | 522 | GCElement((*itr).storage_, (*itr).key_, (*itr).rcdptr_, (*itr).ver_, |
522 | 523 | this->cstamp_)); |
523 | 524 | } |
| 525 | + |
| 526 | +#if TRACE |
| 527 | + // izanagi correctness trace (SI; observer-effect isolated, compiled out when |
| 528 | + // TRACE==0). cstamp_ is this txn's commit order AND the version id stamped |
| 529 | + // into every written version (ver_->cstamp_, set just above). The read set |
| 530 | + // holds the snapshot versions actually read; ver_->cstamp_ is the creating |
| 531 | + // txn's commit (0 = initial/genesis version, since Lsn starts at 0 and real |
| 532 | + // commits use ++Lsn >= 1). Encode the version id as (epoch=1, tid=cstamp) so |
| 533 | + // the verifier's (epoch,tid) model applies directly and an initial-version |
| 534 | + // read maps to genesis (1,0). All data is CC-native (cstamp_ already exists |
| 535 | + // for SI/GC). Emitted only on the committed path (node-validation abort goes |
| 536 | + // to FINISH_SI_COMMIT and never reaches here). read_set_/write_set_ are still |
| 537 | + // intact (cleared just below). |
| 538 | + { |
| 539 | + const std::uint64_t txid = izanagi_trace::next_txid(); |
| 540 | + izanagi_trace::emit_commit(thid_, txid, 1, this->cstamp_); |
| 541 | + for (auto& re : read_set_) { |
| 542 | + const std::uint32_t vc = re.ver_->cstamp_.load(std::memory_order_acquire); |
| 543 | + izanagi_trace::emit_read(thid_, txid, izanagi_trace::key_to_hex(re.key_), |
| 544 | + 1, vc); |
| 545 | + } |
| 546 | + for (auto& we : write_set_) { |
| 547 | + const char op = (we.op_ == OpType::INSERT) ? 'I' |
| 548 | + : (we.op_ == OpType::DELETE) ? 'D' |
| 549 | + : 'U'; |
| 550 | + izanagi_trace::emit_write(thid_, txid, izanagi_trace::key_to_hex(we.key_), |
| 551 | + op, 1, this->cstamp_); |
| 552 | + } |
| 553 | + } |
| 554 | +#endif |
| 555 | + |
524 | 556 | // After pushing this commit's GCElements, expose the (possibly new) |
525 | 557 | // queue front cstamp so other threads' gcRecord can advance safely. |
526 | 558 | gcobject_.publishMinQueuedCstamp(); |
|
0 commit comments