Repository navigation
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pr-type/bug-fix,pr-type/feature-development, etc.Summary
Save subtask state after a successful full clone so blueprints without
timeAftercan run incrementally on subsequent executions. Adds a regression test for state persistence after a full clone.Does this close any open issues?
Does not close an open issue. But we've observed that:
What happened
For blueprints whose
timeAfterisnull(“collect all data”),gitextractornever switches to incremental mode. Every scheduled pipeline performs a fullgit clone --bareand recomputes commit stats for the entire history of every branch.On one of our repositories, the
gitextractortask takes about an hour on every daily run. Processing a day’s new commits should take seconds; the GitHub GraphQL collectors in the same pipeline finish in about a minute.Root cause
Since a26791b (#7941 / #7944, “double clone against AzDo”),
GitcliCloner.CloneRepo()setsg.success = trueonly in thesince != nil(shallow/double-clone) branch.CloseRepo()persists the subtask state only wheng.successis true.See
clone_gitcli.go:When the blueprint has no
timeAfter, these steps repeat on every run:_devlake_subtask_states, soPrevStartedAt == nil.calculateStateManagerIncrementalModereturns(false, syncPolicy.TimeAfter), which is(false, nil)(subtask_state_manager.go).since == nil,fullClone()runs andg.successremainsfalse.CloseRepo()skipsstateManager.Close(), soPrevStartedAtis never saved (subtask_state_manager.go).The next run starts over at step 1. The
bootstrapStateFromCollectorStateIfNeededfallback does not help because the cloner does not pass aTable.Before a26791b,
CloneRepocalledg.stateManager.Close()after any successful clone, including a full clone (clone_gitcli.goat 7a805c1). After the first full run, subsequent runs were incremental. Since #7941 describes adding the AzDo double clone and a readability refactor without mentioning this behavior change, it appears to be unintentional.What do you expect to happen?
After a successful full clone, the subtask state should be saved. The next run should then be incremental (
since = PrevStartedAt), using a shallow fetch and collecting only new commits, as introduced by #7319.How to reproduce
timeAfter: null).timeAftervalue and run the blueprint twice. The second run is incremental.Anything else
The suggested fix is to mark the clone successful after either branch completes:
A related case occurs when running “Collect Data in Full Refresh Mode” with no
timeAfter: state is not saved, so the storedPrevStartedAtremains at its pre-refresh value.Workaround: Set a
timeAftervalue on the blueprint.Screenshots
Not applicable.
Other Information
Validation:
git diff --checkpassed.go test ./plugins/gitextractor/parserwas not run because Go andgofmtare not installed in the environment.