You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by cs...@apache.org on 2015/04/22 14:50:50 UTC

[1/2] maven-indexer git commit: Indexing a repository with the indexer-cli (using -i and -r parameters) creates an empty packed index.

Repository: maven-indexer
Updated Branches:
  refs/heads/master 7bcf5312e -> ac19770a3


Indexing a repository with the indexer-cli (using -i and -r parameters) creates an empty packed index.

Caused by the fact that the IndexSearcher obtained before indexer.scan() is called is the same one that is passed to the IndexPackingUpdate, however, once indexer.scan() is executed, the context's (directory) content is replaced with the temporay one (used for downloading) but the previously returned IndexSearcher is invalidated by the DefaultIndexingContext.openAndWarmup() method that is called for the new index directory. Any packing operation that is attempted from this point will produce an empty packed index instead of using the actual index content produced by the indexer.scan() method.

Fixed by acquireing the indexSearcher *after* the indexer.scan() method finishes, so that the pack operation works with the actual data and produces a proper packed index.


Project: http://git-wip-us.apache.org/repos/asf/maven-indexer/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-indexer/commit/3241c273
Tree: http://git-wip-us.apache.org/repos/asf/maven-indexer/tree/3241c273
Diff: http://git-wip-us.apache.org/repos/asf/maven-indexer/diff/3241c273

Branch: refs/heads/master
Commit: 3241c273d2d8acf4fb07899beffbfaf7fe083ebd
Parents: 1c2af7a
Author: Eduard Moraru <En...@gmail.com>
Authored: Mon Jan 12 15:43:57 2015 +0200
Committer: Eduard Moraru <En...@gmail.com>
Committed: Mon Jan 12 15:43:57 2015 +0200

----------------------------------------------------------------------
 .../apache/maven/index/cli/NexusIndexerCli.java | 28 +++++++++++++-------
 1 file changed, 18 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-indexer/blob/3241c273/indexer-cli/src/main/java/org/apache/maven/index/cli/NexusIndexerCli.java
----------------------------------------------------------------------
diff --git a/indexer-cli/src/main/java/org/apache/maven/index/cli/NexusIndexerCli.java b/indexer-cli/src/main/java/org/apache/maven/index/cli/NexusIndexerCli.java
index dc4a8f7..c140ace 100644
--- a/indexer-cli/src/main/java/org/apache/maven/index/cli/NexusIndexerCli.java
+++ b/indexer-cli/src/main/java/org/apache/maven/index/cli/NexusIndexerCli.java
@@ -352,7 +352,6 @@ public class NexusIndexerCli
             null, // index update url
             indexers );
 
-        final IndexSearcher indexSearcher = context.acquireIndexSearcher();
         try
         {
             IndexPacker packer = plexus.lookup( IndexPacker.class );
@@ -361,21 +360,31 @@ public class NexusIndexerCli
 
             indexer.scan( context, listener, true );
 
-            IndexPackingRequest request = new IndexPackingRequest( context, indexSearcher.getIndexReader(), outputFolder );
+            IndexSearcher indexSearcher = context.acquireIndexSearcher();
 
-            request.setCreateChecksumFiles( createChecksums );
+            try
+            {
+                IndexPackingRequest request =
+                    new IndexPackingRequest(context, indexSearcher.getIndexReader(), outputFolder);
+
+                request.setCreateChecksumFiles(createChecksums);
 
-            request.setCreateIncrementalChunks( createIncrementalChunks );
+                request.setCreateIncrementalChunks(createIncrementalChunks);
 
-            request.setFormats( Arrays.asList( IndexFormat.FORMAT_V1 ) );
+                request.setFormats(Arrays.asList(IndexFormat.FORMAT_V1));
 
-            if ( chunkCount != null )
+                if (chunkCount != null)
+                {
+                    request.setMaxIndexChunks(chunkCount.intValue());
+                }
+
+                packIndex(packer, request, debug, quiet);
+            }
+            finally
             {
-                request.setMaxIndexChunks( chunkCount.intValue() );
+                context.releaseIndexSearcher(indexSearcher);
             }
 
-            packIndex( packer, request, debug, quiet );
-
             if ( !quiet )
             {
                 printStats( tstart );
@@ -383,7 +392,6 @@ public class NexusIndexerCli
         }
         finally
         {
-            context.releaseIndexSearcher( indexSearcher );
             indexer.removeIndexingContext( context, false );
         }
     }


[2/2] maven-indexer git commit: Merge remote-tracking branch 'enygma/fix-indexer-cli-packed-index-output' into pr-10

Posted by cs...@apache.org.
Merge remote-tracking branch 'enygma/fix-indexer-cli-packed-index-output' into pr-10


Project: http://git-wip-us.apache.org/repos/asf/maven-indexer/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-indexer/commit/ac19770a
Tree: http://git-wip-us.apache.org/repos/asf/maven-indexer/tree/ac19770a
Diff: http://git-wip-us.apache.org/repos/asf/maven-indexer/diff/ac19770a

Branch: refs/heads/master
Commit: ac19770a377306d99f4268eae2d3bbb3f304fc45
Parents: 7bcf531 3241c27
Author: Tamas Cservenak <ta...@cservenak.net>
Authored: Wed Apr 22 14:50:28 2015 +0200
Committer: Tamas Cservenak <ta...@cservenak.net>
Committed: Wed Apr 22 14:50:28 2015 +0200

----------------------------------------------------------------------
 .../apache/maven/index/cli/NexusIndexerCli.java | 28 +++++++++++++-------
 1 file changed, 18 insertions(+), 10 deletions(-)
----------------------------------------------------------------------