mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-16 01:42:55 +00:00
resolve conflicts
This commit is contained in:
@@ -1,10 +1,26 @@
|
||||
use anyhow;
|
||||
use camino::Utf8PathBuf;
|
||||
use clap::Parser;
|
||||
use pageserver::{pg_import, virtual_file::{self, api::IoEngineKind}};
|
||||
use utils::logging::{self, LogFormat, TracingErrorLayerEnablement};
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
println!("Hey!");
|
||||
//project_git_version!(GIT_VERSION);
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(
|
||||
//version = GIT_VERSION,
|
||||
about = "Utility to import a Postgres data directory directly into image layers",
|
||||
//long_about = "..."
|
||||
)]
|
||||
struct CliOpts {
|
||||
/// Input Postgres data directory
|
||||
pgdata: Utf8PathBuf,
|
||||
|
||||
/// Path to local dir where the layer files will be stored
|
||||
dest_path: Utf8PathBuf,
|
||||
}
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
logging::init(
|
||||
LogFormat::Plain,
|
||||
TracingErrorLayerEnablement::EnableWithRustLogFilter,
|
||||
@@ -21,7 +37,15 @@ fn main() -> anyhow::Result<()> {
|
||||
.enable_all()
|
||||
.build()?;
|
||||
|
||||
rt.block_on(pg_import::do_import())?;
|
||||
|
||||
let cli = CliOpts::parse();
|
||||
|
||||
rt.block_on(async_main(cli))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn async_main(cli: CliOpts) -> anyhow::Result<()> {
|
||||
let mut import = pg_import::PgImportEnv::init().await?;
|
||||
import.import_datadir(&cli.pgdata, &cli.dest_path).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -18,16 +18,6 @@ use tokio::io::AsyncReadExt;
|
||||
|
||||
use pageserver_api::key::Key;
|
||||
|
||||
|
||||
pub async fn do_import() -> anyhow::Result<()> {
|
||||
|
||||
let mut import = PgImportEnv::init().await?;
|
||||
|
||||
import.import_datadir(&Utf8PathBuf::from("pg_in"), &Utf8PathBuf::from("pg_out")).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub struct PgImportEnv {
|
||||
ctx: RequestContext,
|
||||
conf: &'static PageServerConf,
|
||||
@@ -37,7 +27,7 @@ pub struct PgImportEnv {
|
||||
|
||||
impl PgImportEnv {
|
||||
|
||||
async fn init() -> anyhow::Result<PgImportEnv> {
|
||||
pub async fn init() -> anyhow::Result<PgImportEnv> {
|
||||
let ctx: RequestContext = RequestContext::new(TaskKind::DebugTool, DownloadBehavior::Error);
|
||||
let config = toml_edit::Document::new();
|
||||
let conf = PageServerConf::parse_and_validate(
|
||||
@@ -63,7 +53,7 @@ impl PgImportEnv {
|
||||
})
|
||||
}
|
||||
|
||||
async fn import_datadir(&mut self, pgdata_path: &Utf8Path, _tenant_path: &Utf8Path) -> anyhow::Result<()> {
|
||||
pub async fn import_datadir(&mut self, pgdata_path: &Utf8Path, _tenant_path: &Utf8Path) -> anyhow::Result<()> {
|
||||
|
||||
let pgdata_lsn = import_datadir::get_lsn_from_controlfile(&pgdata_path)?.align();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user