You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "Patson Luk (Jira)" <ji...@apache.org> on 2023/03/13 19:57:00 UTC

[jira] [Created] (SOLR-16696) Add Breakpoint injection for CommonTestInjection

Patson Luk created SOLR-16696:
---------------------------------

             Summary: Add Breakpoint injection for  CommonTestInjection 
                 Key: SOLR-16696
                 URL: https://issues.apache.org/jira/browse/SOLR-16696
             Project: Solr
          Issue Type: Improvement
      Security Level: Public (Default Security Level. Issues are Public)
          Components: SolrCloud
            Reporter: Patson Luk


While writing test cases to verify our fix on a race condition, we used `CommonTestInjection` to inject artificial delay to trigger the race condition.

However, it's argued that using arbitrary delay to force such condition might not be the most reliable in our case as in certain edge timing condition, the test might not be creating the expected code execution order.

Therefore, we are proposing an extra injection feature in `CommonTestInjection` (PR to follow) that injects a "breakpoint" to hold off certain code execution until certain condition/piece of code is executed:

1. In the code that is susceptible to race condition, we can call `assert CommonTestInjection#injectBreakpoint(String)` which would hold and execute the code defined (see point 2) for such breakpoint IFF assertion is turned on (for unit testing etc). The string here refers to a "Breakpoint key", which could simply be a class name or something more specific.
2. In the unit test case, set the breakpoint using CommonTestInjection#setBreakpoint(String, Breakpoint), Breakpoint is a new interface with a single method void executeAndResume() - Code execution should break at where the breakpoint was injected, then it would execute this method and resumes the execution afterwards


With the above in place, then we can more precisely trigger race condition or even verify caught exception did get triggered as expected. (more details in the PR)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org