Hi! How do I find these records? root@koha:~# /usr/share/koha/bin/export_records.pl --record-type=bibs --filename=koha-bibs.mrc Record length of 112264 is larger than the MARC spec allows (99999 bytes). at /usr/share/perl5/MARC/File/USMARC.pm line 314. Record length of 113375 is larger than the MARC spec allows (99999 bytes). at /usr/share/perl5/MARC/File/USMARC.pm line 314. Record length of 107982 is larger than the MARC spec allows (99999 bytes). at /usr/share/perl5/MARC/File/USMARC.pm line 314. Record length of 101864 is larger than the MARC spec allows (99999 bytes). at /usr/share/perl5/MARC/File/USMARC.pm line 314. Record length of 110662 is larger than the MARC spec allows (99999 bytes). at /usr/share/perl5/MARC/File/USMARC.pm line 314. Good Luck! Igor A. Sychev Tomsk Polytechnic University https://lib.tpu.ru/
Hi Игорь Алексеевич You wrote:
How do I find these records?
root@koha:~# /usr/share/koha/bin/export_records.pl --record-type=bibs --filename=koha-bibs.mrc
Record length of 112264 is larger than the MARC spec allows (99999 bytes). at /usr/share/perl5/MARC/File/USMARC.pm line 314.
Try: root@koha:~# find / -name koha-bibs.mrc -print Hope this helps. Best wishes: Michael -- Geschäftsführer · Diplombibliothekar BBS, Informatiker eidg. Fachausweis Admin Kuhn GmbH · Pappelstrasse 20 · 4123 Allschwil · Schweiz T 0041 (0)61 261 55 61 · E mik@adminkuhn.ch · W www.adminkuhn.ch
Hi, Michael! Thanks for the answer! I may have phrased the question incorrectly. Command (find / -name koha-bibs.mrc -print) shows the full path to the file. I need to find records that are longer than the allowed MARC specification (99999 bytes). Good Luck! Igor A. Sychev Tomsk Polytechnic University https://lib.tpu.ru
Hi! On Fri, Feb 14, 2025 at 10:11:18AM +0000, Сычев Игорь Алексеевич wrote:
How do I find these records?
I assume you want to find the IDs of those records in your Koha DB? This SQL should list the 10 biblios with the largest metadata (i.e. MARC data): select biblionumber,length(metadata) from biblio_metadata order by 2 desc limit 10; But: depending on your setup etc biblio_metadata.metadata might be MARCXML or USMARC (or maybe something else) (check biblio_metadata.format). MARCXML doesn't have this size limit, but USMARC does (and this causes the most funny bugs...) And MARCXML takes much more space than USMARC (because of all the XML fluff), so you might get different lengths from the DB. But I would assume that the longer the MARCXML content is, the longer the USMARC will be.
root@koha:~# /usr/share/koha/bin/export_records.pl --record-type=bibs --filename=koha-bibs.mrc
Do you need to export as USMARC? It is (IMO) a very horrible format, and MARCXML (while also horrible) is less so. Greetings, domm -- Thomas Klausner domm https://domm.plix.at Just another ( Perl | Postgres | Bicycle | Food | Photo | Vinyl ) Hacker Demo against the upcoming rightwing government in .at, on the same date as 25 years earlier when ÖVP invited FPÖ (back then with Haider) into government. [ 2025-02-04 10:00 > https://domm.plix.at/potd/2025-02-04.html ] Today I wanted to transfer two ~100GB postgres dumps (of decommissioned Cloud SQL instances, which we moved to our own PG cluster) from a Google Cloud Storage bucket to a Google Drive (for easier long term backup). Instead of downloading to my machine and uploading again, I followed these instructions using Google Colab, which mostly worked (I had to zip the files before uploading, so I added a step) https://medium.lies.io/transferring-data-from-google-drive-to-google-cloud-s... Quite amazing, esp all the authorizing worked like a charm and without a hitch. [ 2025-02-13 12:01 > https://domm.plix.at/microblog.html ]
Also export contains items in 952/995 so records with a lot of items may be too big Le 14/02/2025 à 12:46, Thomas Klausner a écrit :
Hi!
On Fri, Feb 14, 2025 at 10:11:18AM +0000, Сычев Игорь Алексеевич wrote:
How do I find these records?
I assume you want to find the IDs of those records in your Koha DB?
This SQL should list the 10 biblios with the largest metadata (i.e. MARC data):
select biblionumber,length(metadata) from biblio_metadata order by 2 desc limit 10;
But: depending on your setup etc biblio_metadata.metadata might be MARCXML or USMARC (or maybe something else) (check biblio_metadata.format).
MARCXML doesn't have this size limit, but USMARC does (and this causes the most funny bugs...)
And MARCXML takes much more space than USMARC (because of all the XML fluff), so you might get different lengths from the DB. But I would assume that the longer the MARCXML content is, the longer the USMARC will be.
root@koha:~# /usr/share/koha/bin/export_records.pl --record-type=bibs --filename=koha-bibs.mrc
Do you need to export as USMARC? It is (IMO) a very horrible format, and MARCXML (while also horrible) is less so.
Greetings, domm
-- Fridolin SOMERS <fridolin.somers@biblibre.com> Software and system maintainer 🦄 BibLibre, France
Hi, Fridolin! Yes, it is possible. Now I need to understand if all the items have been imported. Good Luck! Igor A. Sychev Tomsk Polytechnic University https://lib.tpu.ru -----Original Message----- From: Koha <koha-bounces@lists.katipo.co.nz> On Behalf Of Fridolin SOMERS Sent: Friday, February 14, 2025 9:51 PM To: koha@lists.katipo.co.nz Subject: Re: [Koha] export_records.pl Also export contains items in 952/995 so records with a lot of items may be too big
Hi, Thomas! Thanks for the answer! Yes, I want to find the IDs of these records. UNIMARC format. I suspect that these are records that have many (995 field UNIMARC) items (holdings). I probably need to search for records with a large number of items if all items have been imported. Thanks for the idea. There is currently no way to try MARCXML. Do I understand correctly that there will be no such errors when importing to xml? root@koha:~# /usr/share/koha/bin/export_records.pl --format=xml --record-type=bibs --filename=koha-bibs.xml I will definitely try if possible. Good Luck! Igor A. Sychev Tomsk Polytechnic University https://lib.tpu.ru
Hi Igor, All, The actual record exporting (in export_records.pl or via the Staff Interface) is carried out by Koha::Exporter::Record::export(), which is in fact capable of detecting warnings reported by Perl's MARC modules, such as an invalid record length of more than 99999 bytes when exporting to MARC/ISO2709: Excerpt from Koha/Exporter/Record.pm: 191 my $errorcount_on_decode = eval { scalar( MARC::File::USMARC->decode( $record->as_usmarc )->warnings() ) }; 192 if ( $errorcount_on_decode or $@ ) { 193 my $msg = "Record $record_id could not be exported. " . ( $@ // '' ); 194 chomp $msg; 195 Koha::Logger->get->info($msg); 196 next; 197 } The 'Koha Logger' page in the Koha Community Wiki reads [1]: "By default, only messages of warn, error or fatal will be logged in Koha. To reveal less severe messages a Koha admin will need to modify the Koha's Log4Perl configuration file." That's why you don't see anything in the Koha system logs: line 195 above sets the severity to 'info' (which is lower than 'warn') and therefore the message never gets logged. If you modify line 195 so that it reads: 195 Koha::Logger->get->warn($msg); you'll get something useful in your intranet-error.log, but only when exporting via the Staff Interface. However, thanks to Bug 14751 - Allow C4::Context->interface to be set to 'sip' or 'commandline' [2], we can define a new section in our Log4perl configuration file so that log messages from Koha command-line utilities will be logged appropriately. Try adding the following lines to your /etc/koha/sites/<instance>/log4perl.conf (replacing <instance> with your actual Koha instance name), and then restart the koha-common service. When you next invoke the export_records.pl script and it encounters a warning, it will log it at /var/log/koha/<instance>/commandline-error.log. log4perl.logger.commandline = INFO, COMMANDLINE log4perl.appender.COMMANDLINE=Log::Log4perl::Appender::File log4perl.appender.COMMANDLINE.filename=/var/log/koha/<instance>/commandline-error.log log4perl.appender.COMMANDLINE.mode=append log4perl.appender.COMMANDLINE.layout=PatternLayout log4perl.appender.COMMANDLINE.layout.ConversionPattern=[%d] [%p] %m %l%n log4perl.appender.COMMANDLINE.utf8=1 I hope this helps! Kind regards, Andreas [1] https://wiki.koha-community.org/wiki/Koha_Logger [2] https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14751 On 2025-02-14 12:11, Сычев Игорь Алексеевич wrote:
Hi!
How do I find these records?
root@koha:~# /usr/share/koha/bin/export_records.pl --record-type=bibs --filename=koha-bibs.mrc
Record length of 112264 is larger than the MARC spec allows (99999 bytes). at /usr/share/perl5/MARC/File/USMARC.pm line 314. Record length of 113375 is larger than the MARC spec allows (99999 bytes). at /usr/share/perl5/MARC/File/USMARC.pm line 314. Record length of 107982 is larger than the MARC spec allows (99999 bytes). at /usr/share/perl5/MARC/File/USMARC.pm line 314. Record length of 101864 is larger than the MARC spec allows (99999 bytes). at /usr/share/perl5/MARC/File/USMARC.pm line 314. Record length of 110662 is larger than the MARC spec allows (99999 bytes). at /usr/share/perl5/MARC/File/USMARC.pm line 314.
Good Luck!
Igor A. Sychev Tomsk Polytechnic University https://lib.tpu.ru/
_______________________________________________
Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
Hi, Andreas! Thanks for the answer! -----Original Message----- From: Andreas Roussos <a.roussos@dataly.gr> Sent: Sunday, February 16, 2025 5:46 AM To: Сычев Игорь Алексеевич <ias@tpu.ru>; koha@lists.katipo.co.nz Subject: Re: [Koha] export_records.pl Hi Igor, All, The actual record exporting (in export_records.pl or via the Staff Interface) is carried out by Koha::Exporter::Record::export(), which is in fact capable of detecting warnings reported by Perl's MARC modules, such as an invalid record length of more than 99999 bytes when exporting to MARC/ISO2709: Excerpt from Koha/Exporter/Record.pm: 191 my $errorcount_on_decode = eval { scalar( MARC::File::USMARC->decode( $record->as_usmarc )->warnings() ) }; 192 if ( $errorcount_on_decode or $@ ) { 193 my $msg = "Record $record_id could not be exported. " . ( $@ // '' ); 194 chomp $msg; 195 Koha::Logger->get->info($msg); 196 next; 197 } The 'Koha Logger' page in the Koha Community Wiki reads [1]: "By default, only messages of warn, error or fatal will be logged in Koha. To reveal less severe messages a Koha admin will need to modify the Koha's Log4Perl configuration file." That's why you don't see anything in the Koha system logs: line 195 above sets the severity to 'info' (which is lower than 'warn') and therefore the message never gets logged. If you modify line 195 so that it reads: 195 Koha::Logger->get->warn($msg); you'll get something useful in your intranet-error.log, but only when exporting via the Staff Interface. However, thanks to Bug 14751 - Allow C4::Context->interface to be set to 'sip' or 'commandline' [2], we can define a new section in our Log4perl configuration file so that log messages from Koha command-line utilities will be logged appropriately. Try adding the following lines to your /etc/koha/sites/<instance>/log4perl.conf (replacing <instance> with your actual Koha instance name), and then restart the koha-common service. When you next invoke the export_records.pl script and it encounters a warning, it will log it at /var/log/koha/<instance>/commandline-error.log. log4perl.logger.commandline = INFO, COMMANDLINE log4perl.appender.COMMANDLINE=Log::Log4perl::Appender::File log4perl.appender.COMMANDLINE.filename=/var/log/koha/<instance>/commandline-error.log log4perl.appender.COMMANDLINE.mode=append log4perl.appender.COMMANDLINE.layout=PatternLayout log4perl.appender.COMMANDLINE.layout.ConversionPattern=[%d] [%p] %m %l%n log4perl.appender.COMMANDLINE.utf8=1 I hope this helps! Kind regards, Andreas [1] https://wiki.koha-community.org/wiki/Koha_Logger [2] https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14751
participants (5)
-
Andreas Roussos -
Fridolin SOMERS -
Michael Kuhn -
Thomas Klausner -
Сычев Игорь Алексеевич