Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-10151

TestRecovery.java - use monotonic increasing version number among all the tests to avoid unintentional reordering

    Details

    • Type: Test
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.6, 7.0
    • Component/s: None
    • Security Level: Public (Default Security Level. Issues are Public)
    • Labels:

      Description

      TestRecovery has several tests inserting updates and deletes into a shared core. The tests are using fixed version number which can overlap and can cause issues depending on the order of the tests.

      Proposing using a monotonically incrementing counter for each test and changing tests that they would allocate the used versions would ensure that later running tests would send updates with higher version only. That would prevent any unintentional reordering.

      Example:

      Before:

      ...
      updateJ(jsonAdd(sdoc("id", "RDBQ1_1", "_version_", "1010")), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
      updateJ(jsonDelQ("id:RDBQ1_2"), params(DISTRIB_UPDATE_PARAM, FROM_LEADER, "_version_", "-1017")); // This should've arrived after the 1015th update
      updateJ(jsonAdd(sdoc("id", "RDBQ1_2", "_version_", "1015")), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
      updateJ(jsonAdd(sdoc("id", "RDBQ1_3", "_version_", "1020")), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
      ...
      

      After:

      ...
      String insVer1 = getNextVersion();
      String insVer2 = getNextVersion();
      String deleteVer = getNextVersion();
      String insVer3 = getNextVersion();
      updateJ(jsonAdd(sdoc("id", "RDBQ1_1", "_version_",insVer1)), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
      updateJ(jsonDelQ("id:RDBQ1_2"), params(DISTRIB_UPDATE_PARAM, FROM_LEADER, "_version_", "-"+deleteVer)); // This should've arrived after the 1015th update
      updateJ(jsonAdd(sdoc("id", "RDBQ1_2", "_version_", insVer2)), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
      updateJ(jsonAdd(sdoc("id", "RDBQ1_3", "_version_", insVer3)), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
      ...
      

      It might increase readability as the generation of the versions happen in the preferred replay order.

      1. SOLR_10151.patch
        36 kB
        Peter Szantai-Kis
      2. SOLR-10151.patch
        36 kB
        Peter Szantai-Kis

        Activity

        Hide
        manokovacs Mano Kovacs added a comment - - edited

        Thanks Peter Szantai-Kis for taking the effort.

        I see you are named the version generator method getVersionString. Would it make sense for you to somehow imply that it actually changes the version between invocations? Maybe incrementAndGetVersion or similar?

        Show
        manokovacs Mano Kovacs added a comment - - edited Thanks Peter Szantai-Kis for taking the effort. I see you are named the version generator method getVersionString . Would it make sense for you to somehow imply that it actually changes the version between invocations? Maybe incrementAndGetVersion or similar?
        Hide
        szantaikis Peter Szantai-Kis added a comment -

        Updated patch with method name of "getNextVersion"

        Show
        szantaikis Peter Szantai-Kis added a comment - Updated patch with method name of "getNextVersion"
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 4dc367414fbaa6451a6ef0c5786adebf108c7608 in lucene-solr's branch refs/heads/master from markrmiller
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=4dc3674 ]

        SOLR-10151: Use monotonically incrementing counter for doc ids in TestRecovery.

        Show
        jira-bot ASF subversion and git services added a comment - Commit 4dc367414fbaa6451a6ef0c5786adebf108c7608 in lucene-solr's branch refs/heads/master from markrmiller [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=4dc3674 ] SOLR-10151 : Use monotonically incrementing counter for doc ids in TestRecovery.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 8681dafd521e72e5834765cdc216f7588a8b927c in lucene-solr's branch refs/heads/branch_6x from markrmiller
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=8681daf ]

        SOLR-10151: Use monotonically incrementing counter for doc ids in TestRecovery.

        Show
        jira-bot ASF subversion and git services added a comment - Commit 8681dafd521e72e5834765cdc216f7588a8b927c in lucene-solr's branch refs/heads/branch_6x from markrmiller [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=8681daf ] SOLR-10151 : Use monotonically incrementing counter for doc ids in TestRecovery.
        Hide
        markrmiller@gmail.com Mark Miller added a comment -

        Thanks guys!

        Show
        markrmiller@gmail.com Mark Miller added a comment - Thanks guys!

          People

          • Assignee:
            markrmiller@gmail.com Mark Miller
            Reporter:
            manokovacs Mano Kovacs
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development