-
Notifications
You must be signed in to change notification settings - Fork 850
Executors/Threads: Enforce reasonable rules #4675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -109,7 +109,7 @@ public void close() { | |
|
|
||
| ExecutorService coreCloseExecutor = | ||
| ExecutorUtil.newMDCAwareFixedThreadPool( | ||
| Integer.MAX_VALUE, new SolrNamedThreadFactory("coreCloseExecutor")); | ||
| 64, new SolrNamedThreadFactory("coreCloseExecutor")); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. new enforcement caught this problem |
||
| try { | ||
| for (SolrCore core : coreList) { | ||
| coreCloseExecutor.execute( | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. checks caught this |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,7 +59,6 @@ | |
| import org.apache.solr.common.params.SolrParams; | ||
| import org.apache.solr.common.util.ExecutorUtil; | ||
| import org.apache.solr.common.util.NamedList; | ||
| import org.apache.solr.common.util.SolrNamedThreadFactory; | ||
| import org.apache.solr.common.util.TimeSource; | ||
| import org.apache.solr.embedded.JettySolrRunner; | ||
| import org.apache.solr.index.NoMergePolicyFactory; | ||
|
|
@@ -343,9 +342,7 @@ private void reorderedDBQsSimpleTest() throws Exception { | |
| } | ||
|
|
||
| // Reordering needs to happen using parallel threads | ||
| ExecutorService threadpool = | ||
| ExecutorUtil.newMDCAwareFixedThreadPool( | ||
| updates.size() + 1, new SolrNamedThreadFactory(getTestName())); | ||
| ExecutorService threadpool = newThreadPerUpdatePool(updates); | ||
|
|
||
| // re-order the updates for NONLEADER 0 | ||
| List<UpdateRequest> reorderedUpdates = new ArrayList<>(updates); | ||
|
|
@@ -418,9 +415,7 @@ private void reorderedDBQIndividualReplicaTest() throws Exception { | |
| "inplace_updatable_float:" + (newinplace_updatable_float + 1), version0 + 3)); | ||
|
|
||
| // Reordering needs to happen using parallel threads | ||
| ExecutorService threadpool = | ||
| ExecutorUtil.newMDCAwareFixedThreadPool( | ||
| updates.size() + 1, new SolrNamedThreadFactory(getTestName())); | ||
| ExecutorService threadpool = newThreadPerUpdatePool(updates); | ||
|
|
||
| // re-order the updates by swapping the last two | ||
| List<UpdateRequest> reorderedUpdates = new ArrayList<>(updates); | ||
|
|
@@ -932,9 +927,7 @@ private void outOfOrderUpdatesIndividualReplicaTest() throws Exception { | |
|
|
||
| // Reordering needs to happen using parallel threads, since some of these updates will | ||
| // be blocking calls, waiting for some previous update operations to arrive on which it depends. | ||
| ExecutorService threadpool = | ||
| ExecutorUtil.newMDCAwareFixedThreadPool( | ||
| updates.size() + 1, new SolrNamedThreadFactory(getTestName())); | ||
| ExecutorService threadpool = newThreadPerUpdatePool(updates); | ||
|
|
||
| // re-order the updates for NONLEADER 0 | ||
| List<UpdateRequest> reorderedUpdates = new ArrayList<>(updates); | ||
|
|
@@ -1036,9 +1029,7 @@ private void reorderedDeletesTest() throws Exception { | |
| } | ||
|
|
||
| // Reordering needs to happen using parallel threads | ||
| ExecutorService threadpool = | ||
| ExecutorUtil.newMDCAwareFixedThreadPool( | ||
| updates.size() + 1, new SolrNamedThreadFactory(getTestName())); | ||
| ExecutorService threadpool = newThreadPerUpdatePool(updates); | ||
|
|
||
| // re-order the updates for NONLEADER 0 | ||
| List<UpdateRequest> reorderedUpdates = new ArrayList<>(updates); | ||
|
|
@@ -1143,9 +1134,7 @@ private void reorderedDBQsResurrectionTest() throws Exception { | |
| } | ||
|
|
||
| // Reordering needs to happen using parallel threads | ||
| ExecutorService threadpool = | ||
| ExecutorUtil.newMDCAwareFixedThreadPool( | ||
| updates.size() + 1, new SolrNamedThreadFactory(getTestName())); | ||
| ExecutorService threadpool = newThreadPerUpdatePool(updates); | ||
| // re-order the last two updates for NONLEADER 0 | ||
| List<UpdateRequest> reorderedUpdates = new ArrayList<>(updates); | ||
| Collections.swap(reorderedUpdates, 2, 3); | ||
|
|
@@ -1248,9 +1237,7 @@ private void delayedReorderingFetchesMissingUpdateFromLeaderTest() throws Except | |
| .getFilter(ServletFixtures.DelayServlet.class) | ||
| .addDelay("Waiting for dependant update to timeout", 1, 6000); | ||
|
|
||
| ExecutorService threadpool = | ||
| ExecutorUtil.newMDCAwareFixedThreadPool( | ||
| updates.size() + 1, new SolrNamedThreadFactory(getTestName())); | ||
| ExecutorService threadpool = newThreadPerUpdatePool(updates); | ||
| for (UpdateRequest update : updates) { | ||
| AsyncUpdateWithRandomCommit task = | ||
| new AsyncUpdateWithRandomCommit(update, cloudClient, random().nextLong()); | ||
|
|
@@ -1353,9 +1340,7 @@ private void delayedReorderingFetchesMissingUpdateFromLeaderTest() throws Except | |
| .getFilter(ServletFixtures.DelayServlet.class) | ||
| .addDelay("Waiting for dependant update to timeout", 4, 5998); // the delete update | ||
|
|
||
| threadpool = | ||
| ExecutorUtil.newMDCAwareFixedThreadPool( | ||
| updates.size() + 1, new SolrNamedThreadFactory(getTestName())); | ||
| threadpool = newThreadPerUpdatePool(updates); | ||
| for (UpdateRequest update : updates) { | ||
| AsyncUpdateWithRandomCommit task = | ||
| new AsyncUpdateWithRandomCommit(update, cloudClient, random().nextLong()); | ||
|
|
@@ -1419,6 +1404,10 @@ public void checkExpectedSchemaField(Map<String, Object> expected) throws Except | |
| assertEquals("Field: " + fieldName, expected, rsp.getField()); | ||
| } | ||
|
|
||
| private ExecutorService newThreadPerUpdatePool(List<?> updates) { | ||
| return ExecutorUtil.newMDCAwareFixedThreadPool(updates.size() + 1, 1, getTestName()); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1 queue size... we don't expect to use the queue at all in this test; this is a glorified thread-per-task generator |
||
| } | ||
|
|
||
| private class AsyncUpdateWithRandomCommit implements Callable<UpdateResponse> { | ||
| UpdateRequest update; | ||
| SolrClient solrClient; | ||
|
|
@@ -1650,9 +1639,7 @@ private void reorderedDBQsUsingUpdatedValueFromADroppedUpdate() throws Exception | |
| .getFilter(ServletFixtures.DelayServlet.class) | ||
| .addDelay("Waiting for dependant update to timeout", 2, 8000); | ||
|
|
||
| ExecutorService threadpool = | ||
| ExecutorUtil.newMDCAwareFixedThreadPool( | ||
| updates.size() + 1, new SolrNamedThreadFactory(getTestName())); | ||
| ExecutorService threadpool = newThreadPerUpdatePool(updates); | ||
| for (UpdateRequest update : updates) { | ||
| AsyncUpdateWithRandomCommit task = | ||
| new AsyncUpdateWithRandomCommit(update, cloudClient, random().nextLong()); | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very much deserves to be a separate PR, see #4668 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
many changes in this PR are just for the rename of one
newMDCAwareCachedThreadPooltonewMDCAwareFixedThreadPool