geonetwork / core-geonetwork

GeoNetwork is a catalog application to manage spatially referenced resources. It provides powerful metadata editing and search functions as well as an interactive web map viewer. It is currently used in numerous Spatial Data Infrastructure initiatives across the world.
http://geonetwork-opensource.org/
GNU General Public License v2.0
428 stars 489 forks source link

Harvester last run field is cleaned when the harvester is edited and saved #5718

Open josegar74 opened 3 years ago

josegar74 commented 3 years ago

Describe the bug When a harvester execution is finished, the lastRun field is stored in the harvester settings with the last execution date, but if the harvester information is updated, the field is cleaned as the harvester settings are recreated when the harvester is saved.

To Reproduce Steps to reproduce the behavior:

  1. Create a CSW harvester, save it and execute it --> Last run field is displayed properly.
  2. Edit the harvester and save it--> Last run field displays Invalid date, in the database the field no longer exists

Expected behavior I'm not really sure the usage of this field, except for convenience? The harvester history table has the last execution also, maybe can be extracted from there (an issue can happen if the harvester history is cleaned).

Otherwise, maybe to review the current harvester save code to preserve the lastRun (and potentially other harvester settings) only set up when the harvester is executed.

Screenshots After saving the harvester the last run field is cleaned, displaying a confusing information in the UI:

harvester-lastrun


The issue is in this code that recreates the harverter settings when the harvester is saved:

https://github.com/geonetwork/core-geonetwork/blob/dd0ff029a1ae5d240d72dbe025fa7db453818491/harvesters/src/main/java/org/fao/geonet/kernel/harvest/harvester/AbstractHarvester.java#L967

The lastRun information is not currently part of the CswParams used to update the harvester settings.

Maybe, it can make sense to reset that value maybe if the url or the filters change. But it's a bit confusing to display Last run as Invalid date and below the number of records harvested.

pvgenuchten commented 3 years ago

+1 to use the last date from harvest-history, in that scenario we can also evaluate if the last run was successfull (display a warning icon on the list if it was not), but what happens if someone removes harvest history? Actually no problem, because one can imagine that the last-run-date is not available anymore then