From 01e9011ea499a6cd5f1c9d1471dfe7ecffd8c1b2 Mon Sep 17 00:00:00 2001 From: anastasia Date: Tue, 25 May 2021 17:29:14 +0300 Subject: [PATCH] add more checks to test_oldestXid: check also oldest_xid_dbid and oldest_active_xid --- test_runner/batch_others/test_oldestXid.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/test_runner/batch_others/test_oldestXid.py b/test_runner/batch_others/test_oldestXid.py index 92d5f3e791..332c548ad8 100644 --- a/test_runner/batch_others/test_oldestXid.py +++ b/test_runner/batch_others/test_oldestXid.py @@ -24,8 +24,11 @@ def test_oldestxid(zenith_cli, pageserver, postgres, pg_bin, repo_dir): cur.execute("INSERT INTO foo VALUES ('bar')"); cur.execute('checkpoint') - cur.execute('SELECT oldest_xid FROM pg_control_checkpoint();') - oldest_xid = cur.fetchone()[0] + cur.execute('SELECT oldest_xid, oldest_xid_dbid, oldest_active_xid FROM pg_control_checkpoint();') + res = cur.fetchone() + oldest_xid = res[0] + oldest_xid_dbid = res[1] + oldest_active_xid = res[2] # Stop, and destroy the Postgres instance. Then recreate and restart it. pg_conn.close(); @@ -41,10 +44,17 @@ def test_oldestxid(zenith_cli, pageserver, postgres, pg_bin, repo_dir): pg_conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT) cur = pg_conn.cursor() - cur.execute('SELECT oldest_xid FROM pg_control_checkpoint();') - oldest_xid_new = cur.fetchone()[0] + cur.execute('SELECT oldest_xid, oldest_xid_dbid, oldest_active_xid FROM pg_control_checkpoint();') + res = cur.fetchone() + oldest_xid_new = res[0] + oldest_xid_dbid_new = res[1] + oldest_active_xid_new = res[2] assert(oldest_xid_new == oldest_xid) + assert(oldest_xid_dbid_new == oldest_xid_dbid) + + # this field should be reset at restart + assert(int(oldest_active_xid_new) == 0) # capture new pg_controldata output for debugging purposes pgdatadir = os.path.join(repo_dir, 'pgdatadirs/test_oldestxid')