Lucene - Core
  1. Lucene - Core
  2. LUCENE-6823

Remove use of System.currentTimeMillis() from LocalReplicator

    Details

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

      Description

      LocalReplicator uses System.currentTimeMillis() for session expiry, which is not guaranteed monotonic.

      1. LUCENE-6823.patch
        1 kB
        Ishan Chattopadhyaya
      2. LUCENE-6823.patch
        1.0 kB
        Ishan Chattopadhyaya

        Activity

        Hide
        Ishan Chattopadhyaya added a comment -

        Patch to replace it with System.nanoTime()/1000000.

        Show
        Ishan Chattopadhyaya added a comment - Patch to replace it with System.nanoTime()/1000000.
        Hide
        Steve Rowe added a comment -

        Ishan Chattopadhyaya, it's better to convert between time units using TimeUnit.TARGETUNIT.convert(sourceDuration, TimeUnit.SOURCEUNIT), rather than using hard-coded conversion constants, which could be accidentally wrong. E.g. to convert from nanos to millis: TimeUnit.MILLISECONDS.convert(nanoseconds, TimeUnit.NANOSECONDS).

        Show
        Steve Rowe added a comment - Ishan Chattopadhyaya , it's better to convert between time units using TimeUnit.TARGETUNIT.convert(sourceDuration, TimeUnit.SOURCEUNIT) , rather than using hard-coded conversion constants, which could be accidentally wrong. E.g. to convert from nanos to millis: TimeUnit.MILLISECONDS.convert(nanoseconds, TimeUnit.NANOSECONDS) .
        Hide
        Ishan Chattopadhyaya added a comment -

        Thanks for the pointer, Steve Rowe. I copied it from ControlledRealTimeReopenThread's line 179:

              long startMS = System.nanoTime()/1000000;
        

        I'll add another patch.

        Show
        Ishan Chattopadhyaya added a comment - Thanks for the pointer, Steve Rowe . I copied it from ControlledRealTimeReopenThread's line 179: long startMS = System.nanoTime()/1000000; I'll add another patch.
        Hide
        Ishan Chattopadhyaya added a comment -

        Updated patch.

        Show
        Ishan Chattopadhyaya added a comment - Updated patch.
        Hide
        Michael McCandless added a comment -

        Thanks Ishan Chattopadhyaya, patch looks good, I'll commit shortly.

        Show
        Michael McCandless added a comment - Thanks Ishan Chattopadhyaya , patch looks good, I'll commit shortly.
        Hide
        ASF subversion and git services added a comment -

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

        LUCENE-6823: use System.nanoTime for expiration in LocalReplicator

        Show
        ASF subversion and git services added a comment - Commit 1707683 from Michael McCandless in branch 'dev/trunk' [ https://svn.apache.org/r1707683 ] LUCENE-6823 : use System.nanoTime for expiration in LocalReplicator
        Hide
        ASF subversion and git services added a comment -

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

        LUCENE-6823: use System.nanoTime for expiration in LocalReplicator

        Show
        ASF subversion and git services added a comment - Commit 1707684 from Michael McCandless in branch 'dev/branches/branch_5x' [ https://svn.apache.org/r1707684 ] LUCENE-6823 : use System.nanoTime for expiration in LocalReplicator
        Hide
        Michael McCandless added a comment -
        Show
        Michael McCandless added a comment - Thanks Ishan Chattopadhyaya !

          People

          • Assignee:
            Unassigned
            Reporter:
            Ishan Chattopadhyaya
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development