[open-ils-commits] r18482 - branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Oct 26 22:24:12 EDT 2010


Author: dbs
Date: 2010-10-26 22:24:10 -0400 (Tue, 26 Oct 2010)
New Revision: 18482

Modified:
   branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm
Log:
Prevent ingest errors when asset.uri ID value outstrips asset.call_number

We were basing IDs in asset.uri on the max ID of asset.call_number,
which occasionally led to major ingest problems as attempts to insert
the next ID into asset.uri failed because that ID already existed. Using
the max ID from asset.uri for asset.uri inserts seems to make more sense
and does resolve that problem.

The bigger problem of not using the sequences that are already on these
tables to generate the IDs will not be an issue in 2.0, when we move to
in-database ingest and can use the normal lastval() approach to populate
asset.uri_call_number_map with the new values.


Modified: branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm
===================================================================
--- branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm	2010-10-26 22:11:57 UTC (rev 18481)
+++ branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm	2010-10-27 02:24:10 UTC (rev 18482)
@@ -419,8 +419,8 @@
     }
 
     if (!$max_uri) {
-        my $cn = $cstore->request( 'open-ils.cstore.direct.asset.call_number.search' => { id => { '!=' => undef } }, { limit => 1, order_by => { acn => 'id desc' } } )->gather(1);
-        $max_uri = int($cn->id) + 1000;
+        my $uri = $cstore->request( 'open-ils.cstore.direct.asset.uri.search' => { id => { '!=' => undef } }, { limit => 1, order_by => { auri => 'id desc' } } )->gather(1);
+        $max_uri = int($uri->id) + 1000;
     }
 
     $cstore->disconnect;



More information about the open-ils-commits mailing list