Uploaded image for project: 'Subscription Watch'
  1. Subscription Watch
  2. SWATCH-2739

Liquibase script to remove vestigal Core/Socket measurements/buckets

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major Major
    • 2024-07-30 - API
    • None
    • None
    • 5
    • False
    • Hide

      None

      Show
      None
    • True

      The solution for SWATCH-2712 resolved the immediate bug with an exception being thrown, but the solution results in there being leftover buckets and Cores/Sockets measurements in the database during a specific use case. This can cause duplicate hosts to be returned via the Instance API, resulting in a duplicates shown in the GUI for an affected product.

       
      Nightly tally creates an rhsm host record with HBI_HOST as instance_type. It has corresponding host_tally_buckets and Cores/Sockets measurements.

      Host Records
      id instance_id instance_type
      host_id_1 instance_abc HBI_HOST
      instance_measurements
      host_id metric_id value
      host_id_1 Cores 1
      host_id_1 Sockets 1

      Event records gets created in swatch that has a timestamp after the host.last_seen timestamp. Hourly tally happens for that same instance. The host record is going to get UPDATED, and the instance_type will get set to RHEL System. Additional host_tally_buckets and instance_measurements will be created for the relevant metric_id the hourly tally is for.

      You'll have one RHEL System host record, and corresponding host_tally_buckets for Cores, Sockets, new metric_Ids.

      Host Records
      id instance_id instance_type
      host_id_1 instance_abc RHEL System
      instance_measurements
      host_id metric_id value
      host_id_1 Cores 1
      host_id_1 Sockets 1
      host_id_1 vCPUs 1

      The next nightly tally will see that there's no host for that instance with HBI_HOST instance_type, and will create an additional host record for the instance_id. That host record will get new associated host_tally_buckets and instance_measurements for Cores and Sockets again.

      The database will the contain

      Host Records
      id instance_id instance_type
      host_id_1 instance_abc RHEL System
      host_id_2 instance_abc HBI_HOST
      instance_measurements
      host_id metric_id value
      host_id_1 Cores 1
      host_id_1 Sockets 1
      host_id_1 vCPUs 1
      host_id_2 Cores 1
      host_id_2 Sockets 1

      The Cores/Sockets measurements should not be tracked with the host_id_1 id anymore, since its host record is no longer HBI_HOST.

      This liquibase should rectify those discrepancies, and result in end state of the database being something like this:

      Host Records
      id instance_id instance_type
      host_id_1 instance_abc RHEL System
      host_id_2 instance_abc HBI_HOST
      instance_measurements
      host_id metric_id value
      host_id_1 vCPUs 1
      host_id_2 Cores 1
      host_id_2 Sockets 1

              mstead@redhat.com Michael Stead
              lburnett0 Lindsey Burnett
              Aurobinda Nayak Aurobinda Nayak
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: