Ignore:
Timestamp:
2012-06-28T21:25:18+12:00 (12 years ago)
Author:
ak19
Message:

Second set of commits for getting activate.pl to deal with solr cores when moving building to index. This time it uses the building- prefix and things still work. However, if the GS3 server is already running, an ant restart is required before searches return results and not sure about whether the incremental case is covered properly. The index reason is still being created for some reason when building.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/bin/script/activate.pl

    r25888 r25889  
    601601   
    602602    if($removeold) {
    603 
    604         if ($buildtype eq "solr") {
    605         # if solr, remove any cores using the index_dir before deleting this dir
    606         foreach my $corename (@corenames) {
    607             $solr_server->admin_unload_core($corename);
    608         }
    609         }   
    610603       
    611604        if(&util::dir_exists($index_dir)) {
    612605            &print_task_msg("Removing \"index\"");
     606
     607            if ($buildtype eq "solr") {
     608                # if solr, remove any cores that are using the index_dir before deleting this dir
     609                foreach my $corename (@corenames) {
     610                $solr_server->admin_unload_core($corename);
     611                }
     612            }   
     613
    613614            &util::rm_r($index_dir);
    614615           
     
    624625        # the collection at this point since activate.pl lives on the server side
    625626       
     627        if ($buildtype eq "solr") {
     628            # if solr, remove any cores that are using the building_dir before moving this dir onto index
     629            foreach my $corename (@corenames) {
     630            $solr_server->admin_unload_core("building-$corename");
     631            }
     632        }
     633
    626634        # Move the building directory to become the new index directory
    627635        &print_task_msg("Moving \"building\" -> \"index\"");
     
    632640    }
    633641    elsif ($keepold) {
    634             if ($buildtype eq "solr") {
    635             # if solr, remove any cores using the index_dir before deleting this dir
     642            if ($buildtype eq "solr") { ### no building- prefix for keepold incremental case?
     643            # if solr, remove any cores that may be using the building_dir before moving this dir onto index
    636644            foreach my $corename (@corenames) {         
    637             $solr_server->admin_unload_core($corename);
     645            $solr_server->admin_unload_core("building-$corename") if $solr_server->admin_ping_core("building-$corename");
    638646            }
    639647        }
     
    646654   
    647655    if ($buildtype eq "solr") {
    648     # Call CREATE action to get the old cores pointing to the index folder
     656    # Call CREATE action to get all cores pointing to the index folder, since building is now index
     657    ### Should already be using the index_dir directory for $keepold (incremental) case? Then call RELOAD CORE
    649658    foreach my $corename (@corenames) {
    650         $solr_server->admin_create_core($corename, $index_dir);
     659        if($removeold) {
     660        $solr_server->admin_create_core($corename, $index_dir);
     661        } elsif ($keepold) {
     662        $solr_server->admin_reload_core($corename);
     663        }
    651664    }
    652665
Note: See TracChangeset for help on using the changeset viewer.