mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-15 09:22:55 +00:00
We use the term "endpoint" in for compute Postgres nodes in the web UI
and user-facing documentation now. Adjust the nomenclature in the code.
This changes the name of the "neon_local pg" command to "neon_local
endpoint". Also adjust names of classes, variables etc. in the python
tests accordingly.
This also changes the directory structure so that endpoints are now
stored in:
.neon/endpoints/<endpoint id>
instead of:
.neon/pgdatadirs/tenants/<tenant_id>/<endpoint (node) name>
The tenant ID is no longer part of the path. That means that you
cannot have two endpoints with the same name/ID in two different
tenants anymore. That's consistent with how we treat endpoints in the
real control plane and proxy: the endpoint ID must be globally unique.
41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
from fixtures.log_helper import log
|
|
from fixtures.neon_fixtures import NeonEnv, check_restored_datadir_content
|
|
|
|
|
|
# Test subtransactions
|
|
#
|
|
# The pg_subxact SLRU is not preserved on restarts, and doesn't need to be
|
|
# maintained in the pageserver, so subtransactions are not very exciting for
|
|
# Neon. They are included in the commit record though and updated in the
|
|
# CLOG.
|
|
def test_subxacts(neon_simple_env: NeonEnv, test_output_dir):
|
|
env = neon_simple_env
|
|
env.neon_cli.create_branch("test_subxacts", "empty")
|
|
endpoint = env.endpoints.create_start("test_subxacts")
|
|
|
|
log.info("postgres is running on 'test_subxacts' branch")
|
|
pg_conn = endpoint.connect()
|
|
cur = pg_conn.cursor()
|
|
|
|
cur.execute(
|
|
"""
|
|
CREATE TABLE t1(i int, j int);
|
|
"""
|
|
)
|
|
|
|
cur.execute("select pg_switch_wal();")
|
|
|
|
# Issue 100 transactions, with 1000 subtransactions in each.
|
|
for i in range(100):
|
|
cur.execute("begin")
|
|
for j in range(1000):
|
|
cur.execute(f"savepoint sp{j}")
|
|
cur.execute(f"insert into t1 values ({i}, {j})")
|
|
cur.execute("commit")
|
|
|
|
# force wal flush
|
|
cur.execute("checkpoint")
|
|
|
|
# Check that we can restore the content of the datadir correctly
|
|
check_restored_datadir_content(test_output_dir, env, endpoint)
|