Skip to content

Commit 2ea0caa

Browse files
authored
[Transform] Call listener in order to prevent the request from hanging (#96221) (#96223)
1 parent 93513af commit 2ea0caa

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

docs/changelog/96221.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 96221
2+
summary: Call listener in order to prevent the request from hanging
3+
area: Transform
4+
type: bug
5+
issues: []

x-pack/plugin/transform/qa/single-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/transform/integration/TransformUpdateIT.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.util.concurrent.TimeUnit;
2424

2525
import static org.hamcrest.Matchers.equalTo;
26+
import static org.hamcrest.Matchers.is;
2627

2728
public class TransformUpdateIT extends TransformRestTestCase {
2829

@@ -148,6 +149,24 @@ public void testUpdateTransferRightsSecondaryAuthHeaders() throws Exception {
148149
updateTransferRightsTester(true);
149150
}
150151

152+
public void testUpdateThatChangesSettingsButNotHeaders() throws Exception {
153+
String transformId = "test_update_that_changes_settings";
154+
String destIndex = transformId + "-dest";
155+
156+
// Create the transform
157+
createPivotReviewsTransform(transformId, destIndex, null, null, null);
158+
159+
Request updateTransformRequest = createRequestWithAuth("POST", getTransformEndpoint() + transformId + "/_update", null);
160+
updateTransformRequest.setJsonEntity("""
161+
{ "settings": { "max_page_search_size": 123 } }""");
162+
163+
// Update the transform's settings
164+
Map<String, Object> updatedConfig = entityAsMap(client().performRequest(updateTransformRequest));
165+
166+
// Verify that the settings got updated
167+
assertThat(updatedConfig.get("settings"), is(equalTo(Map.of("max_page_search_size", 123))));
168+
}
169+
151170
private void updateTransferRightsTester(boolean useSecondaryAuthHeaders) throws Exception {
152171
String transformId = "transform1";
153172
// Note: Due to a bug the transform does not fail to start after deleting the user and role, therefore invalidating

x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportUpdateTransformAction.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ protected void doExecute(Task task, Request request, ActionListener<Response> li
205205
authState,
206206
ActionListener.wrap(aVoid -> listener.onResponse(new Response(updatedConfig)), listener::onFailure)
207207
);
208+
} else {
209+
listener.onResponse(new Response(updatedConfig));
208210
}
209211
} else {
210212
listener.onResponse(new Response(updatedConfig));

0 commit comments

Comments
 (0)