mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-06 13:08:29 +00:00
[Test] Speedup UpdateTests#testConcurrentUpdateWithRetryOnConflict
This commit is contained in:
parent
6898984307
commit
e621458a39
@ -452,9 +452,10 @@ public class UpdateTests extends ElasticsearchIntegrationTest {
|
|||||||
createIndex();
|
createIndex();
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
int numberOfThreads = between(2,5);
|
int numberOfThreads = scaledRandomIntBetween(2,5);
|
||||||
final CountDownLatch latch = new CountDownLatch(numberOfThreads);
|
final CountDownLatch latch = new CountDownLatch(numberOfThreads);
|
||||||
final int numberOfUpdatesPerThread = between(1000, 10000);
|
final CountDownLatch startLatch = new CountDownLatch(1);
|
||||||
|
final int numberOfUpdatesPerThread = scaledRandomIntBetween(100, 10000);
|
||||||
final List<Throwable> failures = new CopyOnWriteArrayList<>();
|
final List<Throwable> failures = new CopyOnWriteArrayList<>();
|
||||||
for (int i = 0; i < numberOfThreads; i++) {
|
for (int i = 0; i < numberOfThreads; i++) {
|
||||||
Runnable r = new Runnable() {
|
Runnable r = new Runnable() {
|
||||||
@ -462,6 +463,7 @@ public class UpdateTests extends ElasticsearchIntegrationTest {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
|
startLatch.await();
|
||||||
for (int i = 0; i < numberOfUpdatesPerThread; i++) {
|
for (int i = 0; i < numberOfUpdatesPerThread; i++) {
|
||||||
if (useBulkApi) {
|
if (useBulkApi) {
|
||||||
UpdateRequestBuilder updateRequestBuilder = client().prepareUpdate("test", "type1", Integer.toString(i))
|
UpdateRequestBuilder updateRequestBuilder = client().prepareUpdate("test", "type1", Integer.toString(i))
|
||||||
@ -486,6 +488,7 @@ public class UpdateTests extends ElasticsearchIntegrationTest {
|
|||||||
};
|
};
|
||||||
new Thread(r).start();
|
new Thread(r).start();
|
||||||
}
|
}
|
||||||
|
startLatch.countDown();
|
||||||
latch.await();
|
latch.await();
|
||||||
for (Throwable throwable : failures) {
|
for (Throwable throwable : failures) {
|
||||||
logger.info("Captured failure on concurrent update:", throwable);
|
logger.info("Captured failure on concurrent update:", throwable);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user