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

Ordering of patches with cycles during upload #2524

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

aditya-07
Copy link
Collaborator

IMPORTANT: All PRs must be linked to an issue (except for extremely trivial and straightforward changes).

Fixes #2500

Description

  1. Find subgraphs (weakly connected) of Resources with cycles in them .
  2. Pack the subgraphs in Bundles such that a single subgraph is not split between two Bundles (as it may cause server error).
  3. Order the remaining resources and add them to the Bundle (in remaining space of or new Bundles) .

Alternative(s) considered
Have you considered any alternatives? And if so, why have you chosen the approach in this PR?

Type
Choose one: Bug fix

Screenshots (if applicable)

Checklist

  • I have read and acknowledged the Code of conduct.
  • I have read the Contributing page.
  • I have signed the Google Individual CLA, or I am covered by my company's Corporate CLA.
  • I have discussed my proposed solution with code owners in the linked issue(s) and we have agreed upon the general approach.
  • I have run ./gradlew spotlessApply and ./gradlew spotlessCheck to check my code follows the style guide of this project.
  • I have run ./gradlew check and ./gradlew connectedCheck to test my changes locally.
  • I have built and run the demo app(s) to verify my change fixes the issue and/or does not break the demo app(s).

@aditya-07 aditya-07 requested review from santosh-pingle and a team as code owners April 23, 2024 06:56
@aditya-07 aditya-07 changed the title Ordering of patches with cyclic during upload Ordering of patches with cycles during upload Apr 23, 2024
@MJ1998
Copy link
Collaborator

MJ1998 commented May 1, 2024

Is this ready for review ?

@vorburger vorburger removed the request for review from a team May 16, 2024 15:05
Copy link
Collaborator

@MJ1998 MJ1998 left a comment

Choose a reason for hiding this comment

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

What if we use Strongly Connected Components (SCC) ?

  1. Identify the SCCs
  2. Consolidate all nodes in each SCC into a supernode.
  3. Then apply the same topological sorting

So for following graph:-
1 -> 2, 3
2 -> 4, 5
4 -> 1
5 -> 6
7 -> 8, 9
8 -> 7

SCC = [{1,2,4}, {7, 8}]
We can have the topological sort as - [{3}, {6}, {5}, {1, 2, 4}, {9}, {7, 8}]

Current solution is also right but the above solution has more improvements:-

  1. Time complexity is one-fourth (from first look).
  2. In current approach the weakly-connected-components will go in one bundle if there is a cycle. Whereas in the above approach only the SCC will go in one bundle -> Reduces the size of the bundle a lot.

@MJ1998
Copy link
Collaborator

MJ1998 commented May 17, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: PR under Review
Development

Successfully merging this pull request may close these issues.

Sync upload local changes reordering patch issue
2 participants