Skip to content

Commit 72a8f7f

Browse files
authored
ESQL: Stabilize heap attack test (#132045)
In some contexts ESQL's HeapAttack tests were failing because the TranslogWriter keeps a map with the contents of the documents in it around. But only when assertions are enabled. Fun. This flushes the map away, preventing the odd OOM we were seeing in the HeapAttack tests.
1 parent ccf9893 commit 72a8f7f

File tree

1 file changed

+9
-1
lines changed
  • test/external-modules/esql-heap-attack/src/javaRestTest/java/org/elasticsearch/xpack/esql/heap_attack

1 file changed

+9
-1
lines changed

test/external-modules/esql-heap-attack/src/javaRestTest/java/org/elasticsearch/xpack/esql/heap_attack/HeapAttackIT.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,6 @@ private void initGiantTextField(int docs) throws IOException {
894894
}
895895
}
896896
}
897-
898897
logger.info("loading many documents with one big text field - docs per bulk {}", docsPerBulk);
899898

900899
int fieldSize = Math.toIntExact(ByteSizeValue.ofMb(5).getBytes());
@@ -1064,6 +1063,15 @@ private void bulk(String name, String bulk) throws IOException {
10641063
);
10651064
Response response = client().performRequest(request);
10661065
assertThat(entityAsMap(response), matchesMap().entry("errors", false).extraOk());
1066+
1067+
/*
1068+
* Flush after each bulk to clear the test-time seenSequenceNumbers Map in
1069+
* TranslogWriter. Without this the server will OOM from time to time keeping
1070+
* stuff around to run assertions on.
1071+
*/
1072+
request = new Request("POST", "/" + name + "/_flush");
1073+
response = client().performRequest(request);
1074+
assertThat(entityAsMap(response), matchesMap().entry("_shards", matchesMap().extraOk().entry("failed", 0)).extraOk());
10671075
}
10681076

10691077
private void initIndex(String name, String bulk) throws IOException {

0 commit comments

Comments
 (0)