Ignore:
Timestamp:
2016-05-09T16:53:48+12:00 (8 years ago)
Author:
ak19
Message:

Fixing incremental-rebuild when the database is gdbm. At this point (see buildcolutils.pm), the code needs to deactivate the collection before calling make_infodatabase(), since otherwise there's a lock on the gdbm database which prevents successful incremental-rebuild and activation.

Location:
main/trunk/greenstone2/perllib
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/DBDrivers/BaseDBDriver.pm

    r30370 r30517  
    5757    $self->{'supports_persistentconnection'} = 0;
    5858    $self->{'supports_rss'} = 0;
     59    $self->{'supports_concurrent_read_and_write'} = 0;
    5960    $self->{'supports_set'} = 0;
    6061    $self->{'write_only'} = 0; # Some drivers are one way - i.e. STDOUTXML
     
    383384
    384385
     386## @function supportsConcurrentReadAndWrite(void)  => integer
     387#
     388sub supportsConcurrentReadAndWrite
     389{
     390    my $self = shift(@_);
     391    return $self->{'supports_concurrent_read_and_write'};
     392}
     393## supportsConcurrentReadAndWrite(void) => integer ##
     394
     395
    385396## @function supportsSet(void) => integer
    386397#
  • main/trunk/greenstone2/perllib/DBDrivers/JDBM.pm

    r30370 r30517  
    5050    my $self = DBDrivers::70HyphenFormat->new(@_);
    5151    $self->{'default_file_extension'} = 'jdb';
     52    $self->{'supports_concurrent_read_and_write'} = 1;
    5253
    5354    # Executables need a little extra work since we are using Java
  • main/trunk/greenstone2/perllib/basebuilder.pm

    r28567 r30517  
    397397}
    398398
     399# By default, builders do support make_infodatabase()
     400sub supports_make_infodatabase {
     401    return 1;
     402}
    399403
    400404
  • main/trunk/greenstone2/perllib/buildcolutils.pm

    r29096 r30517  
    674674    #   processor [jmt12]
    675675    map { local $_=$_; $_->build_indexes($indexname, $indexlevel); } @builders;
    676     map { local $_=$_; $_->make_infodatabase(); }  @builders;
     676
     677    # when incrementally rebuilding a collection using a gdbm database, need to
     678    # deactivate the collecitob before make_infodatabase()
     679    map {
     680    local $_=$_;
     681
     682    if($_->supports_make_infodatabase()) {
     683        my $infodbtype = $_->{'infodbtype'};
     684        my $dbSupportsConcurrentRW = &dbutil::supportsConcurrentReadAndWrite($infodbtype);
     685   
     686        if(!$dbSupportsConcurrentRW) {
     687        #$self->{'justdeactivate'} = 1;
     688        #$self->activate_collection();
     689        #$self->{'justdeactivate'} = 0;
     690        $self->activate_collection("just_deactivate");     
     691        }
     692        $_->make_infodatabase();       
     693    }
     694
     695    }  @builders;
     696
    677697    map { local $_=$_; $_->collect_specific(); } @builders;
    678698  }
     
    759779sub activate_collection
    760780{
    761   my $self = shift(@_);
     781  my $self = shift(@_); 
     782  my $activation_cmd = shift(@_);
     783  my($just_activate, $just_deactivate);
     784  if(defined $activation_cmd) {
     785      $just_deactivate = 1 if($activation_cmd eq "just_deactivate");
     786      $just_activate = 1 if($activation_cmd eq "just_activate");
     787      if($activation_cmd eq "just_deactivate_and_activate") {
     788      $just_deactivate = 1;
     789      $just_activate = 1;
     790      }
     791  }
     792
    762793  # if buildcol.pl was run with -activate, need to run activate.pl
    763794  # now that building's complete
     
    773804    push(@activate_argv, '-keepold') if ($self->{'keepold'});
    774805    push(@activate_argv, '-incremental') if ($self->{'incremental'});
     806    push(@activate_argv, '-justactivate') if ($just_activate || $self->{'justactivate'});
     807    push(@activate_argv, '-justdeactivate') if ($just_deactivate || $self->{'justdeactivate'});
    775808    my $quoted_argv = join(' ', map { "\"$_\"" } @activate_argv);
    776809    my $activatecol_cmd = '"' . &util::get_perl_exec(). '" -S activate.pl ' . $quoted_argv . ' "' . $self->get_collection() . '"';
  • main/trunk/greenstone2/perllib/dbutil.pm

    r30489 r30517  
    532532
    533533
     534## @function supportsConcurrentReadAndWrite(string)  => boolean
     535#
     536sub supportsConcurrentReadAndWrite
     537{
     538    my $infodb_type = shift(@_);
     539    my $driver = _loadDBDriver($infodb_type);
     540    return $driver->supportsConcurrentReadAndWrite();
     541}
     542## supportsConcurrentReadAndWrite(string) => boolean ##
     543
     544
    534545## @function write_infodb_entry(string, *) => void
    535546#
  • main/trunk/greenstone2/perllib/extrabuilder.pm

    r24462 r30517  
    113113}
    114114
     115# for now, orthogonalbuilder subclasses don't support/require make_infodatabase()
     116sub supports_make_infodatabase {
     117    return 0;
     118}
     119
    115120sub make_infodatabase {
    116121    my $self = shift (@_);
  • main/trunk/greenstone2/perllib/inexport.pm

    r30489 r30517  
    12841284        if ($existing_f =~ m/^$situated_dir/) {
    12851285
    1286         print STDERR "**** Existing file $existing_f\nis located within\n$situated_dir\n";
     1286#       print STDERR "**** Existing file $existing_f\nis located within\n$situated_dir\n";
    12871287
    12881288        push(@$reindex_files,$existing_f);
Note: See TracChangeset for help on using the changeset viewer.