[open-ils-commits] r15995 - trunk/Open-ILS/src/extras/import (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Mar 25 16:30:18 EDT 2010
Author: miker
Date: 2010-03-25 16:30:12 -0400 (Thu, 25 Mar 2010)
New Revision: 15995
Modified:
trunk/Open-ILS/src/extras/import/parallel_pg_loader.pl
trunk/Open-ILS/src/extras/import/pg_loader.pl
Log:
move the sequence update to after the commit to support parallel ingest
Modified: trunk/Open-ILS/src/extras/import/parallel_pg_loader.pl
===================================================================
--- trunk/Open-ILS/src/extras/import/parallel_pg_loader.pl 2010-03-25 20:17:25 UTC (rev 15994)
+++ trunk/Open-ILS/src/extras/import/parallel_pg_loader.pl 2010-03-25 20:30:12 UTC (rev 15995)
@@ -52,6 +52,7 @@
my $count = 0;
my $starttime = time;
+my $after_commit = '';
while ( my $rec = <> ) {
next unless ($rec);
@@ -123,7 +124,7 @@
for my $hint (@order) {
next if (grep { $_ eq $hint} @auto);
next unless ($fieldcache{$hint}{sequence});
- $main_out->print("SELECT setval('$fieldcache{$hint}{sequence}'::TEXT, (SELECT MAX($fieldcache{$hint}{pkey}) FROM $fieldcache{$hint}{table}), TRUE);\n\n");
+ $after_commit .= "SELECT setval('$fieldcache{$hint}{sequence}'::TEXT, (SELECT MAX($fieldcache{$hint}{pkey}) FROM $fieldcache{$hint}{table}), TRUE);\n";
}
if (grep /^mfr$/, %out_files) {
@@ -132,5 +133,6 @@
}
$main_out->print("COMMIT;\n\n") unless $nocommit;
+$main_out->print($after_commit);
$main_out->close;
Modified: trunk/Open-ILS/src/extras/import/pg_loader.pl
===================================================================
--- trunk/Open-ILS/src/extras/import/pg_loader.pl 2010-03-25 20:17:25 UTC (rev 15994)
+++ trunk/Open-ILS/src/extras/import/pg_loader.pl 2010-03-25 20:30:12 UTC (rev 15995)
@@ -87,6 +87,7 @@
$output->print("SET CLIENT_ENCODING TO 'UNICODE';\n\n");
$output->print("BEGIN;\n\n");
+my $after_commit = '';
for my $h (@order) {
# continue if there was no data for this table
next unless ($fieldcache{$h});
@@ -125,9 +126,10 @@
$output->print("SELECT reporter.disable_materialized_simple_record_trigger();\n");
}
- $output->print("SELECT setval('$fieldcache{$h}{sequence}'::TEXT, (SELECT MAX($fieldcache{$h}{pkey}) FROM $fieldcache{$h}{table}), TRUE);\n\n")
+ $after_commit .= "SELECT setval('$fieldcache{$h}{sequence}'::TEXT, (SELECT MAX($fieldcache{$h}{pkey}) FROM $fieldcache{$h}{table}), TRUE);\n";
if (!grep { $_ eq $h} @auto);
}
$output->print("COMMIT;\n\n") unless $nocommit;
+$output->print($after_commit);
$output->close;
More information about the open-ils-commits
mailing list