mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-16 04:30:38 +00:00
fixup: test_pageserver_metrics_removed_after_detach[debug-pg14-noop]'
last_flush_lsn_upload obviously doesn't work with NOOP storage kind but we need the on-disk state at that lsn, so, wait for on-disk consistent in that case
This commit is contained in:
@@ -3064,6 +3064,21 @@ def fork_at_current_lsn(
|
||||
return env.neon_cli.create_branch(new_branch_name, ancestor_branch_name, tenant_id, current_lsn)
|
||||
|
||||
|
||||
def last_flush_lsn_checkpoint(
|
||||
env: NeonEnv, endpoint: Endpoint, tenant_id: TenantId, timeline_id: TimelineId
|
||||
) -> Lsn:
|
||||
"""
|
||||
Wait for pageserver to catch to the latest flush LSN of given endpoint, then
|
||||
checkpoint pageserver.
|
||||
"""
|
||||
last_flush_lsn = wait_for_last_flush_lsn(env, endpoint, tenant_id, timeline_id)
|
||||
ps_http = env.pageserver.http_client()
|
||||
wait_for_last_record_lsn(ps_http, tenant_id, timeline_id, last_flush_lsn)
|
||||
# force a checkpoint to trigger upload
|
||||
ps_http.timeline_checkpoint(tenant_id, timeline_id)
|
||||
return last_flush_lsn
|
||||
|
||||
|
||||
def last_flush_lsn_upload(
|
||||
env: NeonEnv, endpoint: Endpoint, tenant_id: TenantId, timeline_id: TimelineId
|
||||
) -> Lsn:
|
||||
@@ -3072,10 +3087,7 @@ def last_flush_lsn_upload(
|
||||
checkpoint pageserver, and wait for it to be uploaded (remote_consistent_lsn
|
||||
reaching flush LSN).
|
||||
"""
|
||||
last_flush_lsn = wait_for_last_flush_lsn(env, endpoint, tenant_id, timeline_id)
|
||||
last_flush_lsn = last_flush_lsn_checkpoint(env, endpoint, tenant_id, timeline_id)
|
||||
ps_http = env.pageserver.http_client()
|
||||
wait_for_last_record_lsn(ps_http, tenant_id, timeline_id, last_flush_lsn)
|
||||
# force a checkpoint to trigger upload
|
||||
ps_http.timeline_checkpoint(tenant_id, timeline_id)
|
||||
wait_for_upload(ps_http, tenant_id, timeline_id, last_flush_lsn)
|
||||
return last_flush_lsn
|
||||
|
||||
@@ -20,6 +20,7 @@ from fixtures.neon_fixtures import (
|
||||
NeonEnvBuilder,
|
||||
RemoteStorageKind,
|
||||
available_remote_storages,
|
||||
last_flush_lsn_checkpoint,
|
||||
last_flush_lsn_upload,
|
||||
)
|
||||
from fixtures.types import Lsn, TenantId, TimelineId
|
||||
@@ -275,7 +276,10 @@ def test_pageserver_metrics_removed_after_detach(
|
||||
cur.execute("INSERT INTO t SELECT generate_series(1,100000), 'payload'")
|
||||
cur.execute("SELECT sum(key) FROM t")
|
||||
assert cur.fetchone() == (5000050000,)
|
||||
last_flush_lsn_upload(env, endpoint, endpoint.tenant_id, timeline_id)
|
||||
if remote_storage_kind != RemoteStorageKind.NOOP:
|
||||
last_flush_lsn_upload(env, endpoint, endpoint.tenant_id, timeline_id)
|
||||
else:
|
||||
last_flush_lsn_checkpoint(env, endpoint, endpoint.tenant_id, timeline_id)
|
||||
endpoint.stop()
|
||||
|
||||
def get_ps_metric_samples_for_tenant(tenant_id: TenantId) -> List[Sample]:
|
||||
|
||||
Reference in New Issue
Block a user