Changeset 19775

Show
Ignore:
Timestamp:
09.06.2009 14:37:13 (10 years ago)
Author:
davidb
Message:

Switch to using more batched approach (for efficiency reasons) for arcinfo writing out DB information

Location:
gsdl/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/bin/script/import.pl

    r19760 r19775  
    696696    $archive_info->save_info($arcinfo_doc_filename); 
    697697    } 
     698    else { 
     699    $archive_info->save_revinfo_gdbm($arcinfo_src_filename); 
     700    } 
     701 
    698702 
    699703##    } 
  • gsdl/trunk/perllib/plugouts/BasePlugout.pm

    r19516 r19775  
    518518 
    519519    my $working_dir  = $self->get_output_dir(); 
    520     my $working_info = $self->{output_info};  
     520    my $working_info = $self->{'output_info'};  
    521521    return if (!defined $working_info); 
    522522 
     
    722722              'index-status' => $index_status, 
    723723              'src-file' => $source_filename, 
    724               'assoc-files' => [], 
    725               'meta-files'  => [] }; 
     724              'assoc-file' => [], 
     725              'meta-file'  => [] }; 
    726726     
    727727    my $reverse_lookups = { $source_filename => "1" }; 
    728728 
    729729 
    730     $self->archiveinf_files_to_field($doc_obj->get_assoc_files(),"assoc-files", 
     730    $self->archiveinf_files_to_field($doc_obj->get_assoc_files(),"assoc-file", 
    731731                     $collect_dir,$oid_files,$reverse_lookups); 
    732732 
     
    749749#       $reverse_lookups->{$real_filename} = 1; 
    750750# 
    751 #       push(@{$oid_files->{'assoc-files'}},$full_afile); 
     751#       push(@{$oid_files->{'assoc-file'}},$full_afile); 
    752752#   } 
    753753#   else { 
     
    756756#    } 
    757757 
    758     $self->archiveinf_files_to_field($doc_obj->get_meta_files(),"meta-files", 
     758    $self->archiveinf_files_to_field($doc_obj->get_meta_files(),"meta-file", 
    759759                     $collect_dir,$oid_files,$reverse_lookups); 
    760760 
     
    768768    my $src_db = &util::filename_cat($output_dir,"archiveinf-src.gdb"); 
    769769 
    770     my $doc_db_text = ""; 
    771     $doc_db_text .= "<doc-file>$oid_files->{'doc-file'}\n"; 
    772     $doc_db_text .= "<index-status>$oid_files->{'index-status'}\n"; 
    773     $doc_db_text .= "<src-file>$oid_files->{'src-file'}\n"; 
    774  
    775     foreach my $af (@{$oid_files->{'assoc-files'}}) { 
    776     $doc_db_text .= "<assoc-file>$af\n"; 
    777     } 
    778  
    779     foreach my $mf (@{$oid_files->{'meta-files'}}) { 
    780     $doc_db_text .= "<meta-file>$mf\n"; 
    781     } 
    782  
    783     chomp($doc_db_text); # remove trailing \n 
     770#    my $doc_db_text = ""; 
     771#    $doc_db_text .= "<doc-file>$oid_files->{'doc-file'}\n"; 
     772#    $doc_db_text .= "<index-status>$oid_files->{'index-status'}\n"; 
     773#    $doc_db_text .= "<src-file>$oid_files->{'src-file'}\n"; 
     774 
     775#    foreach my $af (@{$oid_files->{'assoc-file'}}) { 
     776#   $doc_db_text .= "<assoc-file>$af\n"; 
     777#    } 
     778 
     779#    foreach my $mf (@{$oid_files->{'meta-file'}}) { 
     780#   $doc_db_text .= "<meta-file>$mf\n"; 
     781#    } 
     782 
     783#    chomp($doc_db_text); # remove trailing \n 
    784784 
    785785    ##print STDERR "*** To set in db: \n\t$doc_db\n\t$oid\n\t$doc_db_text\n"; 
    786     &GDBMUtils::gdbmDatabaseSet($doc_db,$oid,$doc_db_text); 
     786 
     787    ### &GDBMUtils::gdbmDatabaseSet($doc_db,$oid,$doc_db_text); 
     788 
     789    # switch to using GDBMUtils 
     790 
     791    $oid_files->{'doc-file'} = [ $oid_files->{'doc-file'} ]; 
     792    $oid_files->{'index-status'} = [ $oid_files->{'index-status'} ]; 
     793    $oid_files->{'src-file'} = [ $oid_files->{'src-file'} ]; 
     794 
     795    my $infodb_file_handle  
     796    = &dbutil::open_infodb_write_handle_gdbm($doc_db,"append"); 
     797    &dbutil::write_infodb_entry_gdbm($infodb_file_handle,$oid,$oid_files); 
     798    &dbutil::close_infodb_write_handle_gdbm($infodb_file_handle); 
     799 
     800 
    787801 
    788802    foreach my $rl (keys %$reverse_lookups) { 
    789     &GDBMUtils::gdbmDatabaseAppend($src_db,$rl,"<oid>$oid\n"); 
    790     } 
    791      
     803    ## &GDBMUtils::gdbmDatabaseAppend($src_db,$rl,"<oid>$oid\n");    
     804    $working_info->add_reverseinfo($rl,$oid); 
     805    }     
    792806} 
    793807