Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

LUCENE-6770: Add javadocs that FSDirectory canonicalizes the path

Uwe Schindler15a3efcd908d
diff --git a/lucene/core/src/java/org/apache/lucene/store/FSDirectory.java b/lucene/core/src/java/org/apache/lucene/store/FSDirectory.java
index e9c38379c25..2e5c274c705 100644
--- a/lucene/core/src/java/org/apache/lucene/store/FSDirectory.java
+++ b/lucene/core/src/java/org/apache/lucene/store/FSDirectory.java
@@ -117,6 +117,12 @@ public abstract class FSDirectory extends BaseDirectory {
/** Create a new FSDirectory for the named location (ctor for subclasses).
* The directory is created at the named location if it does not yet exist.
+ *
+ * <p>{@code FSDirectory} resolves the given Path to a canonical /
+ * real path to ensure it can correctly lock the index directory and no other process
+ * can interfere with changing possible symlinks to the index directory inbetween.
+ * If you want to use symlinks and change them dynamically, close all
+ * {@code IndexWriters} and create a new {@code FSDirecory} instance.
* @param path the path of the directory
* @param lockFactory the lock factory to use, or null for the default
* ({@link NativeFSLockFactory});
@@ -135,6 +141,12 @@ public abstract class FSDirectory extends BaseDirectory {
* best implementation given the current environment.
* The directory returned uses the {@link NativeFSLockFactory}.
* The directory is created at the named location if it does not yet exist.
+ *
+ * <p>{@code FSDirectory} resolves the given Path when calling this method to a canonical /
+ * real path to ensure it can correctly lock the index directory and no other process
+ * can interfere with changing possible symlinks to the index directory inbetween.
+ * If you want to use symlinks and change them dynamically, close all
+ * {@code IndexWriters} and create a new {@code FSDirecory} instance.
*
* <p>Currently this returns {@link MMapDirectory} for Linux, MacOSX, Solaris,
* and Windows 64-bit JREs, {@link NIOFSDirectory} for other