Changeset 33392
- Timestamp:
- 2019-08-08T15:15:11+12:00 (4 years ago)
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
gs3-extensions/solr/trunk/src/perllib/solrbuilder.pm
r33372 r33392 532 532 } 533 533 else { 534 # if collect==core already in solr.xml (check with STATUS)535 # => use RELOAD call to refresh fields now expressed in schema.xml536 # 534 # if collect==core is already in solr.xml (check with STATUS) 535 # => use RELOAD* call to refresh fields now expressed in schema.xml 536 # 537 537 # else 538 538 # => use CREATE API to add to solr.xml 539 # 540 # No longer calling RELOAD, because Georgy documented a memory leak with it (svn r32178) 541 # Using unload + create to get the same effect as RELOAD without its side-effects. 542 # 539 543 540 544 my $check_core_exists = $solr_server->admin_ping_core($core); … … 545 549 } 546 550 547 548 551 print $outhandle "Creating Solr core: $core\n"; 552 $solr_server->admin_create_core($core); 549 553 550 554 } … … 690 694 print STDERR "</Stage>\n" if $self->{'gli'}; 691 695 696 697 print STDERR "@@@@@ FINISHED PROCESSING INDEX: indexlevel $self->{'index_mapping'}->{$index}\n\n"; 698 692 699 } 693 700 … … 700 707 # as this has been done in our pre_build_indexes() phase for solr 701 708 702 709 710 my $solr_server = $self->{'solr_server'}; 711 712 # 1 Aug 2019: now we unload (remove) building-cores for each index during buildcol itself 713 # instead of during activate. 714 # Kathy described a problem that when calling buildcol.pl successively without succeeding each 715 # with a call to activate, there were Win file lock issues when attempting to manually remove 716 # the building folder. This was what activate was to solve, however, there's no reason to 717 # call activate after buildcol in such cases where it is known the buildcol failed in some way. 718 # (In such cases, the user building the collection would have to manually unload the building- 719 # cores through the solr servlet interface). 720 # Dr Bainbridge instructed that the building- cores should be unloaded again at the end 721 # of buildcol. And any symmetrical step during pre-building, if any is found necessary. 722 # I'm still not sure this won't break activate in some way, for some combination, 723 # as that is meant to ensure building-cores exist whenever the building folder exists... 724 # But I was asked not to take to long on this, so I can't test all the different combinations 725 # (removeold/incremental/..., or even remote GS situation) in which building can happen and in 726 # which buildcol can be combined or not with activate, or be sequenced with further calls to 727 # buildcol, with or without -activate. 728 # So to compensate, I've tried to keep the code changes as conservative as possible to keep the chances 729 # for things going wrong to a minimum, by pinging for building-* cores before unloading them here 730 # in solrbuilder.pm (note that unload doesn't delete the index directory associated with the core) 731 # and then in activate.pl the building-* cores get pinged again to determine whether they exist 732 # before attempting to unload them there as well, since I can no longer assume the corse exist 733 # and can be unloaded. There is now the additional overhead of all the extra pinging going on, 734 # but it helps ensure we only unload building-* cores when they exist. 735 736 # Note that pre-build-indexes() was already creating the building- cores, so don't need to 737 # worry about the needed symmetry at start and end of buildcol to create building- cores 738 # in symmetry with unloading them here. 739 740 my $site = $self->{'site'}; 741 my $collect = $self->{'collection'}; 742 my $core_prefix = (defined $site) ? "$site-$collect" : $collect; 743 my $build_dir = $self->{'build_dir'}; 744 my $idx = "idx"; 745 746 foreach my $level (keys %{$self->{'levels'}}) { 747 748 my ($pindex) = $level =~ /^(.)/; 749 750 my $index_dir = $pindex.$idx; 751 my $corename = "building-$core_prefix-$index_dir"; 752 753 # unload the core if it exists. Since I can't think of exactly in which cases 754 # the building-cores exist and won't exist (e.g. removeold), I'll just always 755 # first check if the building-core exists and then unload it. 756 if ($solr_server->admin_ping_core($corename)) { 757 print STDERR "@@@@ solrbuilder::post_build_indexes(): Now unloading this index's building core: $corename\n\n"; 758 $solr_server->admin_unload_core_explicitly_retaining_index($corename) 759 } 760 761 } 762 703 763 # Also need to stop the Solr server (be it tomcat or jetty) if it was explicitly started 704 764 # in pre_build_indexes() 705 706 my $solr_server = $self->{'solr_server'};707 765 708 766 if ($solr_server->explicitly_started()) { -
gs3-extensions/solr/trunk/src/perllib/solrserver.pm
r33315 r33392 407 407 } 408 408 409 sub admin_unload_core_explicitly_retaining_index 410 { 411 # For UNLOAD core params, see page 315 of 412 # https://archive.apache.org/dist/lucene/solr/ref-guide/apache-solr-ref-guide-4.7.pdf 413 414 my $self = shift @_; 415 my ($core) = @_; 416 417 # Don't delete index (sidx/didx folder) along with unloading core, so force 0 as parameter 418 # (though not deleting the index is the default behaviour of admin_unload_core() anyway, 419 # since activate is meant to manually take care of deleting the index folder and moving the 420 # building folder to replace index, instead of activate asking unload_core to delete the 421 # index folder). 422 # But this function's very particular behaviour may be crucial for other instances such as 423 # its use in solrbuilder::post_build_indexes(), so even if admin_unload_core() could 424 # conceivably be changed to delete the index by default, this method would still do the 425 # right thing when called by solrbuilder::post_build_indexes(). 426 $self->admin_unload_core($core, 0); 427 } 428 429 409 430 sub start 410 431 { -
main/trunk/greenstone2/bin/script/activate.pl
r32178 r33392 277 277 278 278 # If the Solr/Jetty server is not already running, the following starts 279 # it up, and only returns when the server is "read ingand listening"279 # it up, and only returns when the server is "ready and listening" 280 280 $solr_server = new solrserver($build_dir); 281 281 $solr_server->start(); 282 282 283 # We'll be moving building to index. For solr collection, there's further283 # We'll be moving building to index. For a solr collection, there's further 284 284 # special processing to make a corresponding change to the solr.xml 285 285 # by removing the temporary building cores and (re)creating the index cores … … 307 307 # if solr, remove any cores that are using the index_dir before deleting this dir 308 308 foreach my $corename (@corenames) { 309 $solr_server->admin_unload_core($corename) ;309 $solr_server->admin_unload_core($corename) if ($solr_server->admin_ping_core($corename)); 310 310 } 311 311 } … … 327 327 # if solr, remove any cores that are using the building_dir before moving this dir onto index 328 328 foreach my $corename (@corenames) { 329 $solr_server->admin_unload_core("building-$corename") ;329 $solr_server->admin_unload_core("building-$corename") if ($solr_server->admin_ping_core("building-$corename")); 330 330 } 331 331 } … … 376 376 $solr_server->admin_unload_core($corename); 377 377 } 378 378 $solr_server->admin_create_core($corename, $index_dir); 379 379 380 380 }
Note:
See TracChangeset
for help on using the changeset viewer.