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

JavaDocs of Directory.renameFile are misleading

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Not A Problem
    • None
    • None
    • general/javadocs
    • None
    • New

    Description

      The java docs of org.apache.lucene.store.Directory#renameFile read:

      • Renames {@code source}

        to

        {@code dest} as an atomic operation,
        * where {@code dest}

        does not yet exist in the directory.

      However in FSDirectory we do:

      Files.move(directory.resolve(source), directory.resolve(dest), StandardCopyOption.ATOMIC_MOVE);

      That one does not give us the documented behavior. From the javadocs of Files.move, with StandardCopyOption.ATOMIC_MOVE:
      The move is performed as an atomic file system operation and all other options are ignored. If the target file exists then it is implementation specific if the existing file is replaced or this method fails by throwing an IOException.

      I think the use of atomic moves is good here but it means the java docs of the Directory.renameFiles should be changed and relax the guarantee.

      Attachments

        Activity

          People

            Unassigned Unassigned
            bleskes Boaz Leskes
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: