Skip to content

Conversation

@codetheweb
Copy link
Contributor

@codetheweb codetheweb commented May 6, 2025

Description of changes

Adds an operator to compute which versions to garbage collect from a version graph. Intended to replace rust/garbage_collector/src/operators/compute_versions_to_delete.rs.

Test plan

How are these changes tested?

  • Tests pass locally with pytest for python, yarn test for js, cargo test for rust

Added new tests for operator.

Documentation Changes

Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the docs section?

n/a

@github-actions
Copy link

github-actions bot commented May 6, 2025

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

@codetheweb codetheweb force-pushed the feat-gc-construct-version-graph branch from 3185a2c to 2d8c1b7 Compare May 6, 2025 20:58
@codetheweb codetheweb force-pushed the feat-gc-forked-compute-versions-to-delete branch from fcefe15 to 042312d Compare May 6, 2025 20:59
@codetheweb codetheweb marked this pull request as ready for review May 6, 2025 21:01
@codetheweb codetheweb requested a review from Sicheng-Pan May 6, 2025 21:01
@codetheweb codetheweb force-pushed the feat-gc-forked-compute-versions-to-delete branch from 042312d to 8e4042e Compare May 6, 2025 21:58
Comment on lines 90 to 98
if *version == 0 {
continue;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

this implies we never delete the first version of the new collection after fork, and thus we can never gc the data of the source collection at the forking version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

correct
I did this to preserve the existing behavior of GC but I'm fine changing it to allow deleting the first version

@codetheweb codetheweb force-pushed the feat-gc-construct-version-graph branch from 2d8c1b7 to fafe998 Compare May 13, 2025 17:35
@codetheweb codetheweb force-pushed the feat-gc-forked-compute-versions-to-delete branch from 8e4042e to 34ed231 Compare May 13, 2025 17:35
@propel-code-bot
Copy link
Contributor

propel-code-bot bot commented May 13, 2025

Add Operator for Computing Versions to Delete from Version Graph

This PR introduces a new operator, ComputeVersionsToDeleteOperator, designed to determine which collection versions can be garbage collected by analyzing a version graph. It encapsulates logic for selecting deletable versions based on configurable parameters like cutoff time and a minimum number of versions to retain, and includes comprehensive tests for different graph scenarios (linear, forked trees) to validate correct behavior.

Key Changes:
• Introduced compute_versions_to_delete_from_graph.rs implementing the ComputeVersionsToDeleteOperator and related data structures.
• Logic to traverse the version graph, evaluating and marking alive collection versions for deletion or retention based on cutoff_time and min_versions_to_keep.
• Ensured that version 0 is always retained, preserving current GC behavior after forks.
• Added error handling with a custom error enum (ComputeVersionsToDeleteError).
• Implemented and registered the new operator module in mod.rs.
• Included thorough unit tests covering linear and forked version graph topologies.

Affected Areas:
• rust/garbage_collector/src/operators/compute_versions_to_delete_from_graph.rs
• rust/garbage_collector/src/operators/mod.rs

This summary was automatically generated by @propel-code-bot

@codetheweb codetheweb force-pushed the feat-gc-construct-version-graph branch from fafe998 to ef973c9 Compare May 15, 2025 16:52
@codetheweb codetheweb force-pushed the feat-gc-forked-compute-versions-to-delete branch from 34ed231 to 9ca2cd5 Compare May 15, 2025 16:52
@codetheweb codetheweb force-pushed the feat-gc-construct-version-graph branch from ef973c9 to bdc98f5 Compare May 15, 2025 20:11
@codetheweb codetheweb force-pushed the feat-gc-forked-compute-versions-to-delete branch from 9ca2cd5 to 0725564 Compare May 15, 2025 20:11
@codetheweb codetheweb force-pushed the feat-gc-construct-version-graph branch from bdc98f5 to 8137f4d Compare May 15, 2025 22:38
@codetheweb codetheweb force-pushed the feat-gc-forked-compute-versions-to-delete branch from 0725564 to dd8eba1 Compare May 15, 2025 22:38
@codetheweb codetheweb force-pushed the feat-gc-construct-version-graph branch from 8137f4d to 14eb5e7 Compare May 15, 2025 22:43
@codetheweb codetheweb force-pushed the feat-gc-forked-compute-versions-to-delete branch from dd8eba1 to d7546c4 Compare May 15, 2025 22:43
@codetheweb codetheweb force-pushed the feat-gc-construct-version-graph branch from 14eb5e7 to 721349a Compare May 15, 2025 23:26
@codetheweb codetheweb force-pushed the feat-gc-forked-compute-versions-to-delete branch from d7546c4 to 8242dc4 Compare May 15, 2025 23:27
@codetheweb codetheweb force-pushed the feat-gc-construct-version-graph branch from 721349a to 8f8a50b Compare May 15, 2025 23:34
@codetheweb codetheweb force-pushed the feat-gc-forked-compute-versions-to-delete branch from 8242dc4 to 5f592dc Compare May 15, 2025 23:34
@codetheweb codetheweb force-pushed the feat-gc-forked-compute-versions-to-delete branch from af861f5 to 8fe5f2f Compare May 19, 2025 23:46
@codetheweb codetheweb force-pushed the feat-gc-construct-version-graph branch from cb3e44a to 1242760 Compare May 20, 2025 18:02
@codetheweb codetheweb force-pushed the feat-gc-forked-compute-versions-to-delete branch from 8fe5f2f to afda731 Compare May 20, 2025 18:02
@codetheweb codetheweb force-pushed the feat-gc-construct-version-graph branch from 1242760 to 1a374a3 Compare May 20, 2025 18:42
@codetheweb codetheweb force-pushed the feat-gc-forked-compute-versions-to-delete branch from afda731 to 1ea19ad Compare May 20, 2025 18:43
@codetheweb codetheweb force-pushed the feat-gc-construct-version-graph branch from 1a374a3 to f4a6ed4 Compare May 20, 2025 19:42
@codetheweb codetheweb force-pushed the feat-gc-forked-compute-versions-to-delete branch from 1ea19ad to e949621 Compare May 20, 2025 19:42
@codetheweb codetheweb force-pushed the feat-gc-construct-version-graph branch from f4a6ed4 to cdff65d Compare May 21, 2025 16:45
@codetheweb codetheweb force-pushed the feat-gc-forked-compute-versions-to-delete branch from e949621 to 91a3c81 Compare May 21, 2025 16:45
@codetheweb codetheweb force-pushed the feat-gc-construct-version-graph branch from cdff65d to 3ec6e51 Compare May 22, 2025 23:23
@codetheweb codetheweb force-pushed the feat-gc-forked-compute-versions-to-delete branch from 91a3c81 to f71445b Compare May 22, 2025 23:24
@codetheweb codetheweb force-pushed the feat-gc-construct-version-graph branch 2 times, most recently from 797d3f7 to 7591c20 Compare May 22, 2025 23:58
@codetheweb codetheweb force-pushed the feat-gc-forked-compute-versions-to-delete branch from f71445b to c2e5444 Compare May 22, 2025 23:58
@codetheweb codetheweb changed the base branch from feat-gc-construct-version-graph to graphite-base/4464 May 23, 2025 00:46
@codetheweb codetheweb force-pushed the graphite-base/4464 branch from 7591c20 to 38742ab Compare May 23, 2025 00:46
@codetheweb codetheweb force-pushed the feat-gc-forked-compute-versions-to-delete branch from c2e5444 to 56724a9 Compare May 23, 2025 00:46
@graphite-app graphite-app bot changed the base branch from graphite-base/4464 to main May 23, 2025 00:46
@codetheweb codetheweb force-pushed the feat-gc-forked-compute-versions-to-delete branch from 56724a9 to 0197f05 Compare May 23, 2025 00:47
@codetheweb codetheweb merged commit 8fd33ad into main May 23, 2025
72 checks passed
Copy link
Contributor Author

Merge activity

Inventrohyder pushed a commit to Inventrohyder/chroma that referenced this pull request Aug 5, 2025
…on graph (chroma-core#4464)

## Description of changes

Adds an operator to compute which versions to garbage collect from a version graph. Intended to replace `rust/garbage_collector/src/operators/compute_versions_to_delete.rs`.

## Test plan

_How are these changes tested?_

- [x] Tests pass locally with `pytest` for python, `yarn test` for js, `cargo test` for rust

Added new tests for operator.

## Documentation Changes

_Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the [docs section](https://github.com/chroma-core/chroma/tree/main/docs/docs.trychroma.com)?_

n/a
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