mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-19 14:10:37 +00:00
[DNM] benchmark: add ability to force a walredo roundtrip even if in-proces is possible
This commit is contained in:
@@ -5085,6 +5085,16 @@ impl Timeline {
|
||||
img_lsn,
|
||||
request_lsn,
|
||||
);
|
||||
if *crate::walredo::ADD_PROCESS_PING_TO_IN_PROCESS {
|
||||
self.walredo_mgr
|
||||
.as_ref()
|
||||
.context("timeline has no walredo manager")
|
||||
.map_err(PageReconstructError::WalRedo)?
|
||||
.ping(self.pg_version)
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
Ok(img.clone())
|
||||
} else {
|
||||
Err(PageReconstructError::from(anyhow!(
|
||||
|
||||
@@ -171,7 +171,8 @@ impl PostgresRedoManager {
|
||||
|
||||
if rec_neon != batch_neon {
|
||||
let result = if batch_neon {
|
||||
self.apply_batch_neon(key, lsn, img, &records[batch_start..i])
|
||||
self.apply_batch_neon(key, lsn, img, &records[batch_start..i], pg_version)
|
||||
.await
|
||||
} else {
|
||||
self.apply_batch_postgres(
|
||||
key,
|
||||
@@ -192,7 +193,8 @@ impl PostgresRedoManager {
|
||||
}
|
||||
// last batch
|
||||
if batch_neon {
|
||||
self.apply_batch_neon(key, lsn, img, &records[batch_start..])
|
||||
self.apply_batch_neon(key, lsn, img, &records[batch_start..], pg_version)
|
||||
.await
|
||||
} else {
|
||||
self.apply_batch_postgres(
|
||||
key,
|
||||
@@ -494,12 +496,13 @@ impl PostgresRedoManager {
|
||||
///
|
||||
/// Process a batch of WAL records using bespoken Neon code.
|
||||
///
|
||||
fn apply_batch_neon(
|
||||
async fn apply_batch_neon(
|
||||
&self,
|
||||
key: Key,
|
||||
lsn: Lsn,
|
||||
base_img: Option<Bytes>,
|
||||
records: &[(Lsn, NeonWalRecord)],
|
||||
pg_version: u32,
|
||||
) -> Result<Bytes, Error> {
|
||||
let start_time = Instant::now();
|
||||
|
||||
@@ -529,6 +532,10 @@ impl PostgresRedoManager {
|
||||
lsn
|
||||
);
|
||||
|
||||
if *ADD_PROCESS_PING_TO_IN_PROCESS {
|
||||
self.ping(pg_version).await.unwrap();
|
||||
}
|
||||
|
||||
Ok(page.freeze())
|
||||
}
|
||||
|
||||
@@ -545,6 +552,11 @@ impl PostgresRedoManager {
|
||||
}
|
||||
}
|
||||
|
||||
// add a walredo roundtrip to simulate latency overhead
|
||||
pub(crate) static ADD_PROCESS_PING_TO_IN_PROCESS: Lazy<bool> = Lazy::new(|| {
|
||||
utils::env::var("NEON_PAGESERVER_WALREDO_ADD_PROCESS_PING_TO_IN_PROCESS").unwrap_or(false)
|
||||
});
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::PostgresRedoManager;
|
||||
|
||||
Reference in New Issue
Block a user