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

feat: auto-migrate old index metadata #3428

Merged
merged 2 commits into from
Feb 1, 2025

Conversation

wjones127
Copy link
Contributor

@wjones127 wjones127 commented Jan 31, 2025

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.

@github-actions github-actions bot added the enhancement New feature or request label Jan 31, 2025
@wjones127 wjones127 marked this pull request as ready for review January 31, 2025 20:23
@@ -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();
Copy link
Contributor

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?

Comment on lines 74 to 80
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")
}
Copy link
Contributor

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"
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@wjones127 wjones127 force-pushed the feat/auto-migration branch from e208df6 to 320d101 Compare January 31, 2025 23:50
@wjones127 wjones127 merged commit c73d717 into lancedb:main Feb 1, 2025
26 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants