Skip to content

Instantly share code, notes, and snippets.

@hlinnaka
Created April 30, 2021 16:01
Show Gist options
  • Save hlinnaka/34be0d49f4ee1cb1a8b8482e72ee2009 to your computer and use it in GitHub Desktop.
Save hlinnaka/34be0d49f4ee1cb1a8b8482e72ee2009 to your computer and use it in GitHub Desktop.
No Arc needed
diff --git a/pageserver/src/restore_local_repo.rs b/pageserver/src/restore_local_repo.rs
index 24356ee1..949f334e 100644
--- a/pageserver/src/restore_local_repo.rs
+++ b/pageserver/src/restore_local_repo.rs
@@ -26,7 +26,6 @@ use std::path::{Path, PathBuf};
use anyhow::Result;
use bytes::Bytes;
-use crate::page_cache;
use crate::page_cache::BufferTag;
use crate::page_cache::PageCache;
use crate::page_cache::RelTag;
@@ -35,7 +34,6 @@ use crate::walreceiver::put_decoded_record_to_pcache;
use crate::PageServerConf;
use crate::ZTimelineId;
use postgres_ffi::xlog_utils::*;
-use std::sync::Arc;
use zenith_utils::lsn::Lsn;
// From pg_tablespace_d.h
@@ -49,7 +47,7 @@ const GLOBALTABLESPACE_OID: u32 = 1664;
//
pub fn restore_timeline(
conf: &PageServerConf,
- pcache: &Arc<PageCache>,
+ pcache: &PageCache,
timeline: ZTimelineId,
) -> Result<()> {
let timelinepath = PathBuf::from("timelines").join(timeline.to_string());
@@ -111,7 +109,7 @@ pub fn find_latest_snapshot(_conf: &PageServerConf, timeline: ZTimelineId) -> Re
fn restore_snapshot(
conf: &PageServerConf,
- pcache: &Arc<PageCache>,
+ pcache: &PageCache,
timeline: ZTimelineId,
snapshot: &str,
) -> Result<()> {
@@ -180,7 +178,7 @@ fn restore_snapshot(
fn restore_relfile(
_conf: &PageServerConf,
- pcache: &Arc<PageCache>,
+ pcache: &PageCache,
_timeline: ZTimelineId,
snapshot: &str,
spcoid: u32,
@@ -247,7 +245,7 @@ fn restore_relfile(
// into the page cache.
fn restore_wal(
_conf: &PageServerConf,
- pcache: &Arc<PageCache>,
+ pcache: &PageCache,
timeline: ZTimelineId,
startpoint: Lsn,
) -> Result<()> {
diff --git a/pageserver/src/walreceiver.rs b/pageserver/src/walreceiver.rs
index 9246c1b6..9a231bb5 100644
--- a/pageserver/src/walreceiver.rs
+++ b/pageserver/src/walreceiver.rs
@@ -25,7 +25,7 @@ use std::fs::{File, OpenOptions};
use std::io::{Seek, SeekFrom, Write};
use std::path::PathBuf;
use std::str::FromStr;
-use std::sync::{Arc, Mutex};
+use std::sync::Mutex;
use std::thread;
use std::thread::sleep;
use std::time::Duration;
@@ -130,7 +130,7 @@ fn thread_main(conf: &PageServerConf, timelineid: ZTimelineId) {
// Put the WAL record to the page cache. We make a separate copy of
// it for every block it modifies.
pub fn put_decoded_record_to_pcache(
- pcache: &Arc<PageCache>,
+ pcache: &PageCache,
decoded: DecodedWALRecord,
recdata: Bytes,
lsn: Lsn,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment