mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-06 21:12:55 +00:00
## Problem LFC is not enabled by default in tests, but it is enabled in production. This increases the risk of errors in the production environment, which were not found during the routine workflow. However, enabling LFC for all the tests may overload the disk on our servers and increase the number of failures. So, we try enabling LFC in one case to evaluate the possible risk. ## Summary of changes A new environment variable, USE_LFC is introduced. If it is set to true, LFC is enabled by default in all the tests. In our workflow, we enable LFC for PG17, release, x86-64, and disabled for all other combinations. --------- Co-authored-by: Alexey Masterov <alexeymasterov@neon.tech> Co-authored-by: a-masterov <72613290+a-masterov@users.noreply.github.com>
48 lines
1.4 KiB
Python
48 lines
1.4 KiB
Python
from __future__ import annotations
|
|
|
|
from fixtures.log_helper import log
|
|
from fixtures.neon_fixtures import NeonEnvBuilder
|
|
|
|
|
|
def test_oid_overflow(neon_env_builder: NeonEnvBuilder):
|
|
env = neon_env_builder.init_start()
|
|
|
|
endpoint = env.endpoints.create_start("main")
|
|
|
|
conn = endpoint.connect()
|
|
cur = conn.cursor()
|
|
|
|
cur.execute("CREATE EXTENSION neon_test_utils")
|
|
|
|
cur.execute("CREATE TABLE t1(x integer)")
|
|
cur.execute("INSERT INTO t1 values (1)")
|
|
cur.execute("CREATE TABLE t2(x integer)")
|
|
cur.execute("INSERT INTO t2 values (2)")
|
|
|
|
cur.execute("SELECT x from t1")
|
|
assert cur.fetchone() == (1,)
|
|
cur.execute("SELECT x from t2")
|
|
assert cur.fetchone() == (2,)
|
|
|
|
cur.execute("VACUUM FULL t1")
|
|
cur.execute("VACUUM FULL t1")
|
|
cur.execute("vacuum pg_class")
|
|
cur.execute("SELECT relfilenode FROM pg_class where relname='t1'")
|
|
oid = cur.fetchall()[0][0]
|
|
log.info(f"t1.relfilenode={oid}")
|
|
|
|
cur.execute("set statement_timeout=0")
|
|
cur.execute(f"select test_consume_oids({oid-1})")
|
|
cur.execute("VACUUM FULL t2")
|
|
|
|
cur.execute("SELECT relfilenode FROM pg_class where relname='t2'")
|
|
oid = cur.fetchall()[0][0]
|
|
log.info(f"t2.relfilenode={oid}")
|
|
|
|
endpoint.clear_buffers(cursor=cur)
|
|
|
|
cur.execute("SELECT x from t1")
|
|
assert cur.fetchone() == (1,)
|
|
cur.execute("SELECT x from t2")
|
|
assert cur.fetchone() == (2,)
|