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

[ENH] simplify logic for when to persist index changes #2539

Merged
merged 1 commit into from
Jul 19, 2024

Conversation

codetheweb
Copy link
Contributor

@codetheweb codetheweb commented Jul 18, 2024

@HammadB and I discussed this. Makes it much easier to model the WAL behavior in tests while also simplifying the logic.

Copy link

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)

# Fields were added after the initial implementation
self.total_elements_updated = 0
self.total_invalid_operations = 0
self.__dict__.update(state)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tested with pickle and it seems to be fine if you remove a field from a class def

@codetheweb codetheweb marked this pull request as ready for review July 18, 2024 22:44
@@ -132,9 +119,6 @@ def __init__(self, system: System, segment: Segment):
else:
self._persist_data = PersistentData(
self._dimensionality,
self._total_elements_added,
Copy link
Collaborator

Choose a reason for hiding this comment

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

confirming this was not used anywhere else

Copy link
Contributor Author

Choose a reason for hiding this comment

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

confirmed

Copy link
Contributor Author

@codetheweb codetheweb Jul 19, 2024

Choose a reason for hiding this comment

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

turns out this was the issue, I should have fully reasoned through it :/
self._total_elements_added isn't used in local_persistent_hnsw, but it is used in local_hnsw (the super class) and there's some non-obvious contracts between the two

@codetheweb codetheweb merged commit e93bacf into main Jul 19, 2024
66 checks passed
@codetheweb codetheweb deleted the feat-simplify-persist-trigger branch July 19, 2024 16:30
codetheweb added a commit that referenced this pull request Jul 19, 2024
codetheweb added a commit that referenced this pull request Jul 19, 2024
codetheweb added a commit that referenced this pull request Jul 22, 2024
codetheweb added a commit that referenced this pull request Jul 22, 2024
codetheweb added a commit that referenced this pull request Jul 23, 2024
codetheweb added a commit that referenced this pull request Jul 23, 2024
codetheweb added a commit that referenced this pull request Jul 24, 2024
codetheweb added a commit that referenced this pull request Jul 24, 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.

None yet

2 participants