Re: Postgresql Database Error

2009-11-18 Thread Mike Bonnet
On 11/18/2009 02:15 AM, peng chen wrote:
 hello, fedora-buildsys-list:
 
when I requset a build task for pakcage anaconda to koji,
 one errie error come out.
 It detailed as follow:
 pg.DatabaseError: error ' ERROR: new row for relation task violates
 check constraint task_weight_check '
 in ' UPDATE task SET weight=-0.9838856091396 WHERE id = 16296 '
 I'm sure that the source rpm of anaconda is OK,because I succed to build
 it in local mock environment. and
 the repo is the same as the koji build server.
 hope you do me a favor sincerely!

Does one of the builds have a completion_time earlier than its
create_event time?  Koji uses the build duration to dynamically
calculate the weight of the task.  It should probably be checking for a
negative result, but it doesn't.

--
Fedora-buildsys-list mailing list
Fedora-buildsys-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-buildsys-list


Re: Postgresql Database Error

2009-11-18 Thread Mike McLean

On 11/18/2009 02:15 AM, peng chen wrote:

hello, fedora-buildsys-list:

when I requset a build task for pakcage anaconda to koji,
one errie error come out.
It detailed as follow:
 pg.DatabaseError: error ' ERROR: new row for relation task violates
check constraint task_weight_check '
in ' UPDATE task SET weight=-0.9838856091396 WHERE id = 16296 '
 I'm sure that the source rpm of anaconda is OK,because I succed to build
it in local mock environment. and
the repo is the same as the koji build server.
 hope you do me a favor sincerely!


The system time on your hub must have been set back during an anaconda 
build and there must be sufficiently few anaconda builds for this to 
cause getAverageBuildDuration('anaconda') to return a negative number.


We should of course fix this, but you should also avoid rolling back the 
time on your koji hosts, especially the hub and db hosts.


In the meantime, this patch should help
--- a/builder/kojid
+++ b/builder/kojid
@@ -2033,6 +2033,9 @@ class BuildArchTask(BaseTaskHandler):
 avg = session.getAverageBuildDuration(name)
 if not avg:
 return
+if avg  0:
+self.logger.warn(Negative average build duration for %s: 
%s, name, avg)

+return
 # increase the task weight by 0.75 for every hour of build 
duration

 adj = (avg / 4800.0)
 # cap the adjustment at +4.5

--
Fedora-buildsys-list mailing list
Fedora-buildsys-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-buildsys-list


Re: Postgresql Database Error

2009-11-18 Thread peng chen
2009/11/19 fedora-buildsys-list-requ...@redhat.com

 Send Fedora-buildsys-list mailing list submissions to
fedora-buildsys-list@redhat.com

 To subscribe or unsubscribe via the World Wide Web, visit
https://www.redhat.com/mailman/listinfo/fedora-buildsys-list
 or, via email, send a message with subject or body 'help' to
fedora-buildsys-list-requ...@redhat.com

 You can reach the person managing the list at
fedora-buildsys-list-ow...@redhat.com

 When replying, please edit your Subject line so it is more specific
 than Re: Contents of Fedora-buildsys-list digest...


 Today's Topics:

   1. Postgresql Database Error (peng chen)
   2. Re: Postgresql Database Error (Mike Bonnet)
   3. Re: Postgresql Database Error (Mike McLean)


 --

 Message: 1
 Date: Wed, 18 Nov 2009 15:15:46 +0800
 From: peng chen peng.che...@gmail.com
 Subject: Postgresql Database Error
 To: fedora-buildsys-list@redhat.com
 Message-ID:
7e200e7f0911172315q4b2fc425p8575bdd7e2b74...@mail.gmail.com
 Content-Type: text/plain; charset=iso-8859-1

 hello, fedora-buildsys-list:

   when I requset a build task for pakcage anaconda to koji,
 one errie error come out.
 It detailed as follow:
pg.DatabaseError: error ' ERROR: new row for relation task violates
 check constraint task_weight_check '
 in ' UPDATE task SET weight=-0.9838856091396 WHERE id = 16296 '
I'm sure that the source rpm of anaconda is OK,because I succed to build
 it in local mock environment. and
 the repo is the same as the koji build server.
hope you do me a favor sincerely!
 -- next part --
 An HTML attachment was scrubbed...
 URL:
 https://www.redhat.com/archives/fedora-buildsys-list/attachments/20091118/b463b957/attachment.html

 --

 Message: 2
 Date: Wed, 18 Nov 2009 08:51:54 -0500
 From: Mike Bonnet mi...@redhat.com
 Subject: Re: Postgresql Database Error
 To: fedora-buildsys-list@redhat.com
 Message-ID: 4b03fbfa.2000...@redhat.com
 Content-Type: text/plain; charset=UTF-8

 On 11/18/2009 02:15 AM, peng chen wrote:
  hello, fedora-buildsys-list:
 
 when I requset a build task for pakcage anaconda to koji,
  one errie error come out.
  It detailed as follow:
  pg.DatabaseError: error ' ERROR: new row for relation task violates
  check constraint task_weight_check '
  in ' UPDATE task SET weight=-0.9838856091396 WHERE id = 16296 '
  I'm sure that the source rpm of anaconda is OK,because I succed to
 build
  it in local mock environment. and
  the repo is the same as the koji build server.
  hope you do me a favor sincerely!

 Does one of the builds have a completion_time earlier than its
 create_event time?  Koji uses the build duration to dynamically
 calculate the weight of the task.  It should probably be checking for a
 negative result, but it doesn't.



 --

 Message: 3
 Date: Wed, 18 Nov 2009 08:56:59 -0500
 From: Mike McLean mi...@redhat.com
 Subject: Re: Postgresql Database Error
 To: fedora-buildsys-list@redhat.com
 Message-ID: 4b03fd2b.5040...@redhat.com
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed

 On 11/18/2009 02:15 AM, peng chen wrote:
  hello, fedora-buildsys-list:
 
  when I requset a build task for pakcage anaconda to koji,
  one errie error come out.
  It detailed as follow:
   pg.DatabaseError: error ' ERROR: new row for relation task
 violates
  check constraint task_weight_check '
  in ' UPDATE task SET weight=-0.9838856091396 WHERE id = 16296 '
   I'm sure that the source rpm of anaconda is OK,because I succed to
 build
  it in local mock environment. and
  the repo is the same as the koji build server.
   hope you do me a favor sincerely!

 The system time on your hub must have been set back during an anaconda
 build and there must be sufficiently few anaconda builds for this to
 cause getAverageBuildDuration('anaconda') to return a negative number.

 We should of course fix this, but you should also avoid rolling back the
 time on your koji hosts, especially the hub and db hosts.

 In the meantime, this patch should help
 --- a/builder/kojid
 +++ b/builder/kojid
 @@ -2033,6 +2033,9 @@ class BuildArchTask(BaseTaskHandler):
  avg = session.getAverageBuildDuration(name)
  if not avg:
  return
 +if avg  0:
 +self.logger.warn(Negative average build duration for %s:
 %s, name, avg)
 +return
  # increase the task weight by 0.75 for every hour of build
 duration
  adj = (avg / 4800.0)
  # cap the adjustment at +4.5



 --
 As Mike Bonnet said in message 2, one of anaconda builds had a
 completion_time earlier than creation_time, so I find the one and remember
 the build ID, then update the table build  to make the completion_time
 later than creation_time.


Now the problem was solved