Uploaded image for project: 'Red Hat 3scale API Management'
  1. Red Hat 3scale API Management
  2. THREESCALE-3785

ActiveRecord::RecordNotUnique while destroying tenants (but the tenant and its hierarchy is destroyed)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major Major
    • None
    • None
    • System
    • None
    • 3
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Engineering
    • 3scale 2019-10-14, 3scale 2019-10-28, 3scale 2019-11-11, 3scale 2019-11-25, 3scale 2019-12-09, 3scale 2019-12-23, 3scale 2020-01-13, 3scale 2020-01-27, 3scale 2020-02-03, 3scale 2020-02-17, 3scale 2020-03-09, 3scale 2020-03-23

      When I destroy tenants in preview (I do not know if it is only a preview thing or also related to production because I didn't have time to investigate about this), I regularly see the following error in the logs, although the tenant gets destroyed aftet the hierarchy chain:

      {"_aj_globalid"=>"gid://system/ServiceContract/1409617817692"}, ["Hierarchy-Account-2445582574503", "Hierarchy-ServiceContract-1409617817692"], "destroy"
      ActiveRecord::RecordNotUnique: Mysql2::Error: Duplicate entry '245-6' for key 'index_mail_dispatch_rules_on_system_operation_id_and_account_id':
      INSERT INTO `mail_dispatch_rules` (`system_operation_id`...
      

      I attach the whole logs (I think it is complete in this file).

      Dev Notes

      If we can avoid accessing the MailDispatchRules, knowing that we are gonna delete the whole tenant, that's better. If not, we may be stuck in an 'infinite' loop in the find_or_create for a race condition, in that case, we may have to add a lock to only access it once at the same time.

              Unassigned Unassigned
              mnoyabon Marta Noya (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: