[Tarantool-patches] [PATCH v23 3/3] test: add gh-6036-qsync-order test
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Fri Oct 22 01:06:09 MSK 2021
Thanks for the patch!
> +-- Make election_replica2 been a leader and start writting data,
> +-- the PROMOTE request get queued on election_replica3 and not
> +-- yet processed, same time INSERT won't complete either
> +-- waiting for PROMOTE completion first. Note that we
> +-- enter election_replica3 as well just to be sure the PROMOTE
> +-- reached it.
> +test_run:switch("election_replica2")
> + | ---
> + | - true
> + | ...
> +box.ctl.promote()
> + | ---
> + | ...
> +test_run:switch("election_replica3")
> + | ---
> + | - true
> + | ...
> +test_run:wait_cond(function() return box.error.injection.get("ERRINJ_WAL_WRITE_COUNT") > write_cnt end)
Sorry, keep the code inside of 80 symbols line width.
I added this diff and all the tests passed. That means the only
tested parts of the patchset are apply_synchro_row() and
txn_limbo_is_replica_outdated().
Please, lets try not to submit more untested code. It is enough that
we already have one ticket which simply adds assert(false) into a few
places and the tests pass. It does not make the code better, it just
adds more uncertainty how it works and whether it works at all.
====================
diff --git a/src/box/box.cc b/src/box/box.cc
index 6a9be745a..011738409 100644
--- a/src/box/box.cc
+++ b/src/box/box.cc
@@ -1684,11 +1684,11 @@ box_issue_promote(uint32_t prev_leader_id, int64_t promote_lsn)
.lsn = promote_lsn,
.term = raft->term,
};
- txn_limbo_process_begin(&txn_limbo);
+ //txn_limbo_process_begin(&txn_limbo);
txn_limbo_write_promote(&txn_limbo, req.lsn, req.term);
txn_limbo_process_core(&txn_limbo, &req);
assert(txn_limbo_is_empty(&txn_limbo));
- txn_limbo_process_commit(&txn_limbo);
+ //txn_limbo_process_commit(&txn_limbo);
}
/** A guard to block multiple simultaneous promote()/demote() invocations. */
@@ -1707,12 +1707,12 @@ box_issue_demote(uint32_t prev_leader_id, int64_t promote_lsn)
.lsn = promote_lsn,
.term = box_raft()->term,
};
- txn_limbo_process_begin(&txn_limbo);
+ //txn_limbo_process_begin(&txn_limbo);
txn_limbo_write_demote(&txn_limbo, promote_lsn,
box_raft()->term);
txn_limbo_process_core(&txn_limbo, &req);
assert(txn_limbo_is_empty(&txn_limbo));
- txn_limbo_process_commit(&txn_limbo);
+ //txn_limbo_process_commit(&txn_limbo);
}
int
diff --git a/src/box/txn_limbo.c b/src/box/txn_limbo.c
index 9b643072a..ba11443af 100644
--- a/src/box/txn_limbo.c
+++ b/src/box/txn_limbo.c
@@ -748,7 +748,7 @@ void
txn_limbo_process_core(struct txn_limbo *limbo,
const struct synchro_request *req)
{
- assert(latch_is_locked(&limbo->promote_latch));
+ //assert(latch_is_locked(&limbo->promote_latch));
uint64_t term = req->term;
uint32_t origin = req->origin_id;
@@ -814,9 +814,9 @@ void
txn_limbo_process(struct txn_limbo *limbo,
const struct synchro_request *req)
{
- txn_limbo_process_begin(limbo);
+ //txn_limbo_process_begin(limbo);
txn_limbo_process_core(limbo, req);
- txn_limbo_process_commit(limbo);
+ //txn_limbo_process_commit(limbo);
}
void
diff --git a/src/box/txn_limbo.h b/src/box/txn_limbo.h
index 0bbd7a1c3..10d20e956 100644
--- a/src/box/txn_limbo.h
+++ b/src/box/txn_limbo.h
@@ -216,12 +216,12 @@ txn_limbo_is_owner(struct txn_limbo *limbo, uint32_t owner_id)
* it rolls back a transaction and updates replication
* number causing a nested test for limbo ownership).
*/
- if (latch_owner(&limbo->promote_latch) == fiber())
- return limbo->owner_id == owner_id;
+ //if (latch_owner(&limbo->promote_latch) == fiber())
+ // return limbo->owner_id == owner_id;
- latch_lock(&limbo->promote_latch);
+ //latch_lock(&limbo->promote_latch);
bool v = limbo->owner_id == owner_id;
- latch_unlock(&limbo->promote_latch);
+ //latch_unlock(&limbo->promote_latch);
return v;
}
@@ -249,9 +249,9 @@ txn_limbo_last_entry(struct txn_limbo *limbo)
static inline uint64_t
txn_limbo_replica_term(struct txn_limbo *limbo, uint32_t replica_id)
{
- latch_lock(&limbo->promote_latch);
+ //latch_lock(&limbo->promote_latch);
uint64_t v = vclock_get(&limbo->promote_term_map, replica_id);
- latch_unlock(&limbo->promote_latch);
+ //latch_unlock(&limbo->promote_latch);
return v;
}
More information about the Tarantool-patches
mailing list