Closed Bug 975191 Opened 10 years ago Closed 10 years ago

Self serve API for oak not building Oak nightly builds even know there is a nightly from 2 days ago

Categories

(Release Engineering :: General, defect)

x86_64
Windows 8
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: bbondy, Unassigned)

References

Details

(Keywords: buildapi)

+++ This bug was initially created as a clone of Bug #857397 +++

I was hoping someone can help me troubleshoot why I can't initiate nightly builds on Oak anymore.

You can see on 2014-02-18 that a nightly was built:
https://tbpl.mozilla.org/?tree=Oak&rev=4102831c51b4

I tried to build one at 3 different times on 2014-02-20 but no nightly builds are showing up on tbpl and on the ftp.

I tried to do the nightly builds with the tip of Oak:
1c875d373815

To do this I submitted that changeset in the box for nightly and hit submit here:
https://secure.pub.build.mozilla.org/buildapi/self-serve/oak
From bm62's self-serve agent log:

2014-02-20 11:07:34,027 Received {u'action': u'new_nightly_at_revision', u'body': {u'priority': 0, u'revision': u'1c875d373815', u'when': 1392923254, u'branch': u'oak', u'request_id': 652967}, u'who': u'bbondy@mozilla.com'}
2014-02-20 11:07:34,028 New nightly by bbondy@mozilla.com of oak 1c875d373815
2014-02-20 11:08:07,911 buildernames are []
2014-02-20 11:08:07,912 INSERT INTO sourcestamps
                (`branch`, `revision`, `patchid`, `repository`, `project`)
                VALUES
                (:branch, :revision, NULL, '', '')

2014-02-20 11:08:08,161 Created sourcestamp 7102600
2014-02-20 11:08:08,162 INSERT INTO buildsets
        (`external_idstring`, `reason`, `sourcestampid`, `submitted_at`, `complete`, `complete_at`, `results`)
        VALUES
        (:idstring, :reason, :sourcestampid, :submitted_at, 0, NULL, NULL)
[buildset and buildrequest creation left off]

The key bit is 'buildernames are []' from
  http://hg.mozilla.org/build/buildapi/file/73dbae9cb3db/buildapi/scripts/selfserve-agent.py#l478

Tentatively pegging this as a regression from bug 846104.
Blocks: 846104
I strongly suspect the problem is that we're doing this:
 SELECT DISTINCT buildernames FROM buildrequests WHERE
     buildername     LIKE :inclusion1 AND buildername     LIKE :inclusion2 \
 AND buildername NOT LIKE :exclusion1 AND buildername NOT LIKE :exclusion2
 AND submitted_at > :two_weeks_ago

The first AND should be an OR, with appropriate parentheses.

In other news, that query takes 30 seconds because it has to look at all 32 million rows in the table, and OR makes slower. The index on buildername doesn't help because of the LIKE conditions, and there's no index on the submitted_at column. We could add an index, but there's already one on claimed_at we could use instead.

Better would be querying like this:
 SELECT DISTINCT buildernames FROM buildrequests WHERE buildername LIKE '%oak%nightly%' \
   AND claimed_at > :two_weeks_ago
which runs in 1.5 seconds or so. Then convert the inclusions and exclusions to regex that get run in the python code.
Component: General Automation → Tools
Keywords: buildapi
QA Contact: catlee → hwine
This approach neglects other consumers of _create_build_for_revision() though.

zeller, will bug 793989 resolve this issue by making the bad code go away ?
Flags: needinfo?(johnlzeller)
(In reply to Nick Thomas [:nthomas] from comment #3)
> This approach neglects other consumers of _create_build_for_revision()
> though.
> 
> zeller, will bug 793989 resolve this issue by making the bad code go away ?

Nothing in bug 793989 is going to modify _create_build_for_revision() code. In regards to selfserve-agent, all bug 793989 changes are going to be within the new function do_new_build_for_builder().
Flags: needinfo?(johnlzeller)
Would resetting (somehow?) away oak help here?  For example currently to test bug 974570 I can at best (If I make no mistakes) land it by Friday because I need to wait a day for a Nightly build to trigger.
Pretty sure the problem lies entirely in buildapi itself.
I backed out bug 846104, could you give self-serve another go ?
Thanks, I issued another nightly:

> {
>   "status": "OK",
>   "request_id": 670791
> }

... (2 minutes later)...

And the N icons are showing up, which is good.  Looks like self serve nightly builds broke from bug 846104 at least on Oak.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Component: Tools → General
You need to log in before you can comment on or make changes to this bug.