specify OFFSET using enviroment variable
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 14 Nov 2010 13:35:47 +0000 (14:35 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 14 Nov 2010 13:35:47 +0000 (14:35 +0100)
this is useful to re-start import of data after cluster failed anough to
abort it

koha/koha2riak-search.pl

index c6ac166..dd7dcb6 100755 (executable)
@@ -13,10 +13,11 @@ $table    ||= 'biblioitems';
 $dbi      ||= 'DBI:mysql:dbname=koha;host=10.60.0.10;port=3306';
 
 my $batch_size = 1000;
+my $offset = $ENV{OFFSET} || 0;
 
 my $dbh = DBI->connect($dbi,"","") || die $DBI::errstr;
 my $riak = RiakSearch->new( $riak_url );
-#$riak->{args} = 'w=2';
+#$riak->{args} = 'w=1';
 
 
 sub riak_search_kv_hook {
@@ -33,7 +34,6 @@ sub riak_search_kv_hook {
 riak_search_kv_hook 'koha.marcxml';
 riak_search_kv_hook "koha.$table";
 
-my $offset = 0;
 while(1) {
 
        my $limit = "LIMIT $batch_size OFFSET $offset";