Skip to content

Commit f0dede0

Browse files
committed
Add logging to FullClusterRestartSystemIndexCompatibilityIT
This test occasionally fails on version 8.19 clusters when we are waiting for system index migration to finish. In order to understand this better, log time when migration API call is sent and also catch assertion error and log migration API status in that case to help the investigation.
1 parent 5f256cc commit f0dede0

File tree

1 file changed

+29
-13
lines changed

1 file changed

+29
-13
lines changed

qa/lucene-index-compatibility/src/javaRestTest/java/org/elasticsearch/lucene/FullClusterRestartSystemIndexCompatibilityIT.java

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
package org.elasticsearch.lucene;
1111

12+
import org.apache.http.util.EntityUtils;
1213
import org.elasticsearch.client.Request;
1314
import org.elasticsearch.client.RequestOptions;
1415
import org.elasticsearch.client.Response;
@@ -17,6 +18,7 @@
1718
import org.elasticsearch.cluster.metadata.IndexMetadata;
1819
import org.elasticsearch.common.settings.Settings;
1920
import org.elasticsearch.test.cluster.util.Version;
21+
import org.elasticsearch.test.junit.annotations.TestIssueLogging;
2022
import org.elasticsearch.test.rest.ObjectPath;
2123

2224
import java.io.IOException;
@@ -43,6 +45,10 @@ public FullClusterRestartSystemIndexCompatibilityIT(Version version) {
4345
* 2. After update to N-1 (latest) perform a system index migration step, also write block the index
4446
* 3. on N, check that async search results are still retrievable and we can write to the system index
4547
*/
48+
@TestIssueLogging(
49+
value = "org.elasticsearch.lucene.FullClusterRestartSystemIndexCompatibilityIT:DEBUG",
50+
issueUrl = "https://github.com/elastic/elasticsearch/issues/127245"
51+
)
4652
public void testAsyncSearchIndexMigration() throws Exception {
4753
final String index = suffix("index");
4854
final String asyncSearchIndex = ".async-search";
@@ -83,19 +89,29 @@ public void testAsyncSearchIndexMigration() throws Exception {
8389
ObjectPath.createFromResponse(client().performRequest(migrateRequest)).evaluate("features.0.feature_name"),
8490
equalTo("async_search")
8591
);
86-
assertBusy(() -> {
87-
Request checkMigrateProgress = new Request("GET", "/_migration/system_features");
88-
Response resp = null;
89-
try {
90-
assertFalse(
91-
ObjectPath.createFromResponse(client().performRequest(checkMigrateProgress))
92-
.evaluate("migration_status")
93-
.equals("IN_PROGRESS")
94-
);
95-
} catch (IOException e) {
96-
throw new AssertionError("System feature migration failed", e);
97-
}
98-
});
92+
93+
logger.debug("--> starting system index migration");
94+
Request checkMigrateProgress = new Request("GET", "/_migration/system_features");
95+
try {
96+
assertBusy(() -> {
97+
Response resp = null;
98+
try {
99+
assertFalse(
100+
ObjectPath.createFromResponse(client().performRequest(checkMigrateProgress))
101+
.evaluate("migration_status")
102+
.equals("IN_PROGRESS")
103+
);
104+
} catch (IOException e) {
105+
throw new AssertionError("System feature migration failed", e);
106+
}
107+
});
108+
} catch (AssertionError e) {
109+
logger.debug(
110+
"--> system index migration not finished yet, response: {}",
111+
EntityUtils.toString(client().performRequest(checkMigrateProgress).getEntity())
112+
);
113+
throw e;
114+
}
99115

100116
// check search results from n-2 search are still readable
101117
assertAsyncSearchHitCount(async_search_ids.get("n-2_id"), numDocs);

0 commit comments

Comments
 (0)