Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storage: Add data recovery system #336

Merged
merged 14 commits into from
Mar 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All changes in this project will be noted in this file.

## Version 0.8.1

### Additions

- Added support for manual repair with the `skyd repair` command

### Fixes

- Fixed migration from v1 SE (released with v0.8.0-beta) to v2 SE (released in v0.8.0)
Expand Down
84 changes: 42 additions & 42 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ libsky = { path = "../libsky" }
sky_macros = { path = "../sky-macros" }
rcrypt = "0.4.0"
# external deps
bytes = "1.5.0"
bytes = "1.6.0"
env_logger = "0.11.3"
log = "0.4.21"
openssl = { version = "0.10.64", features = ["vendored"] }
Expand All @@ -25,9 +25,9 @@ parking_lot = "0.12.1"
serde = { version = "1.0.197", features = ["derive"] }
tokio = { version = "1.36.0", features = ["full"] }
tokio-openssl = "0.6.4"
uuid = { version = "1.7.0", features = ["v4", "fast-rng", "macro-diagnostics"] }
uuid = { version = "1.8.0", features = ["v4", "fast-rng", "macro-diagnostics"] }
crc = "3.0.1"
serde_yaml = "0.9.32"
serde_yaml = "0.9.33"
chrono = "0.4.35"

[target.'cfg(all(not(target_env = "msvc"), not(miri)))'.dependencies]
Expand Down
5 changes: 5 additions & 0 deletions server/help_text/help
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ Usage: skyd [OPTION]...

skyd is the Skytable database server daemon and can be used to serve database requests.

Commands:
repair Check and repair any detected database storage errors

Flags:
-h, --help Display this help menu and exit.
-v, --version Display the version number and exit.
Expand All @@ -36,5 +39,7 @@ Notes:
- If no `--mode` is provided, we default to `dev`
- You must provide `--auth-root-password` to set the default root password
- To use TLS, you must provide both `--tlscert` and `--tlskey`
- When you run `repair`, your previous data is backed up in the `backups/` folder.
Restore if needed.

For further assistance, refer to the official documentation here: https://docs.skytable.org
16 changes: 15 additions & 1 deletion server/src/engine/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,7 @@ pub enum CLIConfigParseReturn<T> {
Version,
/// We yielded a config
YieldedConfig(T),
Repair,
}

impl<T> CLIConfigParseReturn<T> {
Expand All @@ -670,10 +671,21 @@ impl<T> CLIConfigParseReturn<T> {
pub fn parse_cli_args<'a, T: 'a + AsRef<str>>(
src: impl Iterator<Item = T>,
) -> RuntimeResult<CLIConfigParseReturn<ParsedRawArgs>> {
let mut args_iter = src.into_iter().skip(1);
let mut args_iter = src.into_iter().skip(1).peekable();
let mut cli_args: ParsedRawArgs = HashMap::new();
while let Some(arg) = args_iter.next() {
let arg = arg.as_ref();
if arg == "repair" {
if args_iter.peek().is_none() {
return Ok(CLIConfigParseReturn::Repair);
} else {
return Err(ConfigError::with_src(
ConfigSource::Cli,
ConfigErrorKind::ErrorString("to use `repair`, just run `skyd repair`".into()),
)
.into());
}
}
if arg == "--help" || arg == "-h" {
return Ok(CLIConfigParseReturn::Help);
}
Expand Down Expand Up @@ -978,6 +990,7 @@ pub enum ConfigReturn {
HelpMessage(String),
/// A configuration that we have fully validated was provided
Config(Configuration),
Repair,
}

impl ConfigReturn {
Expand Down Expand Up @@ -1105,6 +1118,7 @@ pub fn check_configuration() -> RuntimeResult<ConfigReturn> {
libsky::VERSION
)));
}
CLIConfigParseReturn::Repair => return Ok(ConfigReturn::Repair),
CLIConfigParseReturn::YieldedConfig(cfg) => Some(cfg),
};
match cli_args {
Expand Down
Loading
Loading