skip index without events

refs: CNVS-13987

Found some index records that cannot find a related audit event.  We
were skipping the index records that could not acquire a relevant key so
we should just skip these as well.

Test Plan:
  - Create a corrupted login event using the examples from g/37605.
  - In cqlsh, delete a record in the auditors table so the index records
    cannot reference back to the event record.
  - Run the data fixup.
  - Should complete successfully.

Change-Id: I475515ab0907901af026146af51e1590a962ee0a
Reviewed-on: https://gerrit.instructure.com/41837
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nick Cloward <ncloward@instructure.com>
This commit is contained in:
Nick Cloward 2014-09-26 10:38:40 -06:00
parent 237fc34cd3
commit 3596811afd
1 changed files with 5 additions and 1 deletions

View File

@ -252,9 +252,13 @@ module DataFixup
current_id, timestamp, key = extract_row_keys(index, row)
event = events[current_id]
# An index record might exist without a related event.
# Just skip this for now.
next unless event
# If the event is a corrupted event we have already fixed it so save
# the mapping and move along.
if event.event_type == 'corrupted'
if event.event_type == CORRUPTED_EVENT_TYPE
store_corrected_id(current_id, timestamp, current_id)
next
end