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:
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user