Lucene - Core
  1. Lucene - Core
  2. LUCENE-5948

Improve RateLimiters Initialization semantics

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.10.3, 5.0, 6.0
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      I was working on SOLR-6485 when I realized that the first time pause is called even if we write a lot of bytes pause doesn't work correctly because in SimpleRateLimiter.pause() lastNS is 0 and startNS is always more than targetNS.

      If we remove the following line from TestRateLimiter.testPause() then the test fails -

      limiter.pause(2);//init
      

      Should we do one of the following ?
      1. Initialize lastNS in the ctor

      lastNS = System.nanoTime();

      2. Add a method saying start() which does the same

      1. LUCENE-5948.patch
        1 kB
        Varun Thacker

        Issue Links

          Activity

          Hide
          Michael McCandless added a comment -

          Good catch Varun, I think init'ing lastNS in the ctor is good?

          Show
          Michael McCandless added a comment - Good catch Varun, I think init'ing lastNS in the ctor is good?
          Hide
          Varun Thacker added a comment -

          Thanks for looking into it!

          Patch which initializes lastNS in the ctor and fixes the test to remove the initial pause. All tests pass

          Show
          Varun Thacker added a comment - Thanks for looking into it! Patch which initializes lastNS in the ctor and fixes the test to remove the initial pause. All tests pass
          Hide
          Varun Thacker added a comment -

          Hi Michael McCandless ,

          Can you have a look at the patch and let me know if anything else needs to be done?

          Show
          Varun Thacker added a comment - Hi Michael McCandless , Can you have a look at the patch and let me know if anything else needs to be done?
          Hide
          Michael McCandless added a comment -

          Oh sorry, the patch looks great, I'll commit shortly! Thanks for the reminder Varun Thacker

          Show
          Michael McCandless added a comment - Oh sorry, the patch looks great, I'll commit shortly! Thanks for the reminder Varun Thacker
          Hide
          ASF subversion and git services added a comment -

          Commit 1626556 from Michael McCandless in branch 'dev/trunk'
          [ https://svn.apache.org/r1626556 ]

          LUCENE-5948: RateLimiter fully inits itself on init

          Show
          ASF subversion and git services added a comment - Commit 1626556 from Michael McCandless in branch 'dev/trunk' [ https://svn.apache.org/r1626556 ] LUCENE-5948 : RateLimiter fully inits itself on init
          Hide
          ASF subversion and git services added a comment -

          Commit 1626557 from Michael McCandless in branch 'dev/branches/branch_5x'
          [ https://svn.apache.org/r1626557 ]

          LUCENE-5948: RateLimiter now fully inits itself on init

          Show
          ASF subversion and git services added a comment - Commit 1626557 from Michael McCandless in branch 'dev/branches/branch_5x' [ https://svn.apache.org/r1626557 ] LUCENE-5948 : RateLimiter now fully inits itself on init
          Hide
          Michael McCandless added a comment -

          Thanks Varun!

          Show
          Michael McCandless added a comment - Thanks Varun!
          Hide
          Robert Muir added a comment -

          reopen for backport

          Show
          Robert Muir added a comment - reopen for backport
          Hide
          ASF subversion and git services added a comment -

          Commit 1642627 from Robert Muir in branch 'dev/branches/lucene_solr_4_10'
          [ https://svn.apache.org/r1642627 ]

          LUCENE-5948: RateLimiter now fully inits itself on init

          Show
          ASF subversion and git services added a comment - Commit 1642627 from Robert Muir in branch 'dev/branches/lucene_solr_4_10' [ https://svn.apache.org/r1642627 ] LUCENE-5948 : RateLimiter now fully inits itself on init
          Hide
          Anshum Gupta added a comment -

          Bulk close after 5.0 release.

          Show
          Anshum Gupta added a comment - Bulk close after 5.0 release.

            People

            • Assignee:
              Robert Muir
              Reporter:
              Varun Thacker
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development