move more stuff around

This commit is contained in:
Christian Schwarz
2024-02-02 10:03:40 +00:00
parent 29eec6c563
commit 8b258e20a0
3 changed files with 20 additions and 21 deletions

View File

@@ -23,12 +23,11 @@ use self::no_leak_child::NoLeakChild;
use utils::{lsn::Lsn, nonblock::set_nonblock};
use super::BufferTag;
use std::os::fd::AsRawFd;
use super::protocol;
mod no_leak_child;
mod protocol;
pub struct WalRedoProcess {
#[allow(dead_code)]
@@ -184,7 +183,7 @@ 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: BufferTag,
tag: protocol::BufferTag,
base_img: &Option<Bytes>,
records: &[(Lsn, NeonWalRecord)],
wal_redo_timeout: Duration,

View File

@@ -1,8 +1,20 @@
use bytes::BufMut;
use pageserver_api::reltag::RelTag;
use serde::Serialize;
use utils::bin_ser::BeSer;
use utils::lsn::Lsn;
use super::BufferTag;
use utils::bin_ser::BeSer;
///
/// `RelTag` + block number (`blknum`) gives us a unique id of the page in the cluster.
///
/// In Postgres `BufferTag` structure is used for exactly the same purpose.
/// [See more related comments here](https://github.com/postgres/postgres/blob/99c5852e20a0987eca1c38ba0c09329d4076b6a0/src/include/storage/buf_internals.h#L91).
///
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Serialize)]
pub(crate) struct BufferTag {
pub rel: RelTag,
pub blknum: u32,
}
pub(crate) fn build_begin_redo_for_block_msg(tag: BufferTag, buf: &mut Vec<u8>) {
let len = 4 + 1 + 4 * 4;