Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-7959

Throw more helpful error messages from failures in obtainFSLock, at least in NativeFSLockFactory

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Patch Available
    • Minor
    • Resolution: Fixed
    • None
    • 7.1, 8.0
    • None
    • None
    • New

    Description

      This is one of those small changes that would save a lot of pain for end users.

      Let's say that there's a permissions issue with the index dir. The user will get "NoSuchFileException: write.lock" but not understand why the lock file is missing (its because it could not be created). This is an unhelpful/misleading error message (recent user's list discussion about this).

      The problem is that when we try to create the lock file we swallow all exceptions, not just the one we don't care about (Thanks elyograg for pointing this out).

      {{
      try

      { Files.createFile(lockFile); }

      catch (IOException ignore)

      { // we must create the file to have a truly canonical path. // if it's already created, we don't care. if it cant be created, it will fail below. }

      }}

      It fails later with NoSuchFileException, which does not provide enough information.

      Attachments

        1. LUCENE-7959_untested.patch
          1 kB
          Robert Muir
        2. LUCENE-7959.patch
          4 kB
          Robert Muir

        Activity

          People

            erickerickson Erick Erickson
            erickerickson Erick Erickson
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: