mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-14 17:02:56 +00:00
The synchronous 'tar' crate has required us to use block_in_place and SyncIoBridge to work together with the async I/O in the client connection. Switch to 'tokio-tar' crate that uses async I/O natively. As part of this, move the CopyDataWriter implementation to postgres_backend_async.rs. Even though it's only used in one place currently, it's in principle generally applicable whenever you want to use COPY out. Unfortunately we cannot use the 'tokio-tar' as it is: the Builder implementation requires the writer to have 'static lifetime. So we have to use a modified version without that requirement. The 'static lifetime was required just for the Drop implementation that writes the end-of-archive sections if the Builder is dropped without calling `finish`. But we don't actually want that behavior anyway; in fact we had to jump through some hoops with the AbortableWrite hack to skip those. With the modified version of 'tokio-tar' without that Drop implementation, we don't need AbortableWrite either. Co-authored-by: Kirill Bulatov <kirill@neon.tech>
33 lines
930 B
Python
Executable File
33 lines
930 B
Python
Executable File
from contextlib import closing
|
|
|
|
from fixtures.log_helper import log
|
|
from fixtures.neon_fixtures import NeonEnv
|
|
|
|
|
|
#
|
|
# Test starting Postgres with custom options
|
|
#
|
|
def test_config(neon_simple_env: NeonEnv):
|
|
env = neon_simple_env
|
|
env.neon_cli.create_branch("test_config", "empty")
|
|
|
|
# change config
|
|
pg = env.postgres.create_start("test_config", config_lines=["log_min_messages=debug1"])
|
|
log.info("postgres is running on test_config branch")
|
|
|
|
with closing(pg.connect()) as conn:
|
|
with conn.cursor() as cur:
|
|
cur.execute(
|
|
"""
|
|
SELECT setting
|
|
FROM pg_settings
|
|
WHERE
|
|
source != 'default'
|
|
AND source != 'override'
|
|
AND name = 'log_min_messages'
|
|
"""
|
|
)
|
|
|
|
# check that config change was applied
|
|
assert cur.fetchone() == ("debug1",)
|