Don't return futures from ChangeIndex methods
In I1b3c5ba0 ChangeIndex.replace was modified to return a future, but ChangeIndexer.Task was not changed to call those futures before returning. In retrospect this was a mistake anyway. The only path by which these methods are currently called is from ChangeIndexerImpl, which turns around and wraps them in a Callable and submits them to the same executor, tying up twice as many threads as necessary. Similarly, to avoid additional fanout in ChangeIndexerImpl, we should not write to multiple index versions in parallel, so remove the TODO to try that. The current behavior slows down individual writes for the relatively short period of an online version upgrade, but that is acceptable given the improved thread utilization overall. Change-Id: I5fff470214ecd69a261dec1c10b9f7bdd0a1907e
This commit is contained in:
@@ -22,8 +22,6 @@ import static com.google.gerrit.solr.IndexVersionCheck.solrIndexConfig;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.gerrit.extensions.events.LifecycleListener;
|
||||
import com.google.gerrit.lucene.QueryBuilder;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
@@ -126,7 +124,7 @@ class SolrChangeIndex implements ChangeIndex, LifecycleListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListenableFuture<Void> insert(ChangeData cd) throws IOException {
|
||||
public void insert(ChangeData cd) throws IOException {
|
||||
String id = cd.getId().toString();
|
||||
SolrInputDocument doc = toDocument(cd);
|
||||
try {
|
||||
@@ -142,11 +140,10 @@ class SolrChangeIndex implements ChangeIndex, LifecycleListener {
|
||||
}
|
||||
commit(openIndex);
|
||||
commit(closedIndex);
|
||||
return Futures.immediateFuture(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListenableFuture<Void> replace(ChangeData cd) throws IOException {
|
||||
public void replace(ChangeData cd) throws IOException {
|
||||
String id = cd.getId().toString();
|
||||
SolrInputDocument doc = toDocument(cd);
|
||||
try {
|
||||
@@ -162,11 +159,10 @@ class SolrChangeIndex implements ChangeIndex, LifecycleListener {
|
||||
}
|
||||
commit(openIndex);
|
||||
commit(closedIndex);
|
||||
return Futures.immediateFuture(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListenableFuture<Void> delete(ChangeData cd) throws IOException {
|
||||
public void delete(ChangeData cd) throws IOException {
|
||||
String id = cd.getId().toString();
|
||||
try {
|
||||
if (cd.getChange().getStatus().isOpen()) {
|
||||
@@ -176,7 +172,6 @@ class SolrChangeIndex implements ChangeIndex, LifecycleListener {
|
||||
closedIndex.deleteById(id);
|
||||
commit(closedIndex);
|
||||
}
|
||||
return Futures.immediateFuture(null);
|
||||
} catch (SolrServerException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user