mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-04 03:52:56 +00:00
## Problem `TYPE_CHECKING` is used inconsistently across Python tests. ## Summary of changes - Update `ruff`: 0.7.0 -> 0.11.2 - Enable TC (flake8-type-checking): https://docs.astral.sh/ruff/rules/#flake8-type-checking-tc - (auto)fix all new issues
36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
from __future__ import annotations
|
|
|
|
from contextlib import closing
|
|
from typing import TYPE_CHECKING
|
|
|
|
if TYPE_CHECKING:
|
|
from fixtures.compare_fixtures import PgCompare
|
|
|
|
|
|
#
|
|
# Test buffering GisT build. It WAL-logs the whole relation, in 32-page chunks.
|
|
# As of this writing, we're duplicate those giant WAL records for each page,
|
|
# which makes the delta layer about 32x larger than it needs to be.
|
|
#
|
|
def test_gist_buffering_build(neon_with_baseline: PgCompare):
|
|
env = neon_with_baseline
|
|
|
|
with closing(env.pg.connect()) as conn:
|
|
with conn.cursor() as cur:
|
|
# Create test table.
|
|
cur.execute("create table gist_point_tbl(id int4, p point)")
|
|
cur.execute(
|
|
"insert into gist_point_tbl select g, point(g, g) from generate_series(1, 1000000) g;"
|
|
)
|
|
|
|
# Build the index.
|
|
with env.record_pageserver_writes("pageserver_writes"):
|
|
with env.record_duration("build"):
|
|
cur.execute(
|
|
"create index gist_pointidx2 on gist_point_tbl using gist(p) with (buffering = on)"
|
|
)
|
|
env.flush()
|
|
|
|
env.report_peak_memory_use()
|
|
env.report_size()
|