Improve debugability for columnar_memory flakyness (#6203)

Sometimes the columnar_memory test fails in CI with the following error:
```diff
 SELECT 1.0 * TopMemoryContext / :top_post BETWEEN 0.98 AND 1.02 AS top_growth_ok
 FROM columnar_test_helpers.columnar_store_memory_stats();
 -[ RECORD 1 ]-+--
-top_growth_ok | t
+top_growth_ok | f

 -- before this change, max mem usage while executing inserts was 28MB and
```

This is almost certainly a harmless failure that simply requires bumping
the margin a little bit. However, it's impossible to say with the
current output. I was unable to reproduce this on-demand on my local
machine or even in CI. So this changes the test to include the actual
value difference in the size of TopMemoryContext when it's outside the
expected range. Then next time it fails we at least have some
information about why.

Example of failing test: https://app.circleci.com/pipelines/github/citusdata/citus/25966/workflows/d472a57b-419a-4f33-b8bc-2e174a98d4d6/jobs/730576

(cherry picked from commit e6a1a86db0)
pull/6363/head
Jelte Fennema 2022-08-19 15:41:16 +02:00
parent c1f58fac6c
commit 242f40d640
2 changed files with 4 additions and 4 deletions

View File

@ -71,10 +71,10 @@ write_clear_outside_xact | t
INSERT INTO t
SELECT i, 'last batch', 0 /* no need to record memusage per row */
FROM generate_series(1, 50000) i;
SELECT 1.0 * TopMemoryContext / :top_post BETWEEN 0.98 AND 1.02 AS top_growth_ok
SELECT CASE WHEN 1.0 * TopMemoryContext / :top_post BETWEEN 0.98 AND 1.02 THEN 1 ELSE 1.0 * TopMemoryContext / :top_post END AS top_growth
FROM columnar_test_helpers.columnar_store_memory_stats();
-[ RECORD 1 ]-+--
top_growth_ok | t
-[ RECORD 1 ]-
top_growth | 1
-- before this change, max mem usage while executing inserts was 28MB and
-- with this change it's less than 8MB.

View File

@ -73,7 +73,7 @@ INSERT INTO t
SELECT i, 'last batch', 0 /* no need to record memusage per row */
FROM generate_series(1, 50000) i;
SELECT 1.0 * TopMemoryContext / :top_post BETWEEN 0.98 AND 1.02 AS top_growth_ok
SELECT CASE WHEN 1.0 * TopMemoryContext / :top_post BETWEEN 0.98 AND 1.02 THEN 1 ELSE 1.0 * TopMemoryContext / :top_post END AS top_growth
FROM columnar_test_helpers.columnar_store_memory_stats();
-- before this change, max mem usage while executing inserts was 28MB and