mirror of
https://github.com/neondatabase/neon.git
synced 2025-12-26 07:39:58 +00:00
Qualify call to neon extension in compute_ctl's prewarming (#12554)
https://github.com/neondatabase/cloud/issues/19011 Calls without `neon.` failed on staging. Also fix local tests to work with qualified calls
This commit is contained in:
@@ -70,7 +70,7 @@ impl ComputeNode {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
let row = match client
|
let row = match client
|
||||||
.query_one("select * from get_prewarm_info()", &[])
|
.query_one("select * from neon.get_prewarm_info()", &[])
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
Ok(row) => row,
|
Ok(row) => row,
|
||||||
@@ -146,7 +146,7 @@ impl ComputeNode {
|
|||||||
ComputeNode::get_maintenance_client(&self.tokio_conn_conf)
|
ComputeNode::get_maintenance_client(&self.tokio_conn_conf)
|
||||||
.await
|
.await
|
||||||
.context("connecting to postgres")?
|
.context("connecting to postgres")?
|
||||||
.query_one("select prewarm_local_cache($1)", &[&uncompressed])
|
.query_one("select neon.prewarm_local_cache($1)", &[&uncompressed])
|
||||||
.await
|
.await
|
||||||
.context("loading LFC state into postgres")
|
.context("loading LFC state into postgres")
|
||||||
.map(|_| ())
|
.map(|_| ())
|
||||||
@@ -196,7 +196,7 @@ impl ComputeNode {
|
|||||||
ComputeNode::get_maintenance_client(&self.tokio_conn_conf)
|
ComputeNode::get_maintenance_client(&self.tokio_conn_conf)
|
||||||
.await
|
.await
|
||||||
.context("connecting to postgres")?
|
.context("connecting to postgres")?
|
||||||
.query_one("select get_local_cache_state()", &[])
|
.query_one("select neon.get_local_cache_state()", &[])
|
||||||
.await
|
.await
|
||||||
.context("querying LFC state")?
|
.context("querying LFC state")?
|
||||||
.try_get::<usize, &[u8]>(0)
|
.try_get::<usize, &[u8]>(0)
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ def prom_parse(client: EndpointHttpClient) -> dict[str, float]:
|
|||||||
|
|
||||||
def offload_lfc(method: PrewarmMethod, client: EndpointHttpClient, cur: Cursor) -> Any:
|
def offload_lfc(method: PrewarmMethod, client: EndpointHttpClient, cur: Cursor) -> Any:
|
||||||
if method == PrewarmMethod.POSTGRES:
|
if method == PrewarmMethod.POSTGRES:
|
||||||
cur.execute("select get_local_cache_state()")
|
cur.execute("select neon.get_local_cache_state()")
|
||||||
return cur.fetchall()[0][0]
|
return cur.fetchall()[0][0]
|
||||||
|
|
||||||
if method == PrewarmMethod.AUTOPREWARM:
|
if method == PrewarmMethod.AUTOPREWARM:
|
||||||
@@ -72,7 +72,7 @@ def prewarm_endpoint(
|
|||||||
elif method == PrewarmMethod.COMPUTE_CTL:
|
elif method == PrewarmMethod.COMPUTE_CTL:
|
||||||
client.prewarm_lfc()
|
client.prewarm_lfc()
|
||||||
elif method == PrewarmMethod.POSTGRES:
|
elif method == PrewarmMethod.POSTGRES:
|
||||||
cur.execute("select prewarm_local_cache(%s)", (lfc_state,))
|
cur.execute("select neon.prewarm_local_cache(%s)", (lfc_state,))
|
||||||
|
|
||||||
|
|
||||||
def check_prewarmed(
|
def check_prewarmed(
|
||||||
@@ -116,7 +116,7 @@ def test_lfc_prewarm(neon_simple_env: NeonEnv, method: PrewarmMethod):
|
|||||||
|
|
||||||
pg_conn = endpoint.connect()
|
pg_conn = endpoint.connect()
|
||||||
pg_cur = pg_conn.cursor()
|
pg_cur = pg_conn.cursor()
|
||||||
pg_cur.execute("create extension neon")
|
pg_cur.execute("create schema neon; create extension neon with schema neon")
|
||||||
pg_cur.execute("create database lfc")
|
pg_cur.execute("create database lfc")
|
||||||
|
|
||||||
lfc_conn = endpoint.connect(dbname="lfc")
|
lfc_conn = endpoint.connect(dbname="lfc")
|
||||||
@@ -142,10 +142,12 @@ def test_lfc_prewarm(neon_simple_env: NeonEnv, method: PrewarmMethod):
|
|||||||
lfc_cur = lfc_conn.cursor()
|
lfc_cur = lfc_conn.cursor()
|
||||||
prewarm_endpoint(method, client, pg_cur, lfc_state)
|
prewarm_endpoint(method, client, pg_cur, lfc_state)
|
||||||
|
|
||||||
pg_cur.execute("select lfc_value from neon_lfc_stats where lfc_key='file_cache_used_pages'")
|
pg_cur.execute(
|
||||||
|
"select lfc_value from neon.neon_lfc_stats where lfc_key='file_cache_used_pages'"
|
||||||
|
)
|
||||||
lfc_used_pages = pg_cur.fetchall()[0][0]
|
lfc_used_pages = pg_cur.fetchall()[0][0]
|
||||||
log.info(f"Used LFC size: {lfc_used_pages}")
|
log.info(f"Used LFC size: {lfc_used_pages}")
|
||||||
pg_cur.execute("select * from get_prewarm_info()")
|
pg_cur.execute("select * from neon.get_prewarm_info()")
|
||||||
total, prewarmed, skipped, _ = pg_cur.fetchall()[0]
|
total, prewarmed, skipped, _ = pg_cur.fetchall()[0]
|
||||||
log.info(f"Prewarm info: {total=} {prewarmed=} {skipped=}")
|
log.info(f"Prewarm info: {total=} {prewarmed=} {skipped=}")
|
||||||
progress = (prewarmed + skipped) * 100 // total
|
progress = (prewarmed + skipped) * 100 // total
|
||||||
@@ -186,7 +188,7 @@ def test_lfc_prewarm_under_workload(neon_simple_env: NeonEnv, method: PrewarmMet
|
|||||||
|
|
||||||
pg_conn = endpoint.connect()
|
pg_conn = endpoint.connect()
|
||||||
pg_cur = pg_conn.cursor()
|
pg_cur = pg_conn.cursor()
|
||||||
pg_cur.execute("create extension neon")
|
pg_cur.execute("create schema neon; create extension neon with schema neon")
|
||||||
pg_cur.execute("CREATE DATABASE lfc")
|
pg_cur.execute("CREATE DATABASE lfc")
|
||||||
|
|
||||||
lfc_conn = endpoint.connect(dbname="lfc")
|
lfc_conn = endpoint.connect(dbname="lfc")
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ def test_replica_promote(neon_simple_env: NeonEnv, method: PromoteMethod):
|
|||||||
|
|
||||||
with primary.connect() as primary_conn:
|
with primary.connect() as primary_conn:
|
||||||
primary_cur = primary_conn.cursor()
|
primary_cur = primary_conn.cursor()
|
||||||
primary_cur.execute("create extension neon")
|
primary_cur.execute("create schema neon;create extension neon with schema neon")
|
||||||
primary_cur.execute(
|
primary_cur.execute(
|
||||||
"create table t(pk bigint GENERATED ALWAYS AS IDENTITY, payload integer)"
|
"create table t(pk bigint GENERATED ALWAYS AS IDENTITY, payload integer)"
|
||||||
)
|
)
|
||||||
@@ -172,7 +172,7 @@ def test_replica_promote_handler_disconnects(neon_simple_env: NeonEnv):
|
|||||||
secondary: Endpoint = env.endpoints.new_replica_start(origin=primary, endpoint_id="secondary")
|
secondary: Endpoint = env.endpoints.new_replica_start(origin=primary, endpoint_id="secondary")
|
||||||
|
|
||||||
with primary.connect() as conn, conn.cursor() as cur:
|
with primary.connect() as conn, conn.cursor() as cur:
|
||||||
cur.execute("create extension neon")
|
cur.execute("create schema neon;create extension neon with schema neon")
|
||||||
cur.execute("create table t(pk bigint GENERATED ALWAYS AS IDENTITY, payload integer)")
|
cur.execute("create table t(pk bigint GENERATED ALWAYS AS IDENTITY, payload integer)")
|
||||||
cur.execute("INSERT INTO t(payload) SELECT generate_series(1, 100)")
|
cur.execute("INSERT INTO t(payload) SELECT generate_series(1, 100)")
|
||||||
cur.execute("show neon.safekeepers")
|
cur.execute("show neon.safekeepers")
|
||||||
|
|||||||
Reference in New Issue
Block a user