-
Notifications
You must be signed in to change notification settings - Fork 254
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
feat: auto-migrate old index metadata #3428
Conversation
rust/lance/src/index.rs
Outdated
@@ -68,6 +68,24 @@ use self::append::merge_indices; | |||
use self::scalar::build_scalar_index; | |||
use self::vector::{build_vector_index, VectorIndexParams, LANCE_VECTOR_INDEX}; | |||
|
|||
// Whether to auto-migrate a dataset when we encounter corruption. | |||
fn auto_migrate_corruption() -> bool { | |||
static MAX_CONN_RESET_RETRIES: OnceLock<bool> = OnceLock::new(); |
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.
Maybe change the variable name?
rust/lance/src/index.rs
Outdated
fn str_is_truthy(val: &str) -> bool { | ||
val.eq_ignore_ascii_case("1") | ||
| val.eq_ignore_ascii_case("true") | ||
| val.eq_ignore_ascii_case("on") | ||
| val.eq_ignore_ascii_case("yes") | ||
| val.eq_ignore_ascii_case("y") | ||
} |
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.
Put in a util crate somewhere?
let mut ds = ds.clone(); | ||
log::warn!( | ||
"Detecting out-dated fragment metadata, migrating dataset. \ | ||
To disable migration, set LANCE_AUTO_MIGRATION=false" |
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.
It's probably fine but this warning is a little too late 😆 . I guess users can always restore.
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.
Well this is for if they hit it in a production system. Hopefully they catch it on the first table it hits.
e208df6
to
320d101
Compare
Follow up to #3377. That PR made
index_statistics()
error by default. This ended up being a footgun for some users who rely heavily on that method. So instead of forcing the user to do the migration themself, we do it for them. It can be disabled using an environment variable.