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

refactor diff calculation query to get less information #4376

Merged
merged 10 commits into from
Sep 27, 2024

Conversation

ajtmccarty
Copy link
Contributor

@ajtmccarty ajtmccarty commented Sep 18, 2024

fixes #4438
IFC-729

update diff calculation query to stop looking at EVERY changed relationship within in the timeframe on either branch. Instead, get the changed paths on the diff branch, then use to determine which paths to look at on the base branch

this required a lot of changes to the query used for calculating a diff and various python classes that enrich and add diffs together.

the basic version is that we now run the diff calculation query twice: first to get all the changes on the diff branch, then we run the query again on the base branch and pass in the node UUIDs and field names retrieved in the first query. this change in combination with the updates to the cypher query seem to have substantially improved the performance of the diff calculation. I have some more ideas for improving the performance further, but this PR is already quite large and a big step in the right direction.

will also need a follow-up PR with a data migration to delete old enriched diffs because we store much less information about the base branch now.

@github-actions github-actions bot added the group/backend Issue related to the backend (API Server, Git Agent) label Sep 18, 2024
@ajtmccarty ajtmccarty force-pushed the ajtm-09182024-query-refactor-IFC-580 branch 4 times, most recently from e12bd9b to 8945ca5 Compare September 26, 2024 00:02
@ajtmccarty ajtmccarty marked this pull request as ready for review September 26, 2024 01:22
@ajtmccarty ajtmccarty requested a review from a team September 26, 2024 01:22
Copy link
Contributor

@ogenstad ogenstad left a comment

Choose a reason for hiding this comment

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

LGTM, having said that I feel like I'd need to take a day or a few to go through the entire diff workflow from start to finish to have a good grip over how everything is actually working now. But great work!

@@ -100,7 +97,11 @@ def _add_attribute_conflicts(
for property_type in common_property_types:
base_property = base_property_map[property_type]
branch_property = branch_property_map[property_type]
if base_property.new_value != branch_property.new_value:
same_value = base_property.new_value == branch_property.new_value or (
base_property.action is DiffAction.UNCHANGED
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this if the action is DELETE and the values would be the same regardless?

@ajtmccarty ajtmccarty force-pushed the ajtm-09182024-query-refactor-IFC-580 branch from c95aec9 to 323275e Compare September 26, 2024 23:13
@ajtmccarty
Copy link
Contributor Author

I added a very simple "migration" here that just deletes all the diffs saved in the previous format. I initially tried to do something smarter and update each diff to the new format using the existing diff-related classes, but that ended up not working b/c those classes expect various global things to be set (locks, schema_manager, etc.).

@dgarros This means that any conflict selections (source or target) on the user's database will be erased and will need to be selected again. I don't think this is too big of a deal, but I can try to work out a way to maintain them if it is necessary

@ajtmccarty ajtmccarty merged commit 78b4523 into stable Sep 27, 2024
31 checks passed
@ajtmccarty ajtmccarty deleted the ajtm-09182024-query-refactor-IFC-580 branch September 27, 2024 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
group/backend Issue related to the backend (API Server, Git Agent)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants