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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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() . '"';
Note: See TracChangeset for help on using the changeset viewer.