Skip to content

Augmenter: Fresh the parent record when a child record is created or deleted...

In issue694, it reports that the parent record was not refreshed when a child record is created or deleted in the parent child relationship.

We analyzed the root cause for these two issues:

  1. The parent record was not updated to include the child record info when a child record is created.
    When a record is sent to ElasticSearch for indexing, there is a few seconds to tens of seconds delay on ElasticSearch for new record to be searchable. The time between a record is sent to ElasticSearch and the Augmenter chasing routing is triggered is very short which is in millisecond level. In order to update the parent record to include the new child record information, it has two prerequisites:
  • The id of the parent record can be retrieved from the child record so a re-index message for the parent record can be sent out.
    To do that, the MR makes use of the existing cache of the new child record.
  • The child record information should be available when the re-index message of the parent record is processed.
    To do that, we can't make use of the existing cache of the new child record as the re-index message of the parent record does not have the child id. Augmenter has information about how to search all the child records for given parent record id. However, the time between the child record sent to ElasticSearch and the re-index message of the parent record received is also very short (< 100 ms if the indexer message queue is empty). To make sure that the augmenter can search all the child records for given parent record id, we can set enough delays for the re-index message of the parent record to be received and processed. In this MR, the delay is set to 30 seconds which is a experienced trade-off between the latency of refresh and reliability of required information.
  1. The parent record was not updated to remove the child record info when a child record is deleted.
    In order to remove the new child record information from its parent records, we need to know the ids of the parent records in order to send out the re-index message to re-index the parent records. When the Augmenter chasing routing is called, the deleted child record is not searchable from ElasticSearch anymore. In this MR, we keep a copy of the deleted child records in order to retrieve the ids of the parent records and send out the re-index message.

Merge request reports

Loading