aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephane Gamard <stephane.gamard@sonarsource.com>2014-09-22 17:08:42 +0200
committerStephane Gamard <stephane.gamard@sonarsource.com>2014-09-22 17:08:42 +0200
commit8a7965dfbc7c967e199d5cf4f4c83ff8dd81a6c3 (patch)
treeb8cf4ee1232bcd5376fb5801a0901a340d48f626
parentc60e0b1f3a510f8eb6b3f3b4e0f92e61630fa8c9 (diff)
downloadsonarqube-8a7965dfbc7c967e199d5cf4f4c83ff8dd81a6c3.tar.gz
sonarqube-8a7965dfbc7c967e199d5cf4f4c83ff8dd81a6c3.zip
SONAR-5531 - Reverted broken fix for refresh
-rw-r--r--server/sonar-search/src/main/java/org/sonar/search/SearchServer.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/db/BaseDao.java12
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/search/BaseIndex.java10
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/search/Index.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/search/IndexQueue.java65
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/search/SearchClient.java7
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/search/action/IndexActionRequest.java7
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/search/action/IndexWorker.java29
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/search/action/RefreshActionRequest.java55
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/activity/ActivityBackendMediumTest.java10
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/db/BaseDaoTest.java3
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/issue/db/IssueAuthorizationDaoTest.java10
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/search/IndexSynchronizerMediumTest.java1
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/tester/BackendCleanup.java8
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/tester/ServerTester.java1
-rw-r--r--sonar-core/src/main/java/org/sonar/core/cluster/ClusterAction.java5
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/DbSession.java12
17 files changed, 50 insertions, 192 deletions
diff --git a/server/sonar-search/src/main/java/org/sonar/search/SearchServer.java b/server/sonar-search/src/main/java/org/sonar/search/SearchServer.java
index c1b3bb4c150..1433bd71b6e 100644
--- a/server/sonar-search/src/main/java/org/sonar/search/SearchServer.java
+++ b/server/sonar-search/src/main/java/org/sonar/search/SearchServer.java
@@ -88,14 +88,9 @@ public class SearchServer implements Monitored {
.put("discovery.zen.ping.multicast.enabled", "false")
// Index storage policies
- .put("index.refresh_interval", "30")
.put("index.number_of_shards", "1")
.put("index.number_of_replicas", MINIMUM_INDEX_REPLICATION)
.put("index.store.type", "mmapfs")
-// .put("indices.store.throttle.type", "merge")
-// .put("indices.store.throttle.max_bytes_per_sec", "500mb")
- .put("index.merge.scheduler.max_thread_count",
- Math.max(1, Math.min(3, Runtime.getRuntime().availableProcessors() / 2)))
// Install our own listUpdate scripts
.put("script.default_lang", "native")
diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/BaseDao.java b/server/sonar-server/src/main/java/org/sonar/server/db/BaseDao.java
index 37cf02a2034..a87021146bb 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/db/BaseDao.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/db/BaseDao.java
@@ -34,20 +34,15 @@ import org.sonar.server.search.DbSynchronizationHandler;
import org.sonar.server.search.IndexDefinition;
import org.sonar.server.search.action.DeleteKey;
import org.sonar.server.search.action.DeleteNestedItem;
-import org.sonar.server.search.action.RefreshActionRequest;
import org.sonar.server.search.action.UpsertDto;
import org.sonar.server.search.action.UpsertNestedItem;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
+
import java.io.Serializable;
import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import static com.google.common.collect.Maps.newHashMap;
@@ -328,7 +323,7 @@ public abstract class BaseDao<MAPPER, DTO extends Dto<KEY>, KEY extends Serializ
@Override
public void handleResult(ResultContext resultContext) {
DTO dto = (DTO) resultContext.getResultObject();
- session.enqueue(new UpsertDto<DTO>(getIndexType(), dto, false));
+ session.enqueue(new UpsertDto<DTO>(getIndexType(), dto, true));
count++;
if (count % 100000 == 0) {
LOGGER.info(" - synchronized {} {}", count, getIndexType());
@@ -363,7 +358,6 @@ public abstract class BaseDao<MAPPER, DTO extends Dto<KEY>, KEY extends Serializ
DbSynchronizationHandler handler = getSynchronizationResultHandler(session);
session.select(getSynchronizeStatementFQN(), getSynchronizationParams(date, params), handler);
handler.enqueueCollected();
- session.enqueue(new RefreshActionRequest(this.getIndexType()));
} catch (Exception e) {
throw new IllegalStateException(e);
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/search/BaseIndex.java b/server/sonar-server/src/main/java/org/sonar/server/search/BaseIndex.java
index 65c73da1ffa..6faafd538df 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/search/BaseIndex.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/search/BaseIndex.java
@@ -359,6 +359,16 @@ public abstract class BaseIndex<DOMAIN, DTO extends Dto<KEY>, KEY extends Serial
return mapping;
}
+ @Override
+ public void refresh() {
+ client.execute(client
+ .admin()
+ .indices()
+ .prepareRefresh(this.getIndexName())
+ .setForce(false)
+ .setIndices(this.getIndexName()));
+ }
+
/* Base CRUD methods */
protected abstract DOMAIN toDoc(Map<String, Object> fields);
diff --git a/server/sonar-server/src/main/java/org/sonar/server/search/Index.java b/server/sonar-server/src/main/java/org/sonar/server/search/Index.java
index 13acb6a6332..13a7a935c4e 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/search/Index.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/search/Index.java
@@ -38,6 +38,8 @@ public interface Index<DOMAIN, DTO extends Dto<KEY>, KEY extends Serializable> e
String getIndexName();
+ void refresh();
+
Date getLastSynchronization();
IndexStat getIndexStat();
diff --git a/server/sonar-server/src/main/java/org/sonar/server/search/IndexQueue.java b/server/sonar-server/src/main/java/org/sonar/server/search/IndexQueue.java
index d548648af5c..de7636d8596 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/search/IndexQueue.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/search/IndexQueue.java
@@ -20,7 +20,6 @@
package org.sonar.server.search;
import org.elasticsearch.action.ActionRequest;
-import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
import org.elasticsearch.action.admin.indices.refresh.RefreshRequestBuilder;
import org.elasticsearch.action.admin.indices.refresh.RefreshResponse;
import org.elasticsearch.action.bulk.BulkRequestBuilder;
@@ -32,12 +31,9 @@ import org.slf4j.LoggerFactory;
import org.sonar.api.ServerComponent;
import org.sonar.api.config.Settings;
import org.sonar.api.platform.ComponentContainer;
-import org.sonar.core.cluster.ClusterAction;
import org.sonar.core.cluster.WorkQueue;
import org.sonar.core.profiling.Profiling;
import org.sonar.server.search.action.IndexActionRequest;
-import org.sonar.server.search.action.IndexWorker;
-import org.sonar.server.search.action.RefreshActionRequest;
import java.util.HashMap;
import java.util.HashSet;
@@ -73,28 +69,13 @@ public class IndexQueue implements ServerComponent, WorkQueue<IndexActionRequest
}
try {
- boolean refreshRequired = false;
-
Map<String, Index> indexes = getIndexMap();
Set<String> indices = new HashSet<String>();
- for (ClusterAction action : actions) {
- if (IndexActionRequest.class.isAssignableFrom(action.getClass())) {
- IndexActionRequest worker = (IndexActionRequest) action;
- if (worker.needsRefresh()) {
- refreshRequired = true;
- indices.add(indexes.get(worker.getIndexType()).getIndexName());
- }
- }
-
- if (IndexWorker.class.isAssignableFrom(action.getClass())) {
- IndexWorker worker = (IndexWorker) action;
- Index index = indexes.get(worker.getIndexType());
- worker.setIndex(index);
- }
-
- if (RefreshActionRequest.class.isAssignableFrom(action.getClass())) {
- refreshRequired = true;
- indices.add(indexes.get(((RefreshActionRequest) action).getIndexType()).getIndexName());
+ for (IndexActionRequest action : actions) {
+ Index index = indexes.get(action.getIndexType());
+ action.setIndex(index);
+ if (action.needsRefresh()) {
+ indices.add(index.getIndexName());
}
}
@@ -102,30 +83,26 @@ public class IndexQueue implements ServerComponent, WorkQueue<IndexActionRequest
long normTime = executeNormalization(bulkRequestBuilder, actions);
- if (bulkRequestBuilder.numberOfActions() > 0) {
- // execute the request
- long indexTime = System.currentTimeMillis();
- BulkResponse response = searchClient.execute(bulkRequestBuilder.setRefresh(false));
+ //execute the request
+ long indexTime = System.currentTimeMillis();
+ BulkResponse response = searchClient.execute(bulkRequestBuilder.setRefresh(false));
+ indexTime = System.currentTimeMillis() - indexTime;
- indexTime = System.currentTimeMillis() - indexTime;
+ long refreshTime = this.refreshRequiredIndex(indices);
- long refreshTime = 0;
- if (refreshRequired) {
- refreshTime = this.refreshRequiredIndex(indices);
- }
-
- LOGGER.debug("-- submitted {} items with {}ms in normalization, {}ms indexing and {}ms refresh({}). Total: {}ms",
- bulkRequestBuilder.numberOfActions(), normTime, indexTime, refreshTime, indices, (normTime + indexTime + refreshTime));
+ LOGGER.debug("-- submitted {} items with {}ms in normalization, {}ms indexing and {}ms refresh({}). Total: {}ms",
+ bulkRequestBuilder.numberOfActions(), normTime, indexTime, refreshTime, indices, (normTime + indexTime + refreshTime));
- if (response.hasFailures()) {
- throw new IllegalStateException("Errors while indexing stack: " + response.buildFailureMessage());
- }
+ if (response.hasFailures()) {
+ throw new IllegalStateException("Errors while indexing stack: " + response.buildFailureMessage());
}
+
} catch (Exception e) {
LOGGER.error("Could not commit to ElasticSearch", e);
}
}
+
private long refreshRequiredIndex(Set<String> indices) {
long refreshTime = System.currentTimeMillis();
@@ -146,24 +123,20 @@ public class IndexQueue implements ServerComponent, WorkQueue<IndexActionRequest
private long executeNormalization(BulkRequestBuilder bulkRequestBuilder, List<IndexActionRequest> actions) {
long normTime = System.currentTimeMillis();
try {
- boolean hasInlineRefreshRequest = false;
ExecutorService executorService = Executors.newFixedThreadPool(CONCURRENT_NORMALIZATION_FACTOR);
- // invokeAll() blocks until ALL tasks submitted to executor complete
+ //invokeAll() blocks until ALL tasks submitted to executor complete
for (Future<List<ActionRequest>> updateRequests : executorService.invokeAll(actions)) {
for (ActionRequest update : updateRequests.get()) {
if (UpdateRequest.class.isAssignableFrom(update.getClass())) {
- bulkRequestBuilder.add(((UpdateRequest) update));
+ bulkRequestBuilder.add(((UpdateRequest) update).refresh(false));
} else if (DeleteRequest.class.isAssignableFrom(update.getClass())) {
- bulkRequestBuilder.add(((DeleteRequest) update));
- } else if (RefreshRequest.class.isAssignableFrom(update.getClass())) {
- hasInlineRefreshRequest = true;
+ bulkRequestBuilder.add(((DeleteRequest) update).refresh(false));
} else {
throw new IllegalStateException("Un-managed request type: " + update.getClass());
}
}
}
executorService.shutdown();
- bulkRequestBuilder.setRefresh(hasInlineRefreshRequest);
} catch (Exception e) {
throw new IllegalStateException("Could not execute normalization for stack", e);
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/search/SearchClient.java b/server/sonar-server/src/main/java/org/sonar/server/search/SearchClient.java
index 6cea28ad8d5..4c8b26f4bae 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/search/SearchClient.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/search/SearchClient.java
@@ -41,8 +41,6 @@ import org.sonar.core.profiling.Profiling;
import org.sonar.core.profiling.StopWatch;
import org.sonar.process.LoopbackAddress;
-import java.io.File;
-
/**
* ElasticSearch Node used to connect to index.
*/
@@ -128,9 +126,4 @@ public class SearchClient extends TransportClient implements Startable {
public void stop() {
close();
}
-
- public File executePayload(File f) {
-
- return new File("payload");
- }
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/search/action/IndexActionRequest.java b/server/sonar-server/src/main/java/org/sonar/server/search/action/IndexActionRequest.java
index 940316d82d8..8eb540df4a6 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/search/action/IndexActionRequest.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/search/action/IndexActionRequest.java
@@ -19,6 +19,7 @@
*/
package org.sonar.server.search.action;
+
import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.update.UpdateRequest;
import org.sonar.core.cluster.ClusterAction;
@@ -27,7 +28,7 @@ import org.sonar.server.search.Index;
import java.util.ArrayList;
import java.util.List;
-public abstract class IndexActionRequest implements IndexWorker, ClusterAction<ActionRequest> {
+public abstract class IndexActionRequest implements ClusterAction<List<ActionRequest>> {
protected final String indexType;
private final boolean requiresRefresh;
@@ -38,6 +39,7 @@ public abstract class IndexActionRequest implements IndexWorker, ClusterAction<A
}
protected IndexActionRequest(String indexType, boolean requiresRefresh) {
+ super();
this.indexType = indexType;
this.requiresRefresh = requiresRefresh;
}
@@ -50,6 +52,7 @@ public abstract class IndexActionRequest implements IndexWorker, ClusterAction<A
return indexType;
}
+
public void setIndex(Index index) {
this.index = index;
}
@@ -65,7 +68,7 @@ public abstract class IndexActionRequest implements IndexWorker, ClusterAction<A
((UpdateRequest) request)
.type(index.getIndexType())
.index(index.getIndexName())
- .refresh(requiresRefresh);
+ .refresh(false);
}
finalRequests.add(request);
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/search/action/IndexWorker.java b/server/sonar-server/src/main/java/org/sonar/server/search/action/IndexWorker.java
deleted file mode 100644
index 42989b66c0d..00000000000
--- a/server/sonar-server/src/main/java/org/sonar/server/search/action/IndexWorker.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.search.action;
-
-import org.sonar.server.search.Index;
-
-public interface IndexWorker {
-
- public String getIndexType();
-
- public void setIndex(Index index);
-}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/search/action/RefreshActionRequest.java b/server/sonar-server/src/main/java/org/sonar/server/search/action/RefreshActionRequest.java
deleted file mode 100644
index 0fa039313fd..00000000000
--- a/server/sonar-server/src/main/java/org/sonar/server/search/action/RefreshActionRequest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.search.action;
-
-import com.google.common.collect.ImmutableList;
-import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
-import org.sonar.core.cluster.ClusterAction;
-import org.sonar.server.search.Index;
-
-import java.util.List;
-
-public class RefreshActionRequest implements IndexWorker, ClusterAction<RefreshRequest> {
-
- private Index<?, ?, ?> index;
- private final String indexType;
-
- public RefreshActionRequest(String indexType) {
- this.indexType = indexType;
- }
-
- @Override
- public List<RefreshRequest> call() throws Exception {
- return ImmutableList.<RefreshRequest>of(
- new RefreshRequest()
- .force(false)
- .indices(index.getIndexName()));
- }
-
- @Override
- public String getIndexType() {
- return indexType;
- }
-
- @Override
- public void setIndex(Index index) {
- this.index = index;
- }
-}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/activity/ActivityBackendMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/activity/ActivityBackendMediumTest.java
index 5c760965c2a..e20aea65583 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/activity/ActivityBackendMediumTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/activity/ActivityBackendMediumTest.java
@@ -115,12 +115,9 @@ public class ActivityBackendMediumTest {
@Test
public void massive_insert() {
- // Set qeue's implicit commit size to 10
- dbSession.setImplicitCommitSize(20);
-
// 0 Assert no logs in DB
assertThat(dao.findAll(dbSession)).hasSize(0);
- int max = 35;
+ int max = 400;
final String testValue = "hello world";
for (int i = 0; i < max; i++) {
@@ -159,12 +156,9 @@ public class ActivityBackendMediumTest {
@Test
public void massive_log_insert() {
- // Set qeue's implicit commit size to 10
- dbSession.setImplicitCommitSize(10);
-
// 0 Assert no logs in DB
assertThat(dao.findAll(dbSession)).hasSize(0);
- int max = 40;
+ int max = 400;
final String testValue = "hello world";
for (int i = 0; i < max; i++) {
TestActivityLog log = new TestActivityLog(testValue + "_" + i, Activity.Type.QPROFILE.toString());
diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/BaseDaoTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/BaseDaoTest.java
index c4b354193b7..5ee795cb6e6 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/db/BaseDaoTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/db/BaseDaoTest.java
@@ -117,7 +117,6 @@ public class BaseDaoTest {
assertThat(session.getActionCount()).isEqualTo(1);
dao.synchronizeAfter(session, new Date(t0));
- // Synchronize adds an implicit action to the queue before finishing.
- assertThat(session.getActionCount()).isEqualTo(3);
+ assertThat(session.getActionCount()).isEqualTo(2);
}
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/db/IssueAuthorizationDaoTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/db/IssueAuthorizationDaoTest.java
index aedf757c64f..0b8a8c988c4 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/issue/db/IssueAuthorizationDaoTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/issue/db/IssueAuthorizationDaoTest.java
@@ -61,8 +61,8 @@ public class IssueAuthorizationDaoTest extends AbstractDaoTestCase {
assertThat(session.getActionCount()).isEqualTo(0);
dao.synchronizeAfter(session, new Date(0));
- // SynchronizeAfter adds an implicit action (refresh) after execution of synchronization
- assertThat(session.getActionCount()).isEqualTo(2);
+
+ assertThat(session.getActionCount()).isEqualTo(1);
}
@Test
@@ -70,8 +70,7 @@ public class IssueAuthorizationDaoTest extends AbstractDaoTestCase {
setupData("synchronize_after_since_given_date");
dao.synchronizeAfter(session, DateUtils.parseDate("2014-09-01"));
- // SynchronizeAfter adds an implicit action (refresh) after execution of synchronization
- assertThat(session.getActionCount()).isEqualTo(2);
+ assertThat(session.getActionCount()).isEqualTo(1);
}
@Test
@@ -79,8 +78,7 @@ public class IssueAuthorizationDaoTest extends AbstractDaoTestCase {
setupData("synchronize_after_with_project");
dao.synchronizeAfter(session, DateUtils.parseDate("2014-01-01"), ImmutableMap.of(IssueAuthorizationDao.PROJECT_KEY, "org.sonar:sample"));
- // SynchronizeAfter adds an implicit action (refresh) after execution of synchronization
- assertThat(session.getActionCount()).isEqualTo(2);
+ assertThat(session.getActionCount()).isEqualTo(1);
}
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/search/IndexSynchronizerMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/search/IndexSynchronizerMediumTest.java
index 7c95432a00c..1e313236343 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/search/IndexSynchronizerMediumTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/search/IndexSynchronizerMediumTest.java
@@ -78,7 +78,6 @@ public class IndexSynchronizerMediumTest {
synchronizer.synchronize(dbSession, dbClient.ruleDao(), indexClient.get(RuleIndex.class));
dbSession.commit();
- Thread.sleep(1000);
assertThat(indexClient.get(RuleIndex.class).countAll()).isEqualTo(numberOfRules);
}
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/tester/BackendCleanup.java b/server/sonar-server/src/test/java/org/sonar/server/tester/BackendCleanup.java
index cfb22cb7eb4..cb79ed6d569 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/tester/BackendCleanup.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/tester/BackendCleanup.java
@@ -67,12 +67,6 @@ public class BackendCleanup implements ServerComponent {
.getState().getMetaData().concreteAllIndices())
.setQuery(QueryBuilders.matchAllQuery())
.get();
- searchClient.admin().indices().prepareRefresh(searchClient.admin().cluster().prepareState().get()
- .getState().getMetaData().concreteAllIndices())
- .setForce(true)
- .get();
- searchClient.admin().indices().prepareFlush(searchClient.admin().cluster().prepareState().get()
- .getState().getMetaData().concreteAllIndices())
- .get();
+
}
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/tester/ServerTester.java b/server/sonar-server/src/test/java/org/sonar/server/tester/ServerTester.java
index 9f884aea465..43ef301e1f6 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/tester/ServerTester.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/tester/ServerTester.java
@@ -192,7 +192,6 @@ public class ServerTester extends ExternalResource {
public void clearIndexes() {
checkStarted();
get(BackendCleanup.class).clearIndexes();
-
}
/**
diff --git a/sonar-core/src/main/java/org/sonar/core/cluster/ClusterAction.java b/sonar-core/src/main/java/org/sonar/core/cluster/ClusterAction.java
index 13aac68b2e1..bac9518865f 100644
--- a/sonar-core/src/main/java/org/sonar/core/cluster/ClusterAction.java
+++ b/sonar-core/src/main/java/org/sonar/core/cluster/ClusterAction.java
@@ -19,11 +19,10 @@
*/
package org.sonar.core.cluster;
-import java.util.List;
import java.util.concurrent.Callable;
-public interface ClusterAction<K> extends Callable<List<K>> {
+public interface ClusterAction<K> extends Callable<K> {
@Override
- public List<K> call() throws Exception;
+ public K call() throws Exception;
}
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/DbSession.java b/sonar-core/src/main/java/org/sonar/core/persistence/DbSession.java
index 2bca0acee02..3ca049d44ee 100644
--- a/sonar-core/src/main/java/org/sonar/core/persistence/DbSession.java
+++ b/sonar-core/src/main/java/org/sonar/core/persistence/DbSession.java
@@ -41,8 +41,6 @@ public class DbSession implements SqlSession {
private SqlSession session;
private int actionCount;
- private Integer implicitCommitSize = IMPLICIT_COMMIT_SIZE;
-
DbSession(WorkQueue queue, SqlSession session) {
this.actionCount = 0;
this.session = session;
@@ -50,18 +48,10 @@ public class DbSession implements SqlSession {
this.actions = new ArrayList<ClusterAction>();
}
- public Integer getImplicitCommitSize() {
- return implicitCommitSize;
- }
-
- public void setImplicitCommitSize(Integer implicitCommitSize) {
- this.implicitCommitSize = implicitCommitSize;
- }
-
public void enqueue(ClusterAction action) {
actionCount++;
this.actions.add(action);
- if (this.actions.size() > getImplicitCommitSize()) {
+ if (this.actions.size() > IMPLICIT_COMMIT_SIZE) {
this.commit();
}
}