mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-07 05:22:56 +00:00
## Problem https://github.com/neondatabase/neon/pull/9746 lifted decoding and interpretation of WAL to the safekeeper. This reduced the ingested amount on the pageservers by around 10x for a tenant with 8 shards, but doubled the ingested amount for single sharded tenants. Also, https://github.com/neondatabase/neon/pull/9746 uses bincode which doesn't support schema evolution. Technically the schema can be evolved, but it's very cumbersome. ## Summary of changes This patch set addresses both problems by adding protobuf support for the interpreted wal records and adding compression support. Compressed protobuf reduced the ingested amount by 100x on the 32 shards `test_sharded_ingest` case (compared to non-interpreted proto). For the 1 shard case the reduction is 5x. Sister change to `rust-postgres` is [here](https://github.com/neondatabase/rust-postgres/pull/33). ## Links Related: https://github.com/neondatabase/neon/issues/9336 Epic: https://github.com/neondatabase/neon/issues/9329
43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
from __future__ import annotations
|
|
|
|
import pytest
|
|
from fixtures.neon_fixtures import (
|
|
NeonEnvBuilder,
|
|
PageserverWalReceiverProtocol,
|
|
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.
|
|
@pytest.mark.parametrize(
|
|
"wal_receiver_protocol",
|
|
[PageserverWalReceiverProtocol.VANILLA, PageserverWalReceiverProtocol.INTERPRETED],
|
|
)
|
|
def test_subxacts(neon_env_builder: NeonEnvBuilder, test_output_dir, wal_receiver_protocol):
|
|
neon_env_builder.pageserver_wal_receiver_protocol = wal_receiver_protocol
|
|
|
|
env = neon_env_builder.init_start()
|
|
endpoint = env.endpoints.create_start("main")
|
|
|
|
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")
|
|
|
|
check_restored_datadir_content(test_output_dir, env, endpoint)
|