Skip to content

Commit

Permalink
chore(walredo): avoid duplicate tenant_id and shard_slug fields (#7977)
Browse files Browse the repository at this point in the history
spotted during reviews of async walredo work in #6628
  • Loading branch information
problame committed Jun 6, 2024
1 parent 91dd990 commit 0a65333
Showing 1 changed file with 6 additions and 1 deletion.
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

1 comment on commit 0a65333

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3274 tests run: 3122 passed, 0 failed, 152 skipped (full report)


Code coverage* (full report)

  • functions: 31.5% (6601 of 20927 functions)
  • lines: 48.5% (51063 of 105267 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
0a65333 at 2024-06-06T14:57:48.811Z :recycle:

Please sign in to comment.