Scan index directory to determine Lucene versions

Mark index versions as "ready" when they are fully indexed and the
server is not running (i.e. from Reindex). By default, search from the
most recent ready index version, and write to both the most recent
ready version and (if different) the most recent known version.

At server startup, mark all versions except those we are about to
start writing to as not ready.

Change-Id: Icf42a3eb27b0445899300d60941cd701a8072d41
This commit is contained in:
Dave Borowitz
2013-06-26 08:17:28 -06:00
parent f7cbbe8017
commit d103b2b61c
14 changed files with 372 additions and 202 deletions

View File

@@ -16,11 +16,11 @@ package com.google.gerrit.server.index;
import com.google.common.util.concurrent.ListeningScheduledExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.gerrit.lifecycle.LifecycleModule;
import com.google.gerrit.server.config.GerritServerConfig;
import com.google.gerrit.server.git.WorkQueue;
import com.google.gerrit.server.git.WorkQueue.Executor;
import com.google.gerrit.server.query.change.ChangeQueryRewriter;
import com.google.inject.AbstractModule;
import com.google.inject.Injector;
import com.google.inject.Key;
import com.google.inject.Provides;
@@ -34,7 +34,7 @@ import org.eclipse.jgit.lib.Config;
* This module should not be used directly except by specific secondary indexer
* implementations (e.g. Lucene).
*/
public class IndexModule extends AbstractModule {
public class IndexModule extends LifecycleModule {
public enum IndexType {
SQL, LUCENE, SOLR;
}
@@ -57,6 +57,8 @@ public class IndexModule extends AbstractModule {
bind(ChangeIndexer.class).to(ChangeIndexerImpl.class);
bind(ChangeQueryRewriter.class).to(IndexRewriteImpl.class);
bind(IndexRewriteImpl.BasicRewritesImpl.class);
bind(IndexCollection.class);
listener().to(IndexCollection.class);
}
@Provides