diff --git a/test_runner/regress/test_pgstat.py b/test_runner/regress/test_pgstat.py index f17bf7a423..4f89a9961f 100644 --- a/test_runner/regress/test_pgstat.py +++ b/test_runner/regress/test_pgstat.py @@ -14,6 +14,8 @@ def test_pgstat(neon_simple_env: NeonEnv): if env.pg_version == PgVersion.V14: pytest.skip("PG14 doesn't support pgstat statistic persistence") + env.pageserver.allowed_errors.append(".*this timeline is using deprecated aux file policy V1.*") + n = 10000 endpoint = env.endpoints.create_start("main") @@ -32,7 +34,7 @@ def test_pgstat(neon_simple_env: NeonEnv): "select seq_scan,seq_tup_read,n_tup_ins,n_tup_upd,n_live_tup,n_dead_tup, vacuum_count,analyze_count from pg_stat_user_tables" ) rec = cur.fetchall()[0] - assert (rec == (2, n * 2, n, n, n * 2, n, 1, 1)) + assert rec == (2, n * 2, n, n, n * 2, n, 1, 1) endpoint.stop() endpoint.start() @@ -44,13 +46,20 @@ def test_pgstat(neon_simple_env: NeonEnv): "select seq_scan,seq_tup_read,n_tup_ins,n_tup_upd,n_live_tup,n_dead_tup, vacuum_count,analyze_count from pg_stat_user_tables" ) rec = cur.fetchall()[0] - assert ( - rec[0] == 2 - and rec[1] == n * 2 - and rec[2] == n - and rec[3] == n - and rec[4] == n * 2 - and rec[5] == n - and rec[6] == 1 - and rec[7] == 1 + assert rec == (2, n * 2, n, n, n * 2, n, 1, 1) + + cur.execute("update t set x=x+1") + + # stop without checkpoint + endpoint.stop(mode="immediate") + endpoint.start() + + con = endpoint.connect() + cur = con.cursor() + + cur.execute( + "select seq_scan,seq_tup_read,n_tup_ins,n_tup_upd,n_live_tup,n_dead_tup, vacuum_count,analyze_count from pg_stat_user_tables" ) + rec = cur.fetchall()[0] + # pgstat information should be discarded in case of abnormal termination + assert rec == (0, 0, 0, 0, 0, 0, 0, 0)