sodonnel opened a new pull request, #3363:
URL: https://github.com/apache/ozone/pull/3363

   ## What changes were proposed in this pull request?
   
   There are a couple of places in the new scrubber code and the existing 
scrubber code in PipelineManagerImpl, where it uses Time.monotonicNow() to 
decide if the Safemode interval has passed, or if a pipeline has been Closed 
long enough etc. The unit tests do not correctly test these scenarios, as we 
just set the time to zero so there is no delay, otherwise the tests would need 
sleep calls, which will make them slow.
   
   In ReplicationManager, we addressed this problem by injecting a Clock 
dependency. See MonotonicClock - if we inject this as a dependency to the 
scrubber code, then we can inject a MonotonicClock for runtime, but inject 
TestClock for tests. Then you can properly test the safemode delay by advancing 
the clock between check calls. Same for pipelines - we can check ALLOCATED ones 
are not removed before the delay, and then check they are scrubbed after the 
delay.
   
   In general, we should try to avoid calls to Time.monotonicNow() across the 
codebase, and instead inject a clock as a dependency to make the code more 
testable without sleeps.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-6655
   
   ## How was this patch tested?
   
   Modified tests.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to