Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDBCProductIndex eventsUpdated leaves empty events #41

Open
jmfee-usgs opened this issue Jun 28, 2016 · 1 comment
Open

JDBCProductIndex eventsUpdated leaves empty events #41

jmfee-usgs opened this issue Jun 28, 2016 · 1 comment

Comments

@jmfee-usgs
Copy link
Contributor

When a delete product is received after an event has been archived, the eventsUpdated method does not set event attributes which prevents archiving.
https://github.com/usgs/pdl/blob/master/src/gov/usgs/earthquake/indexer/JDBCProductIndex.java#L2048

The method should set event attributes (lat/lon/time/etc) based on the deleted product, rather than leaving the event record empty. Check whether event has event-like attributes (lat/lon/time) then update everything if possible.

@jmfee-usgs
Copy link
Contributor Author

jmfee-usgs commented Jul 21, 2016

I used the following queryies to (manually) remove problem events from realtime indexes:

-- Events without products
DELETE e
FROM event e
LEFT JOIN productSummary p ON (p.eventid = e.id)
WHERE
  p.id is NULL;


-- Products without events
DELETE p
FROM productSummary p
LEFT JOIN event e ON (e.id = p.eventid)
WHERE
  p.eventid IS NOT NULL
  AND e.id is NULL;


-- Events created using deleted products
DELETE e, p
FROM event e
JOIN productSummary p ON (p.eventid = e.id)
WHERE
  e.updated IS NULL
  AND e.source IS NULL
  AND e.sourceCode IS NULL
  AND e.eventTime IS NULL
  AND e.latitude IS NULL
  AND e.longitude IS NULL
  AND e.depth IS NULL
  AND e.magnitude IS NULL
  AND (e.status IS NULL OR e.status='DELETE');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant