add more checks to test_oldestXid: check also oldest_xid_dbid and oldest_active_xid

This commit is contained in:
anastasia
2021-05-25 17:29:14 +03:00
parent f61e92b692
commit 01e9011ea4

View File

@@ -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')