Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Cyrill Gorcunov <gorcunov@gmail.com>,
	tml <tarantool-patches@dev.tarantool.org>
Subject: Re: [Tarantool-patches] [PATCH v23 3/3] test: add gh-6036-qsync-order test
Date: Fri, 22 Oct 2021 00:06:09 +0200	[thread overview]
Message-ID: <e7ff082d-31af-285f-d13f-508dac3e5f91@tarantool.org> (raw)
In-Reply-To: <20211014215622.49732-4-gorcunov@gmail.com>

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;
 }

  parent reply	other threads:[~2021-10-21 22:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-14 21:56 [Tarantool-patches] [PATCH v23 0/3] qsync: implement packet filtering (part 1) Cyrill Gorcunov via Tarantool-patches
2021-10-14 21:56 ` [Tarantool-patches] [PATCH v23 1/3] latch: add latch_is_locked helper Cyrill Gorcunov via Tarantool-patches
2021-10-14 21:56 ` [Tarantool-patches] [PATCH v23 2/3] qsync: order access to the limbo terms Cyrill Gorcunov via Tarantool-patches
2021-10-21 22:06   ` Vladislav Shpilevoy via Tarantool-patches
2021-10-14 21:56 ` [Tarantool-patches] [PATCH v23 3/3] test: add gh-6036-qsync-order test Cyrill Gorcunov via Tarantool-patches
2021-10-19 15:09   ` Serge Petrenko via Tarantool-patches
2021-10-19 22:26     ` Cyrill Gorcunov via Tarantool-patches
2021-10-20  6:35       ` Serge Petrenko via Tarantool-patches
2021-10-21 22:06         ` Vladislav Shpilevoy via Tarantool-patches
2021-10-22  6:36           ` Serge Petrenko via Tarantool-patches
2021-10-21 22:06   ` Vladislav Shpilevoy via Tarantool-patches [this message]
2021-10-22 22:03     ` Cyrill Gorcunov via Tarantool-patches
2021-10-24 15:39       ` Vladislav Shpilevoy via Tarantool-patches
2021-10-24 16:01         ` Cyrill Gorcunov via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e7ff082d-31af-285f-d13f-508dac3e5f91@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v23 3/3] test: add gh-6036-qsync-order test' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox