From 33d126ecbe9a3854d349ccf075cb9b6cdb6a4c9c Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Thu, 6 May 2021 21:57:01 +0300 Subject: [PATCH] Tidy up usage of a few constants from PostgreSQL headers. --- pageserver/src/restore_local_repo.rs | 10 ++-------- pageserver/src/restore_s3.rs | 11 +++-------- postgres_ffi/src/pg_constants.rs | 24 ++++++++++++++++++------ 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/pageserver/src/restore_local_repo.rs b/pageserver/src/restore_local_repo.rs index ce43c1efc5..143c84fd8d 100644 --- a/pageserver/src/restore_local_repo.rs +++ b/pageserver/src/restore_local_repo.rs @@ -34,12 +34,6 @@ use postgres_ffi::pg_constants; use postgres_ffi::xlog_utils::*; use zenith_utils::lsn::Lsn; -// From pg_tablespace_d.h -// -// FIXME: we'll probably need these elsewhere too, move to some common location -const DEFAULTTABLESPACE_OID: u32 = 1663; -const GLOBALTABLESPACE_OID: u32 = 1664; - // // Load it all into the page cache. // @@ -130,7 +124,7 @@ fn restore_snapshot( _ => restore_relfile( timeline, snapshot, - GLOBALTABLESPACE_OID, + pg_constants::GLOBALTABLESPACE_OID, 0, &direntry.path(), )?, @@ -157,7 +151,7 @@ fn restore_snapshot( _ => restore_relfile( timeline, snapshot, - DEFAULTTABLESPACE_OID, + pg_constants::DEFAULTTABLESPACE_OID, dboid, &direntry.path(), )?, diff --git a/pageserver/src/restore_s3.rs b/pageserver/src/restore_s3.rs index 2a4351e3c9..e3c4b2fffc 100644 --- a/pageserver/src/restore_s3.rs +++ b/pageserver/src/restore_s3.rs @@ -23,6 +23,7 @@ use tokio::runtime; use futures::future; use crate::{page_cache, PageServerConf}; +use postgres_ffi::pg_constants; struct Storage { region: Region, @@ -127,12 +128,6 @@ async fn restore_chunk(conf: &PageServerConf) -> Result<(), S3Error> { Ok(()) } -// From pg_tablespace_d.h -// -// FIXME: we'll probably need these elsewhere too, move to some common location -const DEFAULTTABLESPACE_OID: u32 = 1663; -const GLOBALTABLESPACE_OID: u32 = 1664; - #[derive(Debug)] struct FilePathError { msg: String, @@ -237,7 +232,7 @@ fn parse_rel_file_path(path: &str) -> Result Result