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

Update collection config, when applying Raft snapshot #5367

Merged
merged 7 commits into from
Nov 6, 2024

Conversation

ffuugoo
Copy link
Contributor

@ffuugoo ffuugoo commented Nov 5, 2024

Currently, when applying Raft snapshot, we only update collection optimizer config from the snapshot.

This PR extends this, so that:

  • collection config is updated in full, not just optimizer config
  • collection is recreated, if collection config in Raft snapshot is incompatible with existing collection

Additionally, I've fixed a (potential? I've not yet tested this yet, but I'm 98% sure it's real) deadlock.

All Submissions:

  • Contributions should target the dev branch. Did you create your branch from dev?
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests?
  2. Have you formatted your code locally using cargo +nightly fmt --all command prior to submission?
  3. Have you checked your code using cargo clippy --all --all-features command?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@ffuugoo ffuugoo requested review from timvisee and generall November 5, 2024 09:51
Comment on lines +134 to +152
let this_sparse_vectors: HashSet<_> = if let Some(sparse_vectors) = &self.sparse_vectors {
sparse_vectors.keys().collect()
} else {
HashSet::new()
};

let other_sparse_vectors: HashSet<_> = if let Some(sparse_vectors) = sparse_vectors {
sparse_vectors.keys().collect()
} else {
HashSet::new()
};

if this_sparse_vectors != other_sparse_vectors {
return Err(CollectionError::bad_input(format!(
"sparse vectors are incompatible: \
origin sparse vectors: {this_sparse_vectors:?}, \
while other sparse vectors: {other_sparse_vectors:?}",
)));
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooops. Missed sparse vectors check. Thanks! 😬

@ffuugoo ffuugoo mentioned this pull request Nov 6, 2024
9 tasks
@ffuugoo ffuugoo merged commit f142910 into dev Nov 6, 2024
17 checks passed
@ffuugoo ffuugoo deleted the raft-snapshot-update-collection-config branch November 6, 2024 12:49
timvisee pushed a commit that referenced this pull request Nov 8, 2024
Co-authored-by: generall <andrey@vasnetsov.com>
@timvisee timvisee mentioned this pull request Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants