PILLUTLAAVINASH / google-enterprise-connector-manager

Automatically exported from code.google.com/p/google-enterprise-connector-manager
0 stars 0 forks source link

Allow empty Schedule #135

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Currently, Schedule does not allow the timeIntervals to null or empty.  It
throws illegal argument exceptions from numerous places in the code if an
empty schedule is encountered.

Now that we have the concept of a disabled schedule, we should also allow
no schedule.  I could automatically disable a schedule that specifies no
time intervals.

I don't know if GSAs will barf when given a schedule string without
timeIntervals.  If it does, I can modify the legacySchedule generator to
supply "1-1".

Original issue reported on code.google.com by Brett.Mi...@gmail.com on 31 Mar 2009 at 9:18

GoogleCodeExporter commented 8 years ago
Related to this logging should be fixed so the situation where the Connector 
doesn't 
have a schedule isn't logged over and over.  Right now logs can fill up with 
the 
message related to this situation since the related work item is always checked 
against the current schedule.  Either don't check it over and over or don't log 
it 
more than once.

Original comment by mgron...@gmail.com on 7 Apr 2009 at 6:50

GoogleCodeExporter commented 8 years ago
I already addressed the "Schedule not found" problem in Issue 133.
From that change:

"Finally, if on startup, a connector does not have a schedule and
none was found in a legacy store, I create a disabled schedule and
log a warning.  This is better than spamming the log file with
'Connector Schedule not found' messages once a second."

Original comment by Brett.Mi...@gmail.com on 7 Apr 2009 at 7:02

GoogleCodeExporter commented 8 years ago

Original comment by mgron...@gmail.com on 6 May 2009 at 11:00

GoogleCodeExporter commented 8 years ago
Chris noticed that the "Schedule not found" message still appears for 
connectors that have been created 
with no schedule - and persists until a restart (after which the Issue 133 fix 
kicks in).  The real solution was 
to allow a connector to have no traversal schedule.  We are seeing more complex 
installation where some 
connector instances are devoted to Authorization of search results and don't 
index at all.

I did a bit of experimenting, and determined the GSA can handle NULL schedule 
strings and empty 
traversalTimeIntervals.  The only problem I encountered was a failure to delete 
the last remaining schedule 
line in the Connector Admin Console.   Marty did some spelunking in the GSA 
codebase and found:

On May 5, 2009 8:06:16 PM PDT, Marty Gronberg wrote:

Basically the code does not handle clearing out the Schedule.  When the "Save 
Configuration" button is 
pressed with all the schedule lines checked as deleted it passes an empty 
string 'timeIntervals' into the 
following block of code:

if (timeIntervals != null && timeIntervals.length() > 1) {
    ConnectorMessageCode cmCode = client.setSchedule(connectorName, connectorLoad, timeIntervals);
     ......
}

So if you delete all the lines of the schedule the Servlet treats that like 
there's no Schedule and it will not 
call the Admin Servlet to set the schedule.  Seems broken - it should check 
previous state to notice that 
there was a schedule an there is no more.

However, there's no problem if you create a Connector with no schedule.  It 
handles that fine, both during 
the creating and later for editing.

In addition, here's what I have observed:

1) While you are creating a new connector you are allowed to delete the last 
line of the schedule, thus 
creating a Connector with no schedule.  This doesn't seem to present any 
problems for the GSA to later edit 
the Connector.

2) If you have a Connector with no schedule specified when it was created and 
you later edit it, you don't 
need to add a schedule.

3) If you have a Connector with no schedule specified when it was created and 
you later edit it, you can add 
a schedule line.

4) If you have a Connector with any number of schedule lines, and you edit it, 
you are not allowed to delete 
the last schedule line.

Hope that helps.  Let me know if you need anything else.

    Marty

----

So the UI allows you to delete the last line of the schedule, but doesn't 
communicate that to the Connector 
Manager.  So the next time the GSA requests schedule information from the CM, 
it returns the old schedule.  So we filed a GSA Bug 1835259 to allow the last 
schedule line to be deleted.

Original comment by Brett.Mi...@gmail.com on 7 May 2009 at 5:36

GoogleCodeExporter commented 8 years ago
Fixed 07 May 2009 in Connector Manager revision r1910 : 

The Connector Manager Schedule and TraversalScheduler code
went to great lengths to ensure that the Schedule was never
null or that the traversalTimeIntervals were not empty,
throwing IllegalArgumentExceptions left and right, and spamming
the log file with 'Schedule not found' messsages once a second.

The GSA supports connectors with no schedules or no traversal
intervals, so the strong restrictions in the Connector Manager
made little sense.  Removing the restrictions was largely
mechanical and sometimes less than elegant, but certainly
more elegant than enforcing the severe restrictions.

The one snag I ran into was that I couldn't mainting a
null schedule indefinitely.  During a restart of the
Connector Manager, if no schedule is found in the persistent
store, the CM will look through all the legacy stores assuming
that this is an upgrade scenerio.  Here, the  Issue 133  fix comes
forward, creating a disabled schedule with no timeIntervals.

Testing:
-------
Passes all unit tests.  Schedules that ar null or have empty
timeIntervals were tested on GSA 5.0.4, 5.2.5, 6.0 beta.

Change Log:
----------
M  source/java/com/google/enterprise/connector/scheduler/Schedule.java
   - No-argument constructor now creates a disabled schedule
     with no time intervals (rather than 1am-1am time interval).
   - Allow null schedule string, empty schedule string, and empty
     timeIntervals.
   - For convenience of using for-each loops, Schedule.getTimeIntervals()
     will always return a List, although it might be empty.

M  source/java/com/google/enterprise/connector/scheduler/TraversalScheduler.java
   - Skip connectors that have a null Schedule when building
     the list of Schedules to run.

M  source/javatests/com/google/enterprise/connector/scheduler/ScheduleTest.java
   - Enhanced testing of schedules with and without timeIntervals.
   - Additional testing of several invalid schedule string formats.

Original comment by Brett.Mi...@gmail.com on 10 May 2009 at 4:35

GoogleCodeExporter commented 8 years ago

Original comment by Brett.Mi...@gmail.com on 16 May 2009 at 9:13