Ignore:
Timestamp:
2019-02-28T22:00:57+13:00 (5 years ago)
Author:
ak19
Message:

Second and final part of fixing up OAI stuff so that there's no lock on the index db by OAI servlet side when a collection is being rebuilt. The bug was that the OAI servlet side would still keep a filelock on the db (index col db and etc oai-inf db, to be precise) when a collection was deactivated before moving build to index during the activate.pl stage. That's because the OAIMessageRouter does not responde to (de)activate messages sent to the regular library servlet's MessageRouter. This commit: Getting servercontrol.pm of activate.pl to send a request to (de)activate a collection to the OAIMessageRouter was far more involved: although OAIMessageRouter inherits from MessageRouter, it did not recognise the (de)activate query params because it specifically only recognises OAI verbs like Identify and the special case of 'reset' sent to the OAIMessageRouter. So added in pathways for activate and deactivate to be recognised and processed. Now servercontrol.pm will send (de)activate requests to both the MessageRouter and the OAIMessageRouter. And there's further support for if a collection is not an OAICollection (not part of the list of collections maintained by OAIReceptionist). What I don't have working, is that the collection is still enumerated by ListSets of the OAI servlet whereas attempting to view records and identifiers of the deactivated set fails. This misbehaviour doesn't impact rebuilding with activate.pl since it both deactivates then activates a collection, so a collection is not meant to remain in the deactivated state. The fix may be more complicated than removing the collection from OAIReceptionist's list of sets, since the OAI side deals with supercollections etc when it first loads OAICollections. So any fix has to take that into account.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/servercontrol.pm

    r32826 r32830  
    117117sub config {
    118118    my $self = shift(@_);
    119     my ($command, $check_message_against_regex, $expected_error_code, $silent) = @_;
     119    my ($command, $check_message_against_regex, $expected_error_code, $silent, $oai_servlet) = @_;
    120120
    121121    my $library_url = $self->get_library_URL(); #$self->{'library_url'};
    122 
     122    if($oai_servlet) { # if asked to contact the oaiserver servlet, then
     123        # replace the library servlet name with oaiserver servlet name
     124        $library_url =~ s@([^/]*?)$@$oai_servlet@;
     125    }
    123126
    124127    # Gatherer.java's configGS3Server doesn't use the site variable
     
    279282    }
    280283    elsif ($gs_mode eq "gs3") {
     284    $self->print_msg("\t- Main library servlet\n");
    281285    my $DEACTIVATE_COMMAND = "?a=s&sa=d&st=collection&sn=";
    282286    my $check_message_against_regex = "collection: $qualified_collection deactivated";
    283287    $self->config($DEACTIVATE_COMMAND.$qualified_collection, $check_message_against_regex);
     288   
     289    # and deactivate the collection on OAIserver url too.
     290    # NOTE: if it's not an OAI collection, then the message that the collection is "not enabled for OAI" is EXPECTED. Another possible valid outcome.
     291    $self->print_msg("\t- OAI servlet\n"); 
     292    $DEACTIVATE_COMMAND = "?deactivate=";
     293    $check_message_against_regex = "(collection\: $qualified_collection deactivated|collection\: $qualified_collection is not enabled for OAI.)";
     294    $self->config($DEACTIVATE_COMMAND.$qualified_collection, $check_message_against_regex, undef, undef, "oaiserver");
    284295    }   
    285296}
     
    297308    }
    298309    elsif ($gs_mode eq "gs3") {
     310    $self->print_msg("\t- Main library servlet\n");
    299311    my $ACTIVATE_COMMAND = "?a=s&sa=a&st=collection&sn=";
    300312    my $check_message_against_regex = "collection: $qualified_collection activated";
    301313    $self->config($ACTIVATE_COMMAND.$qualified_collection, $check_message_against_regex);
     314   
     315    # and activate the collection on OAIserver url too.
     316    # NOTE: if it's not an OAI collection, then the message that the collection is "not enabled for OAI" is EXPECTED. Another possible valid outcome.
     317    $self->print_msg("\t- OAI servlet\n"); 
     318    $ACTIVATE_COMMAND = "?activate=";
     319    $check_message_against_regex = "(collection\: $qualified_collection activated|collection\: $qualified_collection is not enabled for OAI.)";
     320    $self->config($ACTIVATE_COMMAND.$qualified_collection, $check_message_against_regex, undef, undef, "oaiserver");
    302321    }   
    303322}
     
    544563sub config_old {
    545564    my $self = shift(@_);
    546     my ($command, $check_message_against_regex, $expected_error_code, $silent) = @_;
     565    my ($command, $check_message_against_regex, $expected_error_code, $silent, $oai_servlet) = @_;
    547566
    548567    my $library_url = $self->get_library_URL(); #$self->{'library_url'};
    549 
     568    if($oai_servlet) { # if asked to contact the oaiserver servlet, then
     569        # replace the library servlet name with oaiserver servlet name
     570        $library_url =~ s@([^/]*?)$@$oai_servlet@;
     571    }
    550572
    551573    # Gatherer.java's configGS3Server doesn't use the site variable
Note: See TracChangeset for help on using the changeset viewer.