move protocol ad child module of process, where it belongs

This commit is contained in:
Christian Schwarz
2024-02-02 10:05:50 +00:00
parent 8b258e20a0
commit 6fe534fea3
3 changed files with 6 additions and 7 deletions

View File

@@ -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();

View File

@@ -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<Bytes>,
records: &[(Lsn, NeonWalRecord)],
wal_redo_timeout: Duration,
) -> anyhow::Result<Bytes> {
let tag = protocol::BufferTag { rel, blknum };
let input = self.stdin.lock().unwrap();
// Serialize all the messages to send the WAL redo process first.