Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 2.x] Refactoring GatedAutoCloseable and moving RecoveryState.Timer #3014

Merged
merged 1 commit into from
Apr 21, 2022

Commits on Apr 20, 2022

  1. Refactoring GatedAutoCloseable and moving RecoveryState.Timer (#2965)

    * Refactoring GatedAutoCloseable to AutoCloseableRefCounted
    
    This is a part of the process of merging our feature branch - feature/segment-replication - back into main by re-PRing our changes from the feature branch.
    GatedAutoCloseable currently wraps a subclass of RefCounted. Segment replication adds another subclass, but this also wraps RefCounted. Both subclasses have the same shutdown hook - decRef. This change makes the superclass less generic to increase code convergence.
    
    The breakdown of the plan to merge segment-replication to main is detailed in #2355
    Segment replication design proposal - #2229
    
    Signed-off-by: Kartik Ganesh <gkart@amazon.com>
    
    * Minor refactoring in RecoveryState
    
    This change makes two minor updates to RecoveryState -
    1. The readRecoveryState API is removed because it can be replaced by an invocation of the constructor
    2. The class members of the Timer inner class are changed to private, and accesses are only through the public APIs
    
    Signed-off-by: Kartik Ganesh <gkart@amazon.com>
    
    * Update RecoveryTargetTests to test Timer subclasses deterministically
    
    This change removes the use of RandomBoolean in testing the Timer classes and creates a dedicated unit test for each. The common test logic is shared via a private method.
    
    Signed-off-by: Kartik Ganesh <gkart@amazon.com>
    
    * Move the RecoveryState.Timer class to a top-level class
    
    This will eventually be reused across both replication use-cases - peer recovery and segment replication.
    
    Signed-off-by: Kartik Ganesh <gkart@amazon.com>
    
    * Further update of timer tests in RecoveryTargetTests
    
    Removes a non-deterministic code path around stopping the timer, and avoids assertThat (deprecated)
    
    Signed-off-by: Kartik Ganesh <gkart@amazon.com>
    
    * Rename to ReplicationTimer
    
    Signed-off-by: Kartik Ganesh <gkart@amazon.com>
    
    * Remove RecoveryTargetTests assert on a running timer
    
    Trying to serialize and deserialize a running Timer instance, and then checking for equality leads to flaky test failures when the ser/deser takes time.
    
    Signed-off-by: Kartik Ganesh <gkart@amazon.com>
    (cherry picked from commit c7c410a)
    kartg authored and github-actions[bot] committed Apr 20, 2022
    Configuration menu
    Copy the full SHA
    7bd6232 View commit details
    Browse the repository at this point in the history