Hi Dave,

This is the next error I got. Already fixed the DB accordingly.
Traffic Ops fatal error occurred while processing your request.
------------------------------
Error at line 146 ( my $insert = $self->db->resultset('Job')->create()
------------------------------
DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st
execute failed: Cannot add or update a child row: a foreign key constraint
fails (`traffic_ops_db`.`job`, CONSTRAINT `fk_job_status_id1` FOREIGN KEY
(`status`) REFERENCES `job_status` (`id`) ON DELETE NO ACTION ON UPDATE NO
ACTION) [for Statement "INSERT INTO job ( agent, asset_type, asset_url,
entered_time, job_deliveryservice, job_user, keyword, object_name,
object_type, parameters, start_time, status) VALUES ( ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ? )" with ParamValues: 0=1, 1="file", 2="
http://images1.ynet.co.il/foo/.*";, 3='2017-01-24 09:16:46', 4='311',
5='59', 6="PURGE", 7=undef, 8=undef, 9="TTL:48h", 10='2017-01-24 09:05:26',
11=1] at /opt/traffic_ops/app/lib/UI/Job.pm line 146

What happened was that TO post_install script failed the first time I ran
it, and I ran it again. As a result, the records in job_status & job_agent
were added, removed, and added again, and their ids were offset. I guess
there are several routes in the code counting on a specific record id in
the DB.

After fixing the DB, there was another error, the parameter snapshot_dir
was missing from regex_revalidate.config profile.
When I added the missing parameter,"Invalidate content" worked as expected.

Thanks a lot for your help.

Naama



On Tue, Jan 24, 2017 at 5:16 PM, Dave Neuman <[email protected]> wrote:

> can you send the new error?
>
>
> On Tue, Jan 24, 2017 at 2:18 AM, Naama Shoresh <[email protected]> wrote:
>
> > actually, I didn't look closely enough. It is now complaining about a
> > different table.
> > Thanks!
> >
> > On Tue, Jan 24, 2017 at 11:13 AM, Naama Shoresh <[email protected]>
> wrote:
> >
> > > I checked. The exact same error.
> > > It seemed weird to me, too.
> > >
> > > On Tue, Jan 24, 2017 at 11:12 AM, Oren Shemesh <[email protected]>
> wrote:
> > >
> > >> [1:1]
> > >>
> > >> R U sure that the exact same error repeats ?
> > >> It seems that now the constraint is satisfied, so if there is an
> error,
> > it
> > >> will be a different one ...
> > >>
> > >> (Not that I know SQL, but my sqenglish is good enough :-)
> > >>
> > >> On Tue, Jan 24, 2017 at 10:57 AM, Naama Shoresh <[email protected]>
> > wrote:
> > >>
> > >> > I tried adding a row to the job_agent table:
> > >> > mysql> select * from job_agent;
> > >> > +----+-------+----------------------------+--------+--------
> > >> -------------+
> > >> > | id | name  | description                | active | last_updated
> > >>   |
> > >> > +----+-------+----------------------------+--------+--------
> > >> -------------+
> > >> > |  1 | PURGE | Description of Purge Agent |      1 | 2017-01-24
> > >> 08:50:22 |
> > >> > |  2 | dummy | Description of Purge Agent |      1 | 2017-01-01
> > >> 10:28:43 |
> > >> > +----+-------+----------------------------+--------+--------
> > >> -------------+
> > >> > 2 rows in set (0.00 sec)
> > >> >
> > >> > But the error repeats.
> > >> > Any ideas?
> > >> >
> > >> > Thanks,
> > >> > Naama
> > >> >
> > >> > On Tue, Jan 24, 2017 at 12:17 AM, Dave Neuman <[email protected]>
> > >> wrote:
> > >> >
> > >> > > The error message says that you are trying to submit a job with an
> > >> Agent
> > >> > id
> > >> > > of 1, which doesn't exist.
> > >> > > ```INSERT INTO job ( agent, asset_type, asset_url,
> > >> > > entered_time, job_deliveryservice, job_user, keyword, object_name,
> > >> > > object_type, parameters, start_time, status) VALUES ( ?, ?, ?, ?,
> ?,
> > >> ?,
> > >> > ?,
> > >> > > ?, ?, ?, ?, ? )" with ParamValues: 0=1, 1="file", 2="
> > >> > > http://s2.ipcamlive.com/.*/7464537492280autoresize.jpg";,
> > >> 3='2017-01-22
> > >> > > 13:04:53', 4='312', 5='59', 6="PURGE", 7=undef, 8=undef,
> > 9="TTL:48h",
> > >> > > 10='2017-01-22 13:05:22', 11=1] at /opt/traffic_ops/app/lib/UI/
> > Job.pm
> > >> > line
> > >> > > 146```
> > >> > > I am not sure how that agent is supposed to be created, this might
> > be
> > >> a
> > >> > > bug.  Can you please submit an issue?
> > >> > > The workaround would be to create an agent with id = 1.
> > >> > >
> > >> > > Thanks,
> > >> > > Dave
> > >> > >
> > >> > > On Mon, Jan 23, 2017 at 3:05 PM, Naama Shoresh <[email protected]>
> > >> wrote:
> > >> > >
> > >> > > > No, only this one:
> > >> > > > (2,'dummy','Description of Purge Agent',1,'2017-01-04 13:16:30')
> > >> > > >
> > >> > > > What does that mean?
> > >> > > >
> > >> > > > Thanks,
> > >> > > > Naama
> > >> > > >
> > >> > > > On Mon, Jan 23, 2017 at 5:27 PM, Dave Neuman <[email protected]
> >
> > >> > wrote:
> > >> > > >
> > >> > > > > Do you have an agent in your job_agent table with the id of 1?
> > >> > > > >
> > >> > > > >
> > >> > > > > On Mon, Jan 23, 2017 at 5:42 AM, Naama Shoresh <
> > [email protected]>
> > >> > > wrote:
> > >> > > > >
> > >> > > > > > Hi,
> > >> > > > > >
> > >> > > > > > When trying to invalidate content from the TO UI, I get the
> > >> > following
> > >> > > > > fatal
> > >> > > > > > error message:
> > >> > > > > >
> > >> > > > > > Traffic Ops fatal error occurred while processing your
> > request.
> > >> > > > > > ------------------------------
> > >> > > > > > Error at line 146 ( my $insert =
> $self->db->resultset('Job')->
> > >> > > create()
> > >> > > > > > ------------------------------
> > >> > > > > > DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception:
> > >> > > > DBD::mysql::st
> > >> > > > > > execute failed: Cannot add or update a child row: a foreign
> > key
> > >> > > > > constraint
> > >> > > > > > fails (`traffic_ops_db`.`job`, CONSTRAINT `fk_job_agent_id1`
> > >> > FOREIGN
> > >> > > > KEY
> > >> > > > > > (`agent`) REFERENCES `job_agent` (`id`) ON DELETE CASCADE ON
> > >> UPDATE
> > >> > > NO
> > >> > > > > > ACTION) [for Statement "INSERT INTO job ( agent, asset_type,
> > >> > > asset_url,
> > >> > > > > > entered_time, job_deliveryservice, job_user, keyword,
> > >> object_name,
> > >> > > > > > object_type, parameters, start_time, status) VALUES ( ?, ?,
> ?,
> > >> ?,
> > >> > ?,
> > >> > > ?,
> > >> > > > > ?,
> > >> > > > > > ?, ?, ?, ?, ? )" with ParamValues: 0=1, 1="file", 2="
> > >> > > > > > http://s2.ipcamlive.com/.*/7464537492280autoresize.jpg";,
> > >> > > 3='2017-01-22
> > >> > > > > > 13:04:53', 4='312', 5='59', 6="PURGE", 7=undef, 8=undef,
> > >> > 9="TTL:48h",
> > >> > > > > > 10='2017-01-22 13:05:22', 11=1] at
> > /opt/traffic_ops/app/lib/UI/
> > >> > > Job.pm
> > >> > > > > line
> > >> > > > > > 146
> > >> > > > > >
> > >> > > > > > In traffic_ops log file I see this message:
> > >> > > > > > [2017-01-23 12:31:47,834] [ERROR]
> DBIx::Class::Storage::DBI::_
> > >> > > > > > dbh_execute():
> > >> > > > > > DBI Exception: DBD::mysql::st execute failed: Cannot add or
> > >> update
> > >> > a
> > >> > > > > child
> > >> > > > > > row: a foreign key constraint fails (`traffic_ops_db`.`job`,
> > >> > > CONSTRAINT
> > >> > > > > > `fk_job_agent_id1` FOREIGN KEY (`agent`) REFERENCES
> > `job_agent`
> > >> > > (`id`)
> > >> > > > ON
> > >> > > > > > DELETE CASCADE ON UPDATE NO ACTION) [for Statement "INSERT
> > INTO
> > >> > job (
> > >> > > > > > agent, asset_type, asset_url, entered_time,
> > job_deliveryservice,
> > >> > > > > job_user,
> > >> > > > > > keyword, object_name, object_type, parameters, start_time,
> > >> status)
> > >> > > > > VALUES (
> > >> > > > > > ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" with ParamValues: 0=1,
> > >> > > 1="file",
> > >> > > > > 2="
> > >> > > > > > http://images1.ynet.co.il/foo/.*";, 3='2017-01-23 12:31:47',
> > >> > 4='311',
> > >> > > > > > 5='59', 6="PURGE", 7=undef, 8=undef, 9="TTL:48h",
> > 10='2017-01-23
> > >> > > > > 12:32:22',
> > >> > > > > > 11=1] at /opt/traffic_ops/app/lib/UI/Job.pm line 146
> > >> > > > > > [2017-01-23 12:31:47,835] [ERROR]
> > >> > > > > >
> > >> > > > > >
> > >> > > > > > Any idea why this happens?
> > >> > > > > >
> > >> > > > > > Thanks,
> > >> > > > > > Naama
> > >> > > > > >
> > >> > > > >
> > >> > > >
> > >> > > >
> > >> > > >
> > >> > > > --
> > >> > > > *Naama Shoresh*
> > >> > > > Qwilt | Work: +972-72-2221706 <+972%2072-222-1706> | Mobile:
> > >> +972-52-3401999 <+972%2052-340-1999> |
> > >> > > > [email protected]
> > >> > > >
> > >> > >
> > >> >
> > >> >
> > >> >
> > >> > --
> > >> > *Naama Shoresh*
> > >> > Qwilt | Work: +972-72-2221706 | Mobile: +972-52-3401999 |
> > >> > [email protected]
> > >> >
> > >>
> > >>
> > >>
> > >> --
> > >>
> > >> *Oren Shemesh*
> > >> Qwilt | Work: +972-72-2221637| Mobile: +972-50-2281168 |
> > [email protected]
> > >> <[email protected]>
> > >>
> > >
> > >
> > >
> > > --
> > > *Naama Shoresh*
> > > Qwilt | Work: +972-72-2221706 <+972%2072-222-1706> | Mobile:
> > > +972-52-3401999 <+972%2052-340-1999> | [email protected]
> > >
> >
> >
> >
> > --
> > *Naama Shoresh*
> > Qwilt | Work: +972-72-2221706 | Mobile: +972-52-3401999 |
> > [email protected]
> >
>



-- 
*Naama Shoresh*
Qwilt | Work: +972-72-2221706 | Mobile: +972-52-3401999 | [email protected]

Reply via email to