Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-16843

timestamp issue with autoscaling framework

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 8.11
    • None
    • AutoScaling

    Description

      The framework does not exist anymore with Solr 9+, so this bug only impacts Solr 8.x.
       
      Triggers in autoscaling framework use timestamps returned by the JVM call System.nanoTime(), but according to the Javadoc, this is NOT an absolute timestamp. This is just a number relative to a random origin, and this origin will change each time the JVM is restarted.
       
      I figured out this impacts at least the following triggers (with basically the same pattern), 

      • IndexSizeTrigger
      • MetricTrigger
      • SearchRateTrigger
         
        These triggers want to fire an event when a certain condition (depending on each trigger) is met for a certain period of time. They maintain a map with [what, timestamp] entries to track a short term history, with the option to remove an entry if the condition is not met anymore, so we don't trigger any event.
        Timestamps come from System.nanoTime(). So far so good as long as we compare these timestamps to each others in the same JVM. Now, this map is persisted in Zookeeper in case of an overseer change (written and read by TriggerBase.saveState() and restoreState()). With an overseer change, the nanoTime() origin is randomly moved to something else. Consequently, all the persisted timestamps from the previous overseer cannot be compared with the current JVM "clock".
        This ends in triggers never being fired, or being fired without waiting for the time configured.
         
         
        Simple fix could be to always use TimeSource.getEpochTimeNs() instead of getTimeNs() in autoscaling code.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              pierre.salagnac Pierre Salagnac
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 10m
                  10m