You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2021/04/27 15:58:45 UTC

[couchdb] branch fix-flaky-couch-jobs-metadata-test created (now de5c24d)

This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a change to branch fix-flaky-couch-jobs-metadata-test
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


      at de5c24d  Fix flaky couch_jobs metadata test

This branch includes the following new commits:

     new de5c24d  Fix flaky couch_jobs metadata test

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[couchdb] 01/01: Fix flaky couch_jobs metadata test

Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch fix-flaky-couch-jobs-metadata-test
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit de5c24da490cc9a6012e36a4b6078e75b8849690
Author: Nick Vatamaniuc <va...@gmail.com>
AuthorDate: Tue Apr 27 11:53:33 2021 -0400

    Fix flaky couch_jobs metadata test
    
    Previously we deleted the ets handle cache, then bumped the FDB metadata. That
    has a race condition if anything else, like fabric2_indexing or other
    couch_jobs users, tried to get a jtx() handle before the metadata bump. In that
    case, they would have re-inserted a handle with a stale `md_version` and the
    test assertions would fail.
    
    The fix is to first bump the md version, then delete the handles.
---
 src/couch_jobs/test/couch_jobs_tests.erl | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/couch_jobs/test/couch_jobs_tests.erl b/src/couch_jobs/test/couch_jobs_tests.erl
index d006672..9f3a372 100644
--- a/src/couch_jobs/test/couch_jobs_tests.erl
+++ b/src/couch_jobs/test/couch_jobs_tests.erl
@@ -757,13 +757,15 @@ metadata_version_bump(_) ->
     JTx1 = couch_jobs_fdb:tx(couch_jobs_fdb:get_jtx(), fun(Tx) -> Tx end),
     ?assertMatch(#{md_version := not_found}, JTx1),
 
-    ets:delete_all_objects(couch_jobs_fdb),
     couch_jobs_fdb:bump_metadata_version(),
+    ets:delete_all_objects(couch_jobs_fdb),
+
     JTx2 = couch_jobs_fdb:tx(couch_jobs_fdb:get_jtx(), fun(Tx) -> Tx end),
     ?assertMatch(#{md_version := Bin} when is_binary(Bin), JTx2),
 
-    ets:delete_all_objects(couch_jobs_fdb),
     couch_jobs_fdb:bump_metadata_version(),
+    ets:delete_all_objects(couch_jobs_fdb),
+
     JTx3 = couch_jobs_fdb:tx(couch_jobs_fdb:get_jtx(), fun(Tx) -> Tx end),
     OldMdv = maps:get(md_version, JTx2),
     NewMdv = maps:get(md_version, JTx3),