From 6fe534fea3c869038deda08e3fc40cf1c8c31a0c Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Fri, 2 Feb 2024 10:05:50 +0000 Subject: [PATCH] move protocol ad child module of `process`, where it belongs --- pageserver/src/walredo.rs | 4 +--- pageserver/src/walredo/process.rs | 9 +++++---- pageserver/src/walredo/{ => process}/protocol.rs | 0 3 files changed, 6 insertions(+), 7 deletions(-) rename pageserver/src/walredo/{ => process}/protocol.rs (100%) diff --git a/pageserver/src/walredo.rs b/pageserver/src/walredo.rs index 35f2d8d8de..8c363ac34c 100644 --- a/pageserver/src/walredo.rs +++ b/pageserver/src/walredo.rs @@ -53,7 +53,6 @@ use postgres_ffi::v14::nonrelfile_utils::{ use postgres_ffi::BLCKSZ; mod process; -mod protocol; use process::WalRedoProcess; /// @@ -260,9 +259,8 @@ impl PostgresRedoManager { let started_at = std::time::Instant::now(); // Relational WAL records are applied using wal-redo-postgres - let buf_tag = protocol::BufferTag { rel, blknum }; let result = proc - .apply_wal_records(buf_tag, &base_img, records, wal_redo_timeout) + .apply_wal_records(rel, blknum, &base_img, records, wal_redo_timeout) .context("apply_wal_records"); let duration = started_at.elapsed(); diff --git a/pageserver/src/walredo/process.rs b/pageserver/src/walredo/process.rs index 3b0545437c..9f53e7b7f4 100644 --- a/pageserver/src/walredo/process.rs +++ b/pageserver/src/walredo/process.rs @@ -9,7 +9,7 @@ use std::{ use anyhow::Context; use bytes::Bytes; use nix::poll::{PollFd, PollFlags}; -use pageserver_api::shard::TenantShardId; +use pageserver_api::{reltag::RelTag, shard::TenantShardId}; use postgres_ffi::BLCKSZ; use tracing::{debug, error, instrument, Instrument}; @@ -25,9 +25,8 @@ use utils::{lsn::Lsn, nonblock::set_nonblock}; use std::os::fd::AsRawFd; -use super::protocol; - mod no_leak_child; +mod protocol; pub struct WalRedoProcess { #[allow(dead_code)] @@ -183,11 +182,13 @@ impl WalRedoProcess { #[instrument(skip_all, fields(tenant_id=%self.tenant_shard_id.tenant_id, shard_id=%self.tenant_shard_id.shard_slug(), pid=%self.id()))] pub(crate) fn apply_wal_records( &self, - tag: protocol::BufferTag, + rel: RelTag, + blknum: u32, base_img: &Option, records: &[(Lsn, NeonWalRecord)], wal_redo_timeout: Duration, ) -> anyhow::Result { + let tag = protocol::BufferTag { rel, blknum }; let input = self.stdin.lock().unwrap(); // Serialize all the messages to send the WAL redo process first. diff --git a/pageserver/src/walredo/protocol.rs b/pageserver/src/walredo/process/protocol.rs similarity index 100% rename from pageserver/src/walredo/protocol.rs rename to pageserver/src/walredo/process/protocol.rs