Skip to content

Commit c0aeab2

Browse files
llingllinggit
lling
authored andcommitted
#1291 remove threadThrottleFactor as this is not needed anymore
1 parent 409d0eb commit c0aeab2

File tree

3 files changed

+5
-53
lines changed

3 files changed

+5
-53
lines changed

marklogic-client-api/src/main/java/com/marklogic/client/datamovement/QueryBatcher.java

-26
Original file line numberDiff line numberDiff line change
@@ -292,38 +292,12 @@ public interface QueryBatcher extends Batcher {
292292
*/
293293
public QueryBatcher withBatchSize(int docBatchSize, int docToUriBatchRatio);
294294

295-
/*
296-
* Sets the number of documents processed in a batch, the ratio of the document processing batch to the document uri
297-
* collection batch and threadThrottleFactor. For example, if docBatchSize is 100 and docToUriBatchRatio is 5, the
298-
* document processing batch size is 100 and the document URI collection batch is 500. Ordinarily, QueryBatcher starts
299-
* a separate thread for each document processing batch (and also collects document uris in one of these threads).
300-
* The threadThrottleFactor reduces the number of default threads. Thus, a threadThrottleFactor equal to the
301-
* docToUriBatchRatio - 1 runs in a single thread. A threadThrottleFactor of 0 explicitly uses the maximum number of
302-
* threads.
303-
* @param docBatchSize the number of documents processed in a batch
304-
* @param docToUriBatchRatio the ratio of the document processing batch to the document uri collection batch. The
305-
* docToUriBatchRatio should ordinarily be larger than 1 because URIs are small relative to
306-
* full documents and because collecting URIs from indexes is ordinarily faster than
307-
* processing documents
308-
* @param threadThrottleFactor The threadThrottleFactor reduces the number of default threads. A threadThrottleFactor
309-
* equal to the docToUriBatchRatio - 1 runs in a single thread. A threadThrottleFactor of
310-
* 0 explicitly uses the maximum number of threads
311-
* @return this instance for method chaining
312-
*/
313-
//public QueryBatcher withBatchSize(int docBatchSize, int docToUriBatchRatio, int threadThrottleFactor);
314-
315295
/**
316296
* Returns docToUriBatchRatio set to the QueryBatcher
317297
* @return docToUriBatchRatio
318298
*/
319299
public int getDocToUriBatchRatio();
320300

321-
/*
322-
* Returns threadThrottleFactor set to the QueryBatcher
323-
* @return threadThrottleFactor
324-
*/
325-
//public int getThreadThrottleFactor();
326-
327301
/**
328302
* Returns defaultDocBatchSize, which is calculated according to server status
329303
* @return defaultDocBatchSize

marklogic-client-api/src/main/java/com/marklogic/client/datamovement/impl/QueryBatcherImpl.java

+3-24
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ public class QueryBatcherImpl extends BatcherImpl implements QueryBatcher {
8383
private int docToUriBatchRatio;
8484
private int defaultDocBatchSize;
8585
private int maxUriBatchSize;
86-
private int threadThrottleFactor;
8786

8887
QueryBatcherImpl(
8988
SearchQueryDefinition originalQuery, DataMovementManager moveMgr, ForestConfiguration forestConfig,
@@ -324,7 +323,6 @@ public QueryBatcher withBatchSize(int docBatchSize) {
324323
if (this.docToUriBatchRatio == 0) {
325324
this.docToUriBatchRatio = 1;
326325
}
327-
this.threadThrottleFactor = 0;
328326
return this;
329327
}
330328

@@ -344,30 +342,11 @@ public QueryBatcher withBatchSize(int docBatchSize, int docToUriBatchRatio) {
344342
return this;
345343
}
346344

347-
/* @Override
348-
public QueryBatcher withBatchSize(int docBatchSize, int docToUriBatchRatio, int threadThrottleFactor) {
349-
if (threadThrottleFactor < 0 || threadThrottleFactor > this.maxDocToUriBatchRatio) {
350-
throw new IllegalArgumentException("threadThrottleFactor is less than 0 or " +
351-
"threadThrottleFactor is larger than maxDocToUriBatchRatio");
352-
}
353-
if (threadThrottleFactor >= docToUriBatchRatio) {
354-
throw new IllegalArgumentException("threadThrottleFactor must be less than docToUriBatchRatio");
355-
}
356-
withBatchSize(docBatchSize, docToUriBatchRatio);
357-
this.threadThrottleFactor = threadThrottleFactor;
358-
return this;
359-
}*/
360-
361345
@Override
362346
public int getDocToUriBatchRatio() {
363347
return this.docToUriBatchRatio;
364348
}
365349

366-
// @Override
367-
public int getThreadThrottleFactor() {
368-
return this.threadThrottleFactor;
369-
}
370-
371350
@Override
372351
public int getDefaultDocBatchSize() {
373352
return this.defaultDocBatchSize;
@@ -473,7 +452,7 @@ private synchronized void initialize() {
473452
if ( threadCountSet == false ) {
474453
if ( query != null ) {
475454
logger.warn("threadCount not set--defaulting to number of forests ({})", forests.length);
476-
withThreadCount(forests.length * (docToUriBatchRatio - threadThrottleFactor));
455+
withThreadCount(forests.length * docToUriBatchRatio);
477456
} else {
478457
int hostCount = clientList.get().size();
479458
logger.warn("threadCount not set--defaulting to number of hosts ({})", hostCount);
@@ -488,9 +467,9 @@ private synchronized void initialize() {
488467
if(getThreadCount() == 1) {
489468
isSingleThreaded = true;
490469
}
491-
logger.info("Starting job forest length={}, docBatchSize={}, docToUriBatchRatio={}, threadThrottleFactor= {}, " +
470+
logger.info("Starting job forest length={}, docBatchSize={}, docToUriBatchRatio={}, " +
492471
"threadCount={}, onUrisReady listeners={}, failure listeners={}",
493-
forests.length, getBatchSize(), getDocToUriBatchRatio(), getThreadThrottleFactor(), getThreadCount(),
472+
forests.length, getBatchSize(), getDocToUriBatchRatio(), getThreadCount(),
494473
urisReadyListeners.size(), failureListeners.size());
495474
threadPool = new QueryThreadPoolExecutor(getThreadCount(), forests.length, getDocToUriBatchRatio(), this);
496475
}

marklogic-client-api/src/test/java/com/marklogic/client/test/datamovement/ConcurrencyTest.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ public void ConcurrencyTest() {
5555
int batchSize = 20;
5656
int docToUriBatchRatio = 5;
5757
int totalCount = 1000;
58-
//int threadThrottleFactor = 4;
5958

6059
DocumentMetadataHandle documentMetadata = new DocumentMetadataHandle().withCollections("ConcurrencyTest");
6160
WriteBatcher batcher = moveMgr.newWriteBatcher().withDefaultMetadata(documentMetadata);
@@ -96,7 +95,7 @@ public void ConcurrencyTest() {
9695
/* QueryBatcher queryBatcherAfter = dmManager.newQueryBatcher(new StructuredQueryBuilder().collection("ConcurrencyTest"));
9796
AtomicInteger minAfter = new AtomicInteger(Integer.MAX_VALUE);
9897
AtomicInteger maxAfter = new AtomicInteger(0);
99-
queryBatcherAfter.withBatchSize(batchSize, docToUriBatchRatio, threadThrottleFactor)
98+
queryBatcherAfter.withBatchSize(batchSize, docToUriBatchRatio)
10099
.onUrisReady(batch -> {
101100
ThreadPoolExecutor threadPoolAfter = ((QueryBatcherImpl) queryBatcherAfter).getThreadPool();
102101
int activeThreadCount = threadPoolAfter.getPoolSize();
@@ -116,7 +115,7 @@ public void ConcurrencyTest() {
116115
dmManager.stopJob(queryBatcherAfter);*/
117116

118117
assertTrue(max.get() <= forest_count * docToUriBatchRatio);
119-
//assertTrue(maxAfter.get() <= forest_count * (docToUriBatchRatio - threadThrottleFactor));
118+
//assertTrue(maxAfter.get() <= forest_count * docToUriBatchRatio);
120119
}
121120

122121
static void changeAssignmentPolicy(String value) throws IOException {

0 commit comments

Comments
 (0)