Reindex: Remove --output option
This was added when the index system was first built in order to support testing out reindex without overwriting an existing index. I don't think anybody is using it at present. Since reindex is only ever run while the server is shut down, if an admin really needs to point the reindexer at a different location, they can edit the configured location in gerrit.config for index implementations that are configured in this way. Alternatively, for something like Lucene where the index just goes to a directory, they can move the old directory out of the way to keep it as a backup. We don't need yet another way of accomplishing this goal that also clutters up the code. Change-Id: Id5af3318d8a5e537be67e5953a6d43c180ab3095
This commit is contained in:
parent
7209b57cca
commit
5992220391
@ -18,9 +18,6 @@ Rebuilds the secondary index.
|
||||
--schema-version::
|
||||
Schema version to reindex; default is most recent version.
|
||||
|
||||
--output::
|
||||
Prefix for output; path for local disk index, or prefix for remote index.
|
||||
|
||||
--verbose::
|
||||
Output debug information for each change.
|
||||
|
||||
|
@ -143,7 +143,7 @@ public class GerritServer {
|
||||
cfg.setString("gitweb", null, "cgi", "");
|
||||
daemon.setEnableHttpd(desc.httpd());
|
||||
daemon.setLuceneModule(new LuceneIndexModule(
|
||||
ChangeSchemas.getLatest().getVersion(), 0, null));
|
||||
ChangeSchemas.getLatest().getVersion(), 0));
|
||||
daemon.setDatabaseForTesting(ImmutableList.<Module>of(
|
||||
new InMemoryTestingDatabaseModule(cfg)));
|
||||
daemon.start();
|
||||
|
@ -32,7 +32,6 @@ import com.google.common.collect.Sets;
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
import com.google.gerrit.common.Nullable;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||
@ -101,7 +100,6 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@ -159,7 +157,7 @@ public class LuceneChangeIndex implements ChangeIndex {
|
||||
}
|
||||
|
||||
static interface Factory {
|
||||
LuceneChangeIndex create(Schema<ChangeData> schema, String base);
|
||||
LuceneChangeIndex create(Schema<ChangeData> schema);
|
||||
}
|
||||
|
||||
static class GerritIndexWriterConfig {
|
||||
@ -216,8 +214,7 @@ public class LuceneChangeIndex implements ChangeIndex {
|
||||
Provider<ReviewDb> db,
|
||||
ChangeData.Factory changeDataFactory,
|
||||
FillArgs fillArgs,
|
||||
@Assisted Schema<ChangeData> schema,
|
||||
@Assisted @Nullable String base) throws IOException {
|
||||
@Assisted Schema<ChangeData> schema) throws IOException {
|
||||
this.sitePaths = sitePaths;
|
||||
this.fillArgs = fillArgs;
|
||||
this.executor = executor;
|
||||
@ -245,8 +242,7 @@ public class LuceneChangeIndex implements ChangeIndex {
|
||||
closedIndex = new SubIndex(new RAMDirectory(), "ramClosed", closedConfig,
|
||||
searcherFactory);
|
||||
} else {
|
||||
Path dir = base != null ? Paths.get(base)
|
||||
: LuceneVersionManager.getDir(sitePaths, schema);
|
||||
Path dir = LuceneVersionManager.getDir(sitePaths, schema);
|
||||
openIndex = new SubIndex(dir.resolve(CHANGES_OPEN), openConfig,
|
||||
searcherFactory);
|
||||
closedIndex = new SubIndex(dir.resolve(CHANGES_CLOSED), closedConfig,
|
||||
|
@ -32,17 +32,14 @@ import org.eclipse.jgit.lib.Config;
|
||||
public class LuceneIndexModule extends LifecycleModule {
|
||||
private final Integer singleVersion;
|
||||
private final int threads;
|
||||
private final String base;
|
||||
|
||||
public LuceneIndexModule() {
|
||||
this(null, 0, null);
|
||||
this(null, 0);
|
||||
}
|
||||
|
||||
public LuceneIndexModule(Integer singleVersion, int threads,
|
||||
String base) {
|
||||
public LuceneIndexModule(Integer singleVersion, int threads) {
|
||||
this.singleVersion = singleVersion;
|
||||
this.threads = threads;
|
||||
this.base = base;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -50,7 +47,7 @@ public class LuceneIndexModule extends LifecycleModule {
|
||||
factory(LuceneChangeIndex.Factory.class);
|
||||
factory(OnlineReindexer.Factory.class);
|
||||
install(new IndexModule(threads));
|
||||
if (singleVersion == null && base == null) {
|
||||
if (singleVersion == null) {
|
||||
install(new MultiVersionModule());
|
||||
} else {
|
||||
install(new SingleVersionModule());
|
||||
@ -82,7 +79,7 @@ public class LuceneIndexModule extends LifecycleModule {
|
||||
Schema<ChangeData> schema = singleVersion != null
|
||||
? ChangeSchemas.get(singleVersion)
|
||||
: ChangeSchemas.getLatest();
|
||||
return factory.create(schema, base);
|
||||
return factory.create(schema);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -157,12 +157,12 @@ public class LuceneVersionManager implements LifecycleListener {
|
||||
}
|
||||
|
||||
markNotReady(cfg, versions.values(), write);
|
||||
LuceneChangeIndex searchIndex = indexFactory.create(search.schema, null);
|
||||
LuceneChangeIndex searchIndex = indexFactory.create(search.schema);
|
||||
indexes.setSearchIndex(searchIndex);
|
||||
for (Version v : write) {
|
||||
if (v.schema != null) {
|
||||
if (v.version != search.version) {
|
||||
indexes.addWriteIndex(indexFactory.create(v.schema, null));
|
||||
indexes.addWriteIndex(indexFactory.create(v.schema));
|
||||
} else {
|
||||
indexes.addWriteIndex(searchIndex);
|
||||
}
|
||||
|
@ -59,9 +59,6 @@ public class Reindex extends SiteProgram {
|
||||
usage = "Schema version to reindex; default is most recent version")
|
||||
private Integer version;
|
||||
|
||||
@Option(name = "--output", usage = "Prefix for output; path for local disk index, or prefix for remote index")
|
||||
private String outputBase;
|
||||
|
||||
@Option(name = "--verbose", usage = "Output debug information for each change")
|
||||
private boolean verbose;
|
||||
|
||||
@ -127,7 +124,7 @@ public class Reindex extends SiteProgram {
|
||||
Module changeIndexModule;
|
||||
switch (IndexModule.getIndexType(dbInjector)) {
|
||||
case LUCENE:
|
||||
changeIndexModule = new LuceneIndexModule(version, threads, outputBase);
|
||||
changeIndexModule = new LuceneIndexModule(version, threads);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("unsupported index.type");
|
||||
|
@ -239,9 +239,8 @@ public class InMemoryModule extends FactoryModule {
|
||||
"invalid index.lucene.testVersion %s", version);
|
||||
Class<?> clazz =
|
||||
Class.forName("com.google.gerrit.lucene.LuceneIndexModule");
|
||||
Constructor<?> c =
|
||||
clazz.getConstructor(Integer.class, int.class, String.class);
|
||||
return (Module) c.newInstance(version, 0, null);
|
||||
Constructor<?> c = clazz.getConstructor(Integer.class, int.class);
|
||||
return (Module) c.newInstance(version, 0);
|
||||
} catch (ClassNotFoundException | SecurityException | NoSuchMethodException
|
||||
| IllegalArgumentException | InstantiationException
|
||||
| IllegalAccessException | InvocationTargetException e) {
|
||||
|
Loading…
Reference in New Issue
Block a user