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

    XMLWordPrintableJSON

Details

    • Test
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 6.6, 7.0
    • None

    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.

      Attachments

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

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: