Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(walredo): avoid duplicate tenant_id and shard_slug fields #7977

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pageserver/src/walredo/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use self::no_leak_child::NoLeakChild;
use crate::{
config::PageServerConf,
metrics::{WalRedoKillCause, WAL_REDO_PROCESS_COUNTERS, WAL_REDO_RECORD_COUNTER},
span::debug_assert_current_span_has_tenant_id,
walrecord::NeonWalRecord,
};
use anyhow::Context;
Expand All @@ -26,6 +27,7 @@ use utils::{lsn::Lsn, poison::Poison};
pub struct WalRedoProcess {
#[allow(dead_code)]
conf: &'static PageServerConf,
#[cfg(feature = "testing")]
tenant_shard_id: TenantShardId,
// Some() on construction, only becomes None on Drop.
child: Option<NoLeakChild>,
Expand Down Expand Up @@ -143,6 +145,7 @@ impl WalRedoProcess {

Ok(Self {
conf,
#[cfg(feature = "testing")]
tenant_shard_id,
child: Some(child),
stdin: tokio::sync::Mutex::new(Poison::new(
Expand Down Expand Up @@ -178,7 +181,7 @@ impl WalRedoProcess {
/// # Cancel-Safety
///
/// Cancellation safe.
#[instrument(skip_all, fields(tenant_id=%self.tenant_shard_id.tenant_id, shard_id=%self.tenant_shard_id.shard_slug(), pid=%self.id()))]
#[instrument(skip_all, fields(pid=%self.id()))]
pub(crate) async fn apply_wal_records(
&self,
rel: RelTag,
Expand All @@ -187,6 +190,8 @@ impl WalRedoProcess {
records: &[(Lsn, NeonWalRecord)],
wal_redo_timeout: Duration,
) -> anyhow::Result<Bytes> {
debug_assert_current_span_has_tenant_id();

let tag = protocol::BufferTag { rel, blknum };

// Serialize all the messages to send the WAL redo process first.
Expand Down
Loading