Add python types to represent LSNs, tenant IDs and timeline IDs. (#2351)

For better ergonomics. I always found it weird that we used UUID to
actually mean a tenant or timeline ID. It worked because it happened
to have the same length, 16 bytes, but it was hacky.
This commit is contained in:
Heikki Linnakangas
2022-09-02 10:16:47 +03:00
committed by GitHub
parent f0a0d7bb7a
commit 47bd307cb8
31 changed files with 599 additions and 494 deletions
+7 -2
View File
@@ -1,6 +1,7 @@
import pytest
from fixtures.log_helper import log
from fixtures.neon_fixtures import NeonEnv
from fixtures.types import Lsn
from fixtures.utils import query_scalar
@@ -84,7 +85,9 @@ def test_readonly_node(neon_simple_env: NeonEnv):
# Check creating a node at segment boundary
pg = env.postgres.create_start(
branch_name="test_readonly_node", node_name="test_branch_segment_boundary", lsn="0/3000000"
branch_name="test_readonly_node",
node_name="test_branch_segment_boundary",
lsn=Lsn("0/3000000"),
)
cur = pg.connect().cursor()
cur.execute("SELECT 1")
@@ -94,5 +97,7 @@ def test_readonly_node(neon_simple_env: NeonEnv):
with pytest.raises(Exception, match="invalid basebackup lsn"):
# compute node startup with invalid LSN should fail
env.postgres.create_start(
branch_name="test_readonly_node", node_name="test_readonly_node_preinitdb", lsn="0/42"
branch_name="test_readonly_node",
node_name="test_readonly_node_preinitdb",
lsn=Lsn("0/42"),
)