You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2018/08/28 06:51:41 UTC
[1/2] lucene-solr:branch_7x: LUCENE-8467: RAMDirectory, RAMFile,
RAMInputStream, RAMOutputStream are deprecated.
Repository: lucene-solr
Updated Branches:
refs/heads/branch_7x 9e378895d -> 4a718dd4b
refs/heads/master 04a50b6a2 -> a452dd9ce
LUCENE-8467: RAMDirectory, RAMFile, RAMInputStream, RAMOutputStream are deprecated.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/4a718dd4
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/4a718dd4
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/4a718dd4
Branch: refs/heads/branch_7x
Commit: 4a718dd4b30c35a235c5726fa864881bc290b681
Parents: 9e37889
Author: Dawid Weiss <dw...@apache.org>
Authored: Tue Aug 28 08:49:17 2018 +0200
Committer: Dawid Weiss <dw...@apache.org>
Committed: Tue Aug 28 08:49:17 2018 +0200
----------------------------------------------------------------------
lucene/CHANGES.txt | 3 +++
lucene/MIGRATE.txt | 8 ++++++++
.../src/java/org/apache/lucene/store/RAMDirectory.java | 5 +++++
.../core/src/java/org/apache/lucene/store/RAMFile.java | 8 +++++++-
.../java/org/apache/lucene/store/RAMInputStream.java | 12 +++++++++---
.../java/org/apache/lucene/store/RAMOutputStream.java | 4 ++++
6 files changed, 36 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4a718dd4/lucene/CHANGES.txt
----------------------------------------------------------------------
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index dcb6282..ad8e02f 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -7,6 +7,9 @@ http://s.apache.org/luceneversions
API Changes:
+* LUCENE-8467: RAMDirectory, RAMFile, RAMInputStream, RAMOutputStream are deprecated
+ (Dawid Weiss)
+
* LUCENE-8356: StandardFilter is deprecated (Alan Woodward)
* LUCENE-8373: ENGLISH_STOP_WORD_SET on StandardAnalyzer is deprecated. Instead
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4a718dd4/lucene/MIGRATE.txt
----------------------------------------------------------------------
diff --git a/lucene/MIGRATE.txt b/lucene/MIGRATE.txt
index 8653970..a7cbfb8 100644
--- a/lucene/MIGRATE.txt
+++ b/lucene/MIGRATE.txt
@@ -149,3 +149,11 @@ attributes.
This query matches only documents that have a value for the specified doc
values field.
+
+## RAMDirectory, RAMFile, RAMInputStream, RAMOutputStream are deprecated ##
+
+This RAM-based directory implementation is an old piece of code that uses inefficient
+thread synchronization primitives and can be confused as "faster" than the NIO-based
+MMapDirectory. It is deprecated and scheduled for removal in future versions of
+Lucene. (LUCENE-8467, LUCENE-8438)
+
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4a718dd4/lucene/core/src/java/org/apache/lucene/store/RAMDirectory.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/store/RAMDirectory.java b/lucene/core/src/java/org/apache/lucene/store/RAMDirectory.java
index 3c2bed2..8d2dcf3 100644
--- a/lucene/core/src/java/org/apache/lucene/store/RAMDirectory.java
+++ b/lucene/core/src/java/org/apache/lucene/store/RAMDirectory.java
@@ -49,7 +49,12 @@ import org.apache.lucene.util.Accountables;
* {@link MMapDirectory}, which is a high-performance directory
* implementation working directly on the file system cache of the
* operating system, so copying data to Java heap space is not useful.
+ *
+ * @deprecated This class uses inefficient synchronization and is discouraged
+ * in favor of {@link MMapDirectory}. It will be removed in future versions
+ * of Lucene.
*/
+@Deprecated
public class RAMDirectory extends BaseDirectory implements Accountable {
protected final Map<String,RAMFile> fileMap = new ConcurrentHashMap<>();
protected final AtomicLong sizeInBytes = new AtomicLong();
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4a718dd4/lucene/core/src/java/org/apache/lucene/store/RAMFile.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/store/RAMFile.java b/lucene/core/src/java/org/apache/lucene/store/RAMFile.java
index d8ae693..d4fd014 100644
--- a/lucene/core/src/java/org/apache/lucene/store/RAMFile.java
+++ b/lucene/core/src/java/org/apache/lucene/store/RAMFile.java
@@ -24,7 +24,13 @@ import org.apache.lucene.util.Accountable;
/**
* Represents a file in RAM as a list of byte[] buffers.
- * @lucene.internal */
+ *
+ * @lucene.internal
+ * @deprecated This class uses inefficient synchronization and is discouraged
+ * in favor of {@link MMapDirectory}. It will be removed in future versions
+ * of Lucene.
+ */
+@Deprecated
public class RAMFile implements Accountable {
protected final ArrayList<byte[]> buffers = new ArrayList<>();
long length;
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4a718dd4/lucene/core/src/java/org/apache/lucene/store/RAMInputStream.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/store/RAMInputStream.java b/lucene/core/src/java/org/apache/lucene/store/RAMInputStream.java
index 7c8c7a3..cb07b6e 100644
--- a/lucene/core/src/java/org/apache/lucene/store/RAMInputStream.java
+++ b/lucene/core/src/java/org/apache/lucene/store/RAMInputStream.java
@@ -22,9 +22,15 @@ import java.io.IOException;
import static org.apache.lucene.store.RAMOutputStream.BUFFER_SIZE;
-/** A memory-resident {@link IndexInput} implementation.
- *
- * @lucene.internal */
+/**
+ * A memory-resident {@link IndexInput} implementation.
+ *
+ * @lucene.internal
+ * @deprecated This class uses inefficient synchronization and is discouraged
+ * in favor of {@link MMapDirectory}. It will be removed in future versions
+ * of Lucene.
+ */
+@Deprecated
public class RAMInputStream extends IndexInput implements Cloneable {
private final RAMFile file;
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4a718dd4/lucene/core/src/java/org/apache/lucene/store/RAMOutputStream.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/store/RAMOutputStream.java b/lucene/core/src/java/org/apache/lucene/store/RAMOutputStream.java
index 3477fe4..02dc843 100644
--- a/lucene/core/src/java/org/apache/lucene/store/RAMOutputStream.java
+++ b/lucene/core/src/java/org/apache/lucene/store/RAMOutputStream.java
@@ -30,7 +30,11 @@ import org.apache.lucene.util.Accountables;
* A memory-resident {@link IndexOutput} implementation.
*
* @lucene.internal
+ * @deprecated This class uses inefficient synchronization and is discouraged
+ * in favor of {@link MMapDirectory}. It will be removed in future versions
+ * of Lucene.
*/
+@Deprecated
public class RAMOutputStream extends IndexOutput implements Accountable {
static final int BUFFER_SIZE = 1024;
[2/2] lucene-solr:master: LUCENE-8467: RAMDirectory, RAMFile,
RAMInputStream, RAMOutputStream are deprecated.
Posted by dw...@apache.org.
LUCENE-8467: RAMDirectory, RAMFile, RAMInputStream, RAMOutputStream are deprecated.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/a452dd9c
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/a452dd9c
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/a452dd9c
Branch: refs/heads/master
Commit: a452dd9ce3053fdb9cf8982b071cedbdcd461e36
Parents: 04a50b6
Author: Dawid Weiss <dw...@apache.org>
Authored: Tue Aug 28 08:49:17 2018 +0200
Committer: Dawid Weiss <dw...@apache.org>
Committed: Tue Aug 28 08:51:31 2018 +0200
----------------------------------------------------------------------
lucene/CHANGES.txt | 3 +++
lucene/MIGRATE.txt | 7 +++++++
.../src/java/org/apache/lucene/store/RAMDirectory.java | 5 +++++
.../core/src/java/org/apache/lucene/store/RAMFile.java | 8 +++++++-
.../java/org/apache/lucene/store/RAMInputStream.java | 12 +++++++++---
.../java/org/apache/lucene/store/RAMOutputStream.java | 4 ++++
6 files changed, 35 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/a452dd9c/lucene/CHANGES.txt
----------------------------------------------------------------------
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 3a062af..2dec765 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -147,6 +147,9 @@ Optimizations
API Changes:
+* LUCENE-8467: RAMDirectory, RAMFile, RAMInputStream, RAMOutputStream are deprecated
+ (Dawid Weiss)
+
* LUCENE-8356: StandardFilter is deprecated (Alan Woodward)
* LUCENE-8373: ENGLISH_STOP_WORD_SET on StandardAnalyzer is deprecated. Instead
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/a452dd9c/lucene/MIGRATE.txt
----------------------------------------------------------------------
diff --git a/lucene/MIGRATE.txt b/lucene/MIGRATE.txt
index 7dfe5c7..01e0baa 100644
--- a/lucene/MIGRATE.txt
+++ b/lucene/MIGRATE.txt
@@ -99,3 +99,10 @@ IndexSearcher's search and searchAfter methods were changed to only count hits
accurately up to 1,000, and Topdocs.totalHits was changed from a long to an
object that says whether the hit count is accurate or a lower bound of the
actual hit count.
+
+## RAMDirectory, RAMFile, RAMInputStream, RAMOutputStream are deprecated ##
+
+This RAM-based directory implementation is an old piece of code that uses inefficient
+thread synchronization primitives and can be confused as "faster" than the NIO-based
+MMapDirectory. It is deprecated and scheduled for removal in future versions of
+Lucene. (LUCENE-8467, LUCENE-8438)
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/a452dd9c/lucene/core/src/java/org/apache/lucene/store/RAMDirectory.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/store/RAMDirectory.java b/lucene/core/src/java/org/apache/lucene/store/RAMDirectory.java
index 3c2bed2..8d2dcf3 100644
--- a/lucene/core/src/java/org/apache/lucene/store/RAMDirectory.java
+++ b/lucene/core/src/java/org/apache/lucene/store/RAMDirectory.java
@@ -49,7 +49,12 @@ import org.apache.lucene.util.Accountables;
* {@link MMapDirectory}, which is a high-performance directory
* implementation working directly on the file system cache of the
* operating system, so copying data to Java heap space is not useful.
+ *
+ * @deprecated This class uses inefficient synchronization and is discouraged
+ * in favor of {@link MMapDirectory}. It will be removed in future versions
+ * of Lucene.
*/
+@Deprecated
public class RAMDirectory extends BaseDirectory implements Accountable {
protected final Map<String,RAMFile> fileMap = new ConcurrentHashMap<>();
protected final AtomicLong sizeInBytes = new AtomicLong();
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/a452dd9c/lucene/core/src/java/org/apache/lucene/store/RAMFile.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/store/RAMFile.java b/lucene/core/src/java/org/apache/lucene/store/RAMFile.java
index d8ae693..d4fd014 100644
--- a/lucene/core/src/java/org/apache/lucene/store/RAMFile.java
+++ b/lucene/core/src/java/org/apache/lucene/store/RAMFile.java
@@ -24,7 +24,13 @@ import org.apache.lucene.util.Accountable;
/**
* Represents a file in RAM as a list of byte[] buffers.
- * @lucene.internal */
+ *
+ * @lucene.internal
+ * @deprecated This class uses inefficient synchronization and is discouraged
+ * in favor of {@link MMapDirectory}. It will be removed in future versions
+ * of Lucene.
+ */
+@Deprecated
public class RAMFile implements Accountable {
protected final ArrayList<byte[]> buffers = new ArrayList<>();
long length;
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/a452dd9c/lucene/core/src/java/org/apache/lucene/store/RAMInputStream.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/store/RAMInputStream.java b/lucene/core/src/java/org/apache/lucene/store/RAMInputStream.java
index 7c8c7a3..cb07b6e 100644
--- a/lucene/core/src/java/org/apache/lucene/store/RAMInputStream.java
+++ b/lucene/core/src/java/org/apache/lucene/store/RAMInputStream.java
@@ -22,9 +22,15 @@ import java.io.IOException;
import static org.apache.lucene.store.RAMOutputStream.BUFFER_SIZE;
-/** A memory-resident {@link IndexInput} implementation.
- *
- * @lucene.internal */
+/**
+ * A memory-resident {@link IndexInput} implementation.
+ *
+ * @lucene.internal
+ * @deprecated This class uses inefficient synchronization and is discouraged
+ * in favor of {@link MMapDirectory}. It will be removed in future versions
+ * of Lucene.
+ */
+@Deprecated
public class RAMInputStream extends IndexInput implements Cloneable {
private final RAMFile file;
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/a452dd9c/lucene/core/src/java/org/apache/lucene/store/RAMOutputStream.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/store/RAMOutputStream.java b/lucene/core/src/java/org/apache/lucene/store/RAMOutputStream.java
index 3477fe4..02dc843 100644
--- a/lucene/core/src/java/org/apache/lucene/store/RAMOutputStream.java
+++ b/lucene/core/src/java/org/apache/lucene/store/RAMOutputStream.java
@@ -30,7 +30,11 @@ import org.apache.lucene.util.Accountables;
* A memory-resident {@link IndexOutput} implementation.
*
* @lucene.internal
+ * @deprecated This class uses inefficient synchronization and is discouraged
+ * in favor of {@link MMapDirectory}. It will be removed in future versions
+ * of Lucene.
*/
+@Deprecated
public class RAMOutputStream extends IndexOutput implements Accountable {
static final int BUFFER_SIZE = 1024;