-
Notifications
You must be signed in to change notification settings - Fork 36
load dumps from CLI #281
load dumps from CLI #281
Conversation
9cb0a08
to
42b8bc3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we prevent loading from a dump in case there is any content on the current DB?
sqld/src/lib.rs
Outdated
// load dump is necessary | ||
let dump_loader = DumpLoader::new(config.db_path.clone(), hook.clone()).await?; | ||
if let Some(ref path) = config.load_dump_path { | ||
dump_loader.load_dump(path.into()).await?; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why only on start_primary
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a replica load a dump, then there is no guarantee it's state is consistent with the primary. Hence, loading on a replica is forbidden
I want to potentially reuse that code for HTTP later on. There is a difference between loading a dump and loading from a dump. You could, in theory, load a dump to an already running database, and if there are no conflicts this is ok. when loading from a dump, you need to start from a fresh state. From experience, a destructive dump load is not a good solution. When loading from a dump, I can add a check that refuses to load it if there is something there already though |
a8b5e54
to
6b1c76d
Compare
@athoscouto I have changed the CLI param name, and added an error when trying to load from a dump and a database already exists. |
6b1c76d
to
fa266a5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
bors merge |
Build succeeded:
|
This PR enables loading a dump file from the CLI.