aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2019-11-15 09:48:06 +0100
committerDmitry Vyukov <dvyukov@google.com>2019-11-15 09:48:06 +0100
commitbe8c51d3d92e6d697a62c75f0a08c053d56a5dca (patch)
tree00fa8c1fb15965ca245ca8f6694cb4a10b0aa0d1
parent79248ee88b39eb1a5b730f3bc0a995efed4d6a2c (diff)
dashboard/app: fix creation of bisection jobs
We limited the bugs query for bisection jobs at 300 bugs, but that's not enough in presence of multiple namespaces. Some namespaces did not get any bisections because all bugs belonged to other namespaces/managers. Fetch all bugs to fix this. While we are here also simplify check for bisection crashes: now we have FixBisectionDisabled as a property of manager, so we don't need to fetch the crash build to check it.
-rw-r--r--dashboard/app/api.go4
-rw-r--r--dashboard/app/jobs.go46
-rw-r--r--dashboard/app/main.go4
-rw-r--r--dashboard/app/reporting.go14
4 files changed, 29 insertions, 39 deletions
diff --git a/dashboard/app/api.go b/dashboard/app/api.go
index 1baf0af0a..f8a59a3e9 100644
--- a/dashboard/app/api.go
+++ b/dashboard/app/api.go
@@ -177,7 +177,7 @@ func apiBuilderPoll(c context.Context, ns string, r *http.Request, payload []byt
if err := json.Unmarshal(payload, req); err != nil {
return nil, fmt.Errorf("failed to unmarshal request: %v", err)
}
- bugs, err := loadAllBugs(c, func(query *db.Query) *db.Query {
+ bugs, _, err := loadAllBugs(c, func(query *db.Query) *db.Query {
return query.Filter("Namespace=", ns).
Filter("Status<", BugStatusFixed)
})
@@ -520,7 +520,7 @@ func addCommitsToBugs(c context.Context, ns, manager string, titles []string, fi
func addCommitsToBugsInStatus(c context.Context, status int, ns, manager string, managers []string,
presentCommits map[string]bool, bugFixedBy map[string][]string) error {
- bugs, err := loadAllBugs(c, func(query *db.Query) *db.Query {
+ bugs, _, err := loadAllBugs(c, func(query *db.Query) *db.Query {
return query.Filter("Namespace=", ns).
Filter("Status=", status)
})
diff --git a/dashboard/app/jobs.go b/dashboard/app/jobs.go
index f474e7763..7c7c011c0 100644
--- a/dashboard/app/jobs.go
+++ b/dashboard/app/jobs.go
@@ -244,21 +244,22 @@ func findBugsForBisection(c context.Context, managers map[string]bool, reproLeve
// Note: For JobBisectCause, order the bugs from newest to oldest. For JobBisectFix,
// order the bugs from oldest to newest.
// Sort property should be the same as property used in the inequality filter.
- query := db.NewQuery("Bug").Filter("Status=", BugStatusOpen)
- if jobType == JobBisectCause {
- query = query.Filter("FirstTime>", time.Time{}).
- Filter("ReproLevel=", reproLevel).
- Filter("BisectCause=", BisectNot).
- Order("-FirstTime")
- } else {
- query = query.Filter("LastTime>", time.Time{}).
- Filter("ReproLevel=", reproLevel).
- Filter("BisectFix=", BisectNot).
- Order("LastTime")
- }
// We only need 1 job, but we skip some because the query is not precise.
- var bugs []*Bug
- keys, err := query.Limit(300).GetAll(c, &bugs)
+ bugs, keys, err := loadAllBugs(c, func(query *db.Query) *db.Query {
+ query = query.Filter("Status=", BugStatusOpen)
+ if jobType == JobBisectCause {
+ query = query.Filter("FirstTime>", time.Time{}).
+ Filter("ReproLevel=", reproLevel).
+ Filter("BisectCause=", BisectNot).
+ Order("-FirstTime")
+ } else {
+ query = query.Filter("LastTime>", time.Time{}).
+ Filter("ReproLevel=", reproLevel).
+ Filter("BisectFix=", BisectNot).
+ Order("LastTime")
+ }
+ return query
+ })
if err != nil {
return nil, nil, fmt.Errorf("failed to query bugs: %v", err)
}
@@ -303,9 +304,8 @@ func bisectCrashForBug(c context.Context, bug *Bug, bugKey *db.Key, managers map
if crash.ReproSyz == 0 || !managers[crash.Manager] {
continue
}
- if ok, err := shouldBisectCrash(c, bug, crash, jobType); err != nil {
- return nil, nil, err
- } else if !ok {
+ if jobType == JobBisectFix &&
+ config.Namespaces[bug.Namespace].Managers[crash.Manager].FixBisectionDisabled {
continue
}
return crash, crashKeys[ci], nil
@@ -313,18 +313,6 @@ func bisectCrashForBug(c context.Context, bug *Bug, bugKey *db.Key, managers map
return nil, nil, nil
}
-func shouldBisectCrash(c context.Context, bug *Bug, crash *Crash, jobType JobType) (bool, error) {
- if jobType != JobBisectFix {
- return true, nil
- }
- build, err := loadBuild(c, bug.Namespace, crash.BuildID)
- if err != nil {
- return false, err
- }
- cfg := config.Namespaces[build.Namespace]
- return !cfg.Managers[build.Manager].FixBisectionDisabled, nil
-}
-
func createBisectJobForBug(c context.Context, bug0 *Bug, crash *Crash, bugKey, crashKey *db.Key, jobType JobType) (
*Job, *db.Key, error) {
build, err := loadBuild(c, bug0.Namespace, crash.BuildID)
diff --git a/dashboard/app/main.go b/dashboard/app/main.go
index 685649c9c..048f25468 100644
--- a/dashboard/app/main.go
+++ b/dashboard/app/main.go
@@ -548,7 +548,7 @@ func fetchNamespaceBugs(c context.Context, accessLevel AccessLevel,
}
return query
}
- bugs, err := loadAllBugs(c, filter)
+ bugs, _, err := loadAllBugs(c, filter)
if err != nil {
return nil, 0, err
}
@@ -637,7 +637,7 @@ func fetchNamespaceBugs(c context.Context, accessLevel AccessLevel,
func fetchTerminalBugs(c context.Context, accessLevel AccessLevel,
ns, manager string, typ *TerminalBug) (*uiBugGroup, error) {
- bugs, err := loadAllBugs(c, func(query *db.Query) *db.Query {
+ bugs, _, err := loadAllBugs(c, func(query *db.Query) *db.Query {
query = query.Filter("Namespace=", ns).
Filter("Status=", typ.Status)
if manager != "" {
diff --git a/dashboard/app/reporting.go b/dashboard/app/reporting.go
index f19d4d93f..c3b398b54 100644
--- a/dashboard/app/reporting.go
+++ b/dashboard/app/reporting.go
@@ -45,7 +45,7 @@ func reportingPollBugs(c context.Context, typ string) []*dashapi.BugReport {
log.Errorf(c, "%v", err)
return nil
}
- bugs, err := loadAllBugs(c, func(query *db.Query) *db.Query {
+ bugs, _, err := loadAllBugs(c, func(query *db.Query) *db.Query {
return query.Filter("Status<", BugStatusFixed)
})
if err != nil {
@@ -152,7 +152,7 @@ func needReport(c context.Context, typ string, state *ReportingState, bug *Bug)
}
func reportingPollNotifications(c context.Context, typ string) []*dashapi.BugNotification {
- bugs, err := loadAllBugs(c, func(query *db.Query) *db.Query {
+ bugs, _, err := loadAllBugs(c, func(query *db.Query) *db.Query {
return query.Filter("Status<", BugStatusFixed)
})
if err != nil {
@@ -522,16 +522,18 @@ func managersToRepos(c context.Context, ns string, managers []string) []string {
return repos
}
-func loadAllBugs(c context.Context, filter func(*db.Query) *db.Query) ([]*Bug, error) {
+func loadAllBugs(c context.Context, filter func(*db.Query) *db.Query) ([]*Bug, []*db.Key, error) {
var bugs []*Bug
- err := foreachBug(c, filter, func(bug *Bug, _ *db.Key) error {
+ var keys []*db.Key
+ err := foreachBug(c, filter, func(bug *Bug, key *db.Key) error {
bugs = append(bugs, bug)
+ keys = append(keys, key)
return nil
})
if err != nil {
- return nil, err
+ return nil, nil, err
}
- return bugs, nil
+ return bugs, keys, nil
}
func foreachBug(c context.Context, filter func(*db.Query) *db.Query, fn func(bug *Bug, key *db.Key) error) error {