Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-24440 Prevent temporal misordering on timescales smaller than one clock tick
  3. HBASE-25911

Fix uses of System.currentTimeMillis (should be EnvironmentEdgeManager.currentTime)

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 3.0.0-alpha-1, 2.5.0
    • None
    • None
    • Reviewed

    Description

      We introduced EnvironmentEdgeManager a long time ago as a way to inject alternate clocks (gettimeofday() aka System.currentTimeMillis()) for unit tests. In order for this to be effective, all callers that would otherwise use System.currentTimeMillis() must call EnvironmentEdgeManager.currentTime() instead, except obviously the implementors of EnvironmentEdge.

      It's common for contributors to be unaware of this practice and reviewers might not catch it.

      It will be much more important to have EnvironmentEdgeManager in use where expected once we have EnvironmentEdge also providing a monotonic clock source. (See parent.)

      On another subtask I will introduce a build enforcer that bans System.currentTimeMillis() except where annotated to allow it.

       

      Attachments

        Issue Links

          Activity

            People

              apurtell Andrew Kyle Purtell
              apurtell Andrew Kyle Purtell
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: