restore_data

Function restore_data 

Source
pub async fn restore_data(target_url: &str, input_path: &str) -> Result<()>
Expand description

Restore data using pg_restore with parallel jobs

Uses PostgreSQL directory format restore with:

  • Parallel restore for faster performance
  • Automatic decompression of compressed dump files
  • Optimized for directory format dumps created by dump_data()

The number of parallel jobs is automatically determined based on available CPU cores.

§Note on Retry Behavior

Unlike schema restoration, data restoration does NOT use retry logic. This is intentional because pg_restore with –data-only is NOT idempotent - if it partially succeeds and then fails, retrying would cause duplicate key constraint violations.

If data restoration fails due to connection issues, the user should re-run the command with –drop-existing to ensure a clean slate.