-
Couldn't load subscription status.
- Fork 4
fix: prevent infinite loop on prune lineage #481
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
base: main
Are you sure you want to change the base?
Conversation
| EndTime time.Time | ||
| } | ||
|
|
||
| func (r *LineageResolver) pruneLineage(lineage *scheduler.JobLineageSummary, maxUpstreamsPerLevel, depth int) *scheduler.JobLineageSummary { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible to cover this scenario in the test case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible to cover this scenario in a test case
| func (r *LineageResolver) pruneLineage(lineage *scheduler.JobLineageSummary, maxUpstreamsPerLevel, depth int) *scheduler.JobLineageSummary { | ||
| // base case: stop if max depth reached or number of upstreams is already within limit | ||
| if depth > MaxLineageDepth || len(lineage.Upstreams) <= maxUpstreamsPerLevel { | ||
| if depth > MaxLineageDepth { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we avoid to use function recursive? use stack data type instead
function recursive uses stack frame allocation, which is limited, and can lead to stack overflow. meanwhile using stack data type is more safe, as it uses heap memory
| // base case: stop if max depth reached or number of upstreams is already within limit | ||
| if depth > MaxLineageDepth || len(lineage.Upstreams) <= maxUpstreamsPerLevel { | ||
| if depth > MaxLineageDepth { | ||
| return &scheduler.JobLineageSummary{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
base question: why we need to prune the lineage? if cyclic is found, it's fine I guess as long as we don't revisit the job again
No description provided.