ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ag...@apache.org
Subject ignite git commit: ignite-5986 Fix failed test in .NET suite.
Date Tue, 29 Aug 2017 09:36:57 GMT
Repository: ignite
Updated Branches:
  refs/heads/master d20f30203 -> 196aded9b


ignite-5986 Fix failed test in .NET suite.

Signed-off-by: Andrey Gura <agura@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/196aded9
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/196aded9
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/196aded9

Branch: refs/heads/master
Commit: 196aded9b8f51bf5700bb3a8b1b3ed0a1a16c9c6
Parents: d20f302
Author: Andrey V. Mashenkov <andrey.mashenkov@gmail.com>
Authored: Tue Aug 29 12:36:30 2017 +0300
Committer: Andrey Gura <agura@apache.org>
Committed: Tue Aug 29 12:36:30 2017 +0300

----------------------------------------------------------------------
 .../query/h2/opt/GridLuceneDirectory.java          |  9 +++++----
 .../processors/query/h2/opt/GridLuceneFile.java    |  6 +++++-
 .../processors/query/h2/opt/GridLuceneIndex.java   | 17 +++++++++++------
 3 files changed, 21 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/196aded9/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridLuceneDirectory.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridLuceneDirectory.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridLuceneDirectory.java
index 3ac9641..f92b510 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridLuceneDirectory.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridLuceneDirectory.java
@@ -133,7 +133,7 @@ public class GridLuceneDirectory extends BaseDirectory implements Accountable
{
     @Override public IndexOutput createOutput(final String name, final IOContext context)
throws IOException {
         ensureOpen();
 
-        GridLuceneFile file = newRAMFile();
+        GridLuceneFile file = newRAMFile(name);
 
         // Lock for using in stream. Will be unlocked on stream closing.
         file.lockRef();
@@ -160,8 +160,8 @@ public class GridLuceneDirectory extends BaseDirectory implements Accountable
{
      *
      * @return New ram file.
      */
-    protected GridLuceneFile newRAMFile() {
-        return new GridLuceneFile(this);
+    protected GridLuceneFile newRAMFile(String filename) {
+        return new GridLuceneFile(this, filename);
     }
 
     /** {@inheritDoc} */
@@ -198,7 +198,8 @@ public class GridLuceneDirectory extends BaseDirectory implements Accountable
{
             }
             catch (IOException e) {
                 if (errs == null)
-                    errs = new IgniteException("Error closing index directory.");
+                    errs = new IgniteException("Failed to close index directory."+
+                    " Some index readers was closed properly, that may leads memory leak.");
 
                 errs.addSuppressed(e);
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/196aded9/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridLuceneFile.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridLuceneFile.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridLuceneFile.java
index d7ae132..8f77f35 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridLuceneFile.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridLuceneFile.java
@@ -37,6 +37,9 @@ public class GridLuceneFile implements Accountable {
     private long length;
 
     /** */
+    private final String name;
+
+    /** */
     private final GridLuceneDirectory dir;
 
     /** */
@@ -53,8 +56,9 @@ public class GridLuceneFile implements Accountable {
      *
      * @param dir Directory.
      */
-    GridLuceneFile(GridLuceneDirectory dir) {
+    GridLuceneFile(GridLuceneDirectory dir, String name) {
         this.dir = dir;
+        this.name = name;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/196aded9/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridLuceneIndex.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridLuceneIndex.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridLuceneIndex.java
index c51eb5d..c9d0159 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridLuceneIndex.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridLuceneIndex.java
@@ -262,14 +262,18 @@ public class GridLuceneIndex implements AutoCloseable {
             throw new IgniteCheckedException(e);
         }
 
-        IndexSearcher searcher = new IndexSearcher(reader);
-
-        MultiFieldQueryParser parser = new MultiFieldQueryParser(idxdFields,
-            writer.getAnalyzer());
+        IndexSearcher searcher;
 
         TopDocs docs;
 
         try {
+            searcher = new IndexSearcher(reader);
+
+            MultiFieldQueryParser parser = new MultiFieldQueryParser(idxdFields,
+                writer.getAnalyzer());
+
+//            parser.setAllowLeadingWildcard(true);
+
             // Filter expired items.
             Query filter = NumericRangeQuery.newLongRange(EXPIRATION_TIME_FIELD_NAME, U.currentTimeMillis(),
                 null, false, false);
@@ -282,6 +286,8 @@ public class GridLuceneIndex implements AutoCloseable {
             docs = searcher.search(query, Integer.MAX_VALUE);
         }
         catch (Exception e) {
+            U.closeQuiet(reader);
+
             throw new IgniteCheckedException(e);
         }
 
@@ -296,8 +302,7 @@ public class GridLuceneIndex implements AutoCloseable {
     /** {@inheritDoc} */
     @Override public void close() {
         U.closeQuiet(writer);
-
-        dir.close();
+        U.close(dir, ctx.log(GridLuceneIndex.class));
     }
 
     /**


Mime
View raw message