Skip to content

Always delete old point versions when applying point operation - #5962

Merged
timvisee merged 13 commits into
devfrom
apply-point-delete-old-versions
Feb 11, 2025
Merged

timvisee merged 13 commits into
devfrom
apply-point-delete-old-versions

Conversation

@timvisee

@timvisee timvisee commented Feb 10, 2025 •

Copy link
Copy Markdown
Member

Continuation after #5956 as suggested by #5956 (comment).

An initial implementation for always deleting older point versions when an operation is applied. It cleans up duplicate points and prevents users retrieving old point data.

This is a first iteration, and I'm not super happy with the implementation yet. However, it is good enough to be included in a patch release.

This PR has the following properties:

  • does not delete other point instances having the same version
  • deletes old points with their existing version

In a future PR I'd like to change these properties to:

  • do delete other point instances having the same version, keeping just one instance
  • delete old point versions with the operation version (to also bump the segment version)

However, implementing these extra changes appears to be entirely non trivial. Naively implementing it makes many weird problem appear, such as losing points if we have multiple proxies using the same write segment.

I've added a test and adjusted an existing test to assert correct behavior of this change.

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 force-pushed the apply-point-delete-old-versions branch from 4a561d4 to 60e29e3 Compare February 10, 2025 16:50
Comment on lines +591 to +600
// Delete old points first
for (segment_id, points) in to_delete {
let segment = self.get(segment_id).unwrap();
let segment_arc = segment.get();
let mut write_segment = segment_arc.write();

for point_id in points {
point_delete_operation(point_id, &mut write_segment)?;
}
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Here we now delete older versions before applying operations to the newest point version.

/// selected to be updated, all older versions are marked to be deleted.
///
/// Points that are already soft deleted are not included.
fn find_points_to_update_and_delete(

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Function is adjusted to now collect both the latest point versions, and all older point versions.

@timvisee
timvisee marked this pull request as ready for review February 10, 2025 17:07
@timvisee
timvisee requested review from ffuugoo and generall February 10, 2025 17:08
@timvisee timvisee changed the title WIP: Always delete old point versions when applying point operation Always delete old point versions when applying point operation Feb 10, 2025
@timvisee
timvisee requested a review from agourlay February 10, 2025 17:08
@timvisee
timvisee force-pushed the apply-point-delete-old-versions branch from 4d1c56c to ebed617 Compare February 11, 2025 12:59
@timvisee
timvisee force-pushed the apply-point-delete-old-versions branch from ebed617 to fcf1058 Compare February 11, 2025 13:01
@timvisee
timvisee merged commit b42746d into dev Feb 11, 2025
@timvisee
timvisee deleted the apply-point-delete-old-versions branch February 11, 2025 13:32
timvisee added a commit that referenced this pull request Feb 11, 2025
* Always delete old point versions when applying point operation

* Add helper struct for updates/deletes, make selection more readable

* Cleanup

* Add debug assertion

* If having multiple point versions, delete first, then apply operations

* Deleted old points with their existing point version, extend test

* Don't delete other points with the same version for now, add test case

* Remove helper struct since updates and deletes are separated again

* Smarter capacity estimate

* apply change to all points with latest version

* Use small vec extra allocations

* Eliminate delete closure, delete internally and pass hardware counter

* Update comment

Co-authored-by: Andrey Vasnetsov <[email protected]>

---------

Co-authored-by: Andrey Vasnetsov <[email protected]>
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