Re: [OPEN-ILS-GENERAL] Problem with upgrade script 2.12.6-3.0.0 on line 6839

2018-08-18 Thread Vaclav Jansa
Hello Josh,
many thanks for your hint. In accordance to this hint, I just try to
reingest authority records 'per partes'. Idealy with some scripting. I try
manually reingest first 200 authority records and it works.

I will share my script and probably also identified source of this issue.

Thanks and best regards

Vaclav

On Sat, Aug 18, 2018 at 1:30 AM Josh Stompro 
wrote:

> Hello Vaclav, It looks like this error starts when you hit the authority
> reindex at the end of the upgrade script.
>
> It looks like the previous database updates have already been committed at
> that point, a new transaction runs for the authority reingest.  So you may
> be able to try running small batches of authority records to reingest at
> once, instead of trying to do them all at once.  That may help you narrow
> down the problem to being with a specific authority record vs being with
> the authority reindexing process as a whole.
>
> If you pick out one existing authority record, and change the update
> command to something like.
> UPDATE authority.record_entry SET id = id WHERE NOT DELETED and id=1234;
> -- where 1234= authority.record_entry.id that you want to target.
>
> Then you can try reindexing just one record and see if that succeeds.
>
> Create a new script that just contains the Reingest authority record
> section of the script (lines 6806-6852), and modify that and run it against
> your database.
>
> If one record succeeds, then it very well may be specific authority
> records that are causing the problems.
>
> You could try narrowing it down by running the update on groups of
> authority records.
>
> Here is a query that builds a query string to update 50 authority records
> at a time.
>
> select
> 'UPDATE authority.record_entry SET id = id WHERE NOT DELETED AND id
> BETWEEN '||min||' and '||max||' ;'
> from (
> select min(id),max(id),chunkno
> from (
> select
> id
> , ((ROW_NUMBER() over (ORDER BY id) - 1) / 50)+1 as chunkNo --change 50 to
> how many records you want in a group
> from authority.record_entry where not deleted and id>0
> ) x
> group by 3
> order by 1
> ) y
> ;
>
> Also, if you echo the queries as they are executed it may be clearer which
> group the problem is in. (psql -a option).  Once you narrow it down to a
> group, you can change the script to run one update per record, to find the
> specific record.
>
> You may also be able to modify the authority.extract_headings[1] function
> to spit out some debugging info.  It looks to me like the " transformed_xml
> := oils_xslt_process(marc, xfrm.xslt);" line is where the error is coming
> up, when the authority marc data is passed to the oils_xslt_process, along
> with the config.xml_transform.xslt data for the index that is being
> processed.  Maybe add a try block and then on catching an error output the
> marc data?  (I'm not that familiar with stored procedures though, to know
> how to go about doing that.  Looks like it is by using an EXCEPTION clause?)
>
> Josh Stompro - LARL IT Director
>
> 1 -
> http://git.evergreen-ils.org/?p=Evergreen.git;a=blob;f=Open-ILS/src/sql/Pg/version-upgrade/2.12.6-3.0.0-upgrade-db.sql;h=7a865a89db22c333e8da9e3e7750bc9d1fc8bb95;hb=HEAD#l4782
>
> -Original Message-
> From: Open-ils-general [mailto:
> open-ils-general-boun...@list.georgialibraries.org] On Behalf Of Václav
> Jansa
> Sent: Friday, August 17, 2018 7:04 AM
> To: Evergreen Discussion Group  >
> Subject: [OPEN-ILS-GENERAL] Problem with upgrade script 2.12.6-3.0.0 on
> line 6839
>
> Hello Evergreeners,
> we are just trying to update our last production Evergreen installation
> (from 2.12 to 3.1), two are done without any issues, but with last one
> we encountered following error during first update step (2.12.6-3.0.0)
>
> psql:version-upgrade/2.12.6-3.0.0-upgrade-db.sql:6839: ERROR:  runtime
> error: file unknown-55cee649a7a0 element attribute
> xsl:attribute: Cannot add attributes to an element if children have been
> already added to the element.
>   at line 31.
> CONTEXT:  PL/Perl function "oils_xslt_process"
> PL/pgSQL function authority.extract_headings(text,integer[]) line 36 at
> assignment
> PL/pgSQL function authority.simple_heading_set(text) line 77 at FOR over
> SELECT rows
> PL/pgSQL function authority.indexing_ingest_or_delete() line 46 at FOR
> over SELECT rows
> psql:version-upgrade/2.12.6-3.0.0-upgrade-db.sql:6841: ERROR:  current
> transaction is aborted, commands ignored until end of transaction block
> psql:version-upgrade/2.12.6-3.0.0-upgrade-db.sql:6842: ERROR:  current
> transaction is aborted, commands ignored until end of transaction block
> psql:version-upgrade/2.12.6-3.0.0-upgrade-db.sql:6843: ERROR:  current
> transaction is aborted, commands ignored until end of transaction block
> psql:version-upgrade/2.12.6-3.0.0-upgrade-db.sql:6844: ERROR:  current
> transaction is aborted, commands ignored until end of transaction block
> psql:version-upgrade/2.12.6-3.0.0-upgrade-db.sql:6850: ERROR:  current
> transaction is aborted, 

Re: [OPEN-ILS-GENERAL] Problem with upgrade script 2.12.6-3.0.0 on line 6839

2018-08-17 Thread Josh Stompro
Hello Vaclav, It looks like this error starts when you hit the authority 
reindex at the end of the upgrade script.

It looks like the previous database updates have already been committed at that 
point, a new transaction runs for the authority reingest.  So you may be able 
to try running small batches of authority records to reingest at once, instead 
of trying to do them all at once.  That may help you narrow down the problem to 
being with a specific authority record vs being with the authority reindexing 
process as a whole.

If you pick out one existing authority record, and change the update command to 
something like.
UPDATE authority.record_entry SET id = id WHERE NOT DELETED and id=1234; -- 
where 1234= authority.record_entry.id that you want to target.

Then you can try reindexing just one record and see if that succeeds. 

Create a new script that just contains the Reingest authority record section of 
the script (lines 6806-6852), and modify that and run it against your database.

If one record succeeds, then it very well may be specific authority records 
that are causing the problems.

You could try narrowing it down by running the update on groups of authority 
records.

Here is a query that builds a query string to update 50 authority records at a 
time.

select 
'UPDATE authority.record_entry SET id = id WHERE NOT DELETED AND id BETWEEN 
'||min||' and '||max||' ;'
from (
select min(id),max(id),chunkno
from (
select
id
, ((ROW_NUMBER() over (ORDER BY id) - 1) / 50)+1 as chunkNo --change 50 to how 
many records you want in a group
from authority.record_entry where not deleted and id>0
) x
group by 3
order by 1
) y
;

Also, if you echo the queries as they are executed it may be clearer which 
group the problem is in. (psql -a option).  Once you narrow it down to a group, 
you can change the script to run one update per record, to find the specific 
record.

You may also be able to modify the authority.extract_headings[1] function to 
spit out some debugging info.  It looks to me like the " transformed_xml := 
oils_xslt_process(marc, xfrm.xslt);" line is where the error is coming up, when 
the authority marc data is passed to the oils_xslt_process, along with the 
config.xml_transform.xslt data for the index that is being processed.  Maybe 
add a try block and then on catching an error output the marc data?  (I'm not 
that familiar with stored procedures though, to know how to go about doing 
that.  Looks like it is by using an EXCEPTION clause?)

Josh Stompro - LARL IT Director

1 - 
http://git.evergreen-ils.org/?p=Evergreen.git;a=blob;f=Open-ILS/src/sql/Pg/version-upgrade/2.12.6-3.0.0-upgrade-db.sql;h=7a865a89db22c333e8da9e3e7750bc9d1fc8bb95;hb=HEAD#l4782

-Original Message-
From: Open-ils-general 
[mailto:open-ils-general-boun...@list.georgialibraries.org] On Behalf Of Václav 
Jansa
Sent: Friday, August 17, 2018 7:04 AM
To: Evergreen Discussion Group 
Subject: [OPEN-ILS-GENERAL] Problem with upgrade script 2.12.6-3.0.0 on line 
6839

Hello Evergreeners,
we are just trying to update our last production Evergreen installation 
(from 2.12 to 3.1), two are done without any issues, but with last one 
we encountered following error during first update step (2.12.6-3.0.0)

psql:version-upgrade/2.12.6-3.0.0-upgrade-db.sql:6839: ERROR:  runtime error: 
file unknown-55cee649a7a0 element attribute
xsl:attribute: Cannot add attributes to an element if children have been 
already added to the element.
  at line 31.
CONTEXT:  PL/Perl function "oils_xslt_process"
PL/pgSQL function authority.extract_headings(text,integer[]) line 36 at 
assignment
PL/pgSQL function authority.simple_heading_set(text) line 77 at FOR over SELECT 
rows
PL/pgSQL function authority.indexing_ingest_or_delete() line 46 at FOR over 
SELECT rows
psql:version-upgrade/2.12.6-3.0.0-upgrade-db.sql:6841: ERROR:  current 
transaction is aborted, commands ignored until end of transaction block
psql:version-upgrade/2.12.6-3.0.0-upgrade-db.sql:6842: ERROR:  current 
transaction is aborted, commands ignored until end of transaction block
psql:version-upgrade/2.12.6-3.0.0-upgrade-db.sql:6843: ERROR:  current 
transaction is aborted, commands ignored until end of transaction block
psql:version-upgrade/2.12.6-3.0.0-upgrade-db.sql:6844: ERROR:  current 
transaction is aborted, commands ignored until end of transaction block
psql:version-upgrade/2.12.6-3.0.0-upgrade-db.sql:6850: ERROR:  current 
transaction is aborted, commands ignored until end of transaction block



I already try to check authority related scripts, but from my point of 
view, error is somewhere in our authority data in DB.

Anybody else having the same experience? Do you have any idea how to 
find out what is causing the error?

Do you have any tip, how to ad some debugging code into standard code, 
what will help us with finding probably failed data?


Thanks for help and all recommendations

Best regards

Vaclav Jansa