Lucene - Core
  1. Lucene - Core
  2. LUCENE-621

Default lock timeouts should have static setter/getters

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: None
    • Component/s: core/index
    • Labels:
      None

      Description

      We recently stopped using Java system properties to derive defaults for things like the write/commit lock timeout, and switched to getter/setter's across all classes. See here:

      http://www.gossamer-threads.com/lists/lucene/java-dev/27447

      But, in the case at least of the write lock timeout, because it's marked "public final static", a consumer of this API can no longer change this value before instantiating the IndexWriter. This is because the getter/setter for this is not static, which generally makes sense so you can change the timeout for each instance of IndexWriter. But because IndexWriter on construction uses the timeout value, some uses cases need to change the value before getting an instance of IndexWriter.

      This was actually a regression, in that Lucene users lost functionality they previously had, on upgrading.

      I would propose that that we add getter/setter for the default value of this timeout, which would be static. I'll attach a patch file.

      See this thread for context that led to this issue:

      http://www.gossamer-threads.com/lists/lucene/java-dev/37421

      1. IndexWriter.java.diff
        3 kB
        Michael McCandless
      2. TestIndexWriter.java.diff
        0.9 kB
        Michael McCandless

        Activity

        Hide
        Michael McCandless added a comment -

        Small changes to IndexWriter.java to add default (static) getter/setters for COMMIT_LOCK_TIMEOUT and WRITE_LOCK_TIMEOUT.

        Show
        Michael McCandless added a comment - Small changes to IndexWriter.java to add default (static) getter/setters for COMMIT_LOCK_TIMEOUT and WRITE_LOCK_TIMEOUT.
        Hide
        Michael McCandless added a comment -

        Patch to add calls to the new static default setter/getters into the existing TestIndexWriter unit test.

        Show
        Michael McCandless added a comment - Patch to add calls to the new static default setter/getters into the existing TestIndexWriter unit test.
        Hide
        Michael McCandless added a comment -

        Another recent thread that noted the regression in Lucene 2.0:

        http://www.gossamer-threads.com/lists/lucene/java-user/36561

        Show
        Michael McCandless added a comment - Another recent thread that noted the regression in Lucene 2.0: http://www.gossamer-threads.com/lists/lucene/java-user/36561
        Hide
        Hoss Man added a comment -

        patches applied cleanly with no obvious downsides that I could think of.

        commited with some minor javadoc tweaks (added missing "@see" declaration to some javadoc lines in the patch, and aded some new @see declarations to the existing static variables pointing at the new setters)

        Show
        Hoss Man added a comment - patches applied cleanly with no obvious downsides that I could think of. commited with some minor javadoc tweaks (added missing "@see" declaration to some javadoc lines in the patch, and aded some new @see declarations to the existing static variables pointing at the new setters)
        Hide
        Michael McCandless added a comment -

        Wow, thanks for the fast resolution here!

        Show
        Michael McCandless added a comment - Wow, thanks for the fast resolution here!

          People

          • Assignee:
            Unassigned
            Reporter:
            Michael McCandless
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development