24
24
25
25
import java .util .Collection ;
26
26
import java .util .List ;
27
- import java .util .Map ;
28
27
import java .util .concurrent .ExecutionException ;
29
28
30
29
import static org .elasticsearch .test .hamcrest .ElasticsearchAssertions .assertAcked ;
@@ -61,12 +60,6 @@ protected Settings nodeSettings() {
61
60
return Settings .builder ().put (super .nodeSettings ()).put ("serverless.cross_project.enabled" , "true" ).build ();
62
61
}
63
62
64
- @ Override
65
- protected Map <String , Boolean > skipUnavailableForRemoteClusters () {
66
- // Setting skip_unavailable=false results in a fatal error when the linked cluster is not available.
67
- return Map .of (LINKED_CLUSTER_1 , false );
68
- }
69
-
70
63
public void testCpsShouldNotUseSkipUnavailable () throws Exception {
71
64
// Add some dummy data to prove we are communicating fine with the remote.
72
65
assertAcked (client (LINKED_CLUSTER_1 ).admin ().indices ().prepareCreate ("test-index" ));
@@ -80,11 +73,7 @@ public void testCpsShouldNotUseSkipUnavailable() throws Exception {
80
73
throw new AssertionError (e );
81
74
}
82
75
83
- /*
84
- * Under normal circumstances, we should get a fatal error for when skip_unavailable=false for a linked cluster
85
- * and that cluster is targeted in a search op. However, in CPS environment, setting allow_partial_search_results=true
86
- * should not result in a fatal error.
87
- */
76
+ // 1. We first execute a search request with partial results allowed and shouldn't observe any top-level errors.
88
77
{
89
78
var searchRequest = getSearchRequest (true );
90
79
searchRequest .setCcsMinimizeRoundtrips (randomBoolean ());
@@ -108,11 +97,7 @@ public void testCpsShouldNotUseSkipUnavailable() throws Exception {
108
97
});
109
98
}
110
99
111
- /*
112
- * Previously, we did not get a fatal error even when skip_unavailable=false for the linked cluster.
113
- * Now, we disable partial results and expect a fatal error. This proves that in CPS environment,
114
- * search uses allow_partial_search_results and not skip_unavailable.
115
- */
100
+ // 2. We now execute a search request with partial results disallowed and should observe a top-level error.
116
101
{
117
102
var searchRequest = getSearchRequest (false );
118
103
searchRequest .setCcsMinimizeRoundtrips (randomBoolean ());
@@ -123,6 +108,12 @@ public void testCpsShouldNotUseSkipUnavailable() throws Exception {
123
108
Matchers .anyOf (Matchers .instanceOf (RemoteTransportException .class ), Matchers .instanceOf (ConnectTransportException .class ))
124
109
);
125
110
}
111
+
112
+ /*
113
+ * We usually get a top-level error when skip_unavailable is false. However, irrespective of that setting in this test, we now
114
+ * observe a top-level error when partial results are disallowed. This proves that skip_unavailable's scope has now shifted to
115
+ * allow_partial_search_results in CPS environment.
116
+ */
126
117
}
127
118
128
119
private SearchRequest getSearchRequest (boolean allowPartialResults ) {
0 commit comments