Merge "ES: Implement online reindex for ElasticSearch" into stable-2.14

This commit is contained in:
David Pursehouse
2017-04-26 10:40:53 +00:00
committed by Gerrit Code Review
9 changed files with 323 additions and 5 deletions

View File

@@ -43,6 +43,15 @@ public final class IndexUtils {
}
}
public static boolean getReady(SitePaths sitePaths, String name, int version) throws IOException {
try {
GerritIndexStatus cfg = new GerritIndexStatus(sitePaths);
return cfg.getReady(name, version);
} catch (ConfigInvalidException e) {
throw new IOException(e);
}
}
public static Set<String> accountFields(QueryOptions opts) {
Set<String> fs = opts.fields();
return fs.contains(AccountField.ID.getName())

View File

@@ -0,0 +1,24 @@
// Copyright (C) 2015 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.server.index;
public class ReindexerAlreadyRunningException extends Exception {
private static final long serialVersionUID = 1L;
public ReindexerAlreadyRunningException() {
super("Reindexer is already running.");
}
}

View File

@@ -24,6 +24,7 @@ import com.google.inject.Singleton;
import com.google.inject.TypeLiteral;
import com.google.inject.name.Named;
import com.google.inject.name.Names;
import com.google.inject.util.Providers;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
@@ -44,7 +45,7 @@ public class SingleVersionModule extends LifecycleModule {
listener().to(SingleVersionListener.class);
bind(new TypeLiteral<Map<String, Integer>>() {})
.annotatedWith(Names.named(SINGLE_VERSIONS))
.toInstance(singleVersions);
.toProvider(Providers.of(singleVersions));
}
@Singleton