Skip to content

Conversation

timvisee
Copy link
Member

@timvisee timvisee commented Aug 20, 2025

The proxy_all_segments_and_apply/proxy_all_segments function did not preserve the existing segment ID mappings. It's important, because ongoing optimizations depend on this mapping to remain the same.

Fixes this debug assertion:

panicked at lib/collection/src/collection_manager/optimizers/segment_optimizer.rs:711:9: assertion `left == right` failed: swapped different number of proxies on unwrap, missing or incorrect segment IDs?
   left: 2
  right: 3

Contains some refactoring which makes the diff a bit harder to read. I've marked the critical part below.

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?

@timvisee timvisee requested a review from agourlay August 20, 2025 12:53
Comment on lines +1142 to +1143
// We must keep existing segment IDs because ongoing optimizations might depend on the mapping being the same
write_segments.replace(segment_id, proxy)?;
Copy link
Member Author

@timvisee timvisee Aug 20, 2025

Choose a reason for hiding this comment

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

Critical part.

This introduced new segment IDs before, now it preserves the existing mapping.

coderabbitai[bot]

This comment was marked as resolved.

@qdrant qdrant deleted a comment from coderabbitai bot Aug 20, 2025
@agourlay agourlay merged commit 1d97e9a into dev Aug 20, 2025
16 checks passed
@agourlay agourlay deleted the segments-proxy-all-keep-mapping branch August 20, 2025 13:18
timvisee added a commit that referenced this pull request Aug 26, 2025
* When swapping existing segment, remove first to allow segment ID reuse

* Share original segment ID with proxies, keeps original mapping

* Add replace function, that directly replaces existing segment
@timvisee timvisee mentioned this pull request Aug 26, 2025
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.

2 participants