Mano Kovacs created SOLR-10151:
----------------------------------

             Summary: TestRecovery.java - use monotonic increasing version 
number among all the tests to avoid unintentional reordering
                 Key: SOLR-10151
                 URL: https://issues.apache.org/jira/browse/SOLR-10151
             Project: Solr
          Issue Type: Test
      Security Level: Public (Default Security Level. Issues are Public)
            Reporter: Mano Kovacs
            Priority: Minor


{{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 intentional reordering.

h5. Example:
Before:
{noformat}
...
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));
...
{noformat}
After:
{noformat}
...
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));
...
{noformat}

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



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to