-
Notifications
You must be signed in to change notification settings - Fork 40
RHINENG-21214: split system_platform table to reflect cyndi changes #1988
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
base: master
Are you sure you want to change the base?
Conversation
|
Commits missing Jira IDs: |
Reviewer's GuideSplits the monolithic system_platform table into two partitioned tables (system_inventory and system_patch), re‑wires all foreign keys and cache/maintenance functions to use them, and exposes compatibility views for system_platform and inventory.hosts while updating test data generation to reflect newer Cyndi-scale datasets. ER diagram for split of system_platform into system_inventory and system_patcherDiagram
rh_account {
INT id PK
VARCHAR name
}
reporter {
INT id PK
}
template {
INT rh_account_id PK
BIGINT id PK
}
system_inventory {
BIGINT id PK
UUID inventory_id
INT rh_account_id FK
TEXT vmaas_json
TEXT json_checksum
TIMESTAMPTZ last_updated
TIMESTAMPTZ unchanged_since
TIMESTAMPTZ last_upload
BOOLEAN stale
TEXT display_name
INT reporter_id FK
JSONB yum_updates
TEXT yum_checksum
BOOLEAN satellite_managed
BOOLEAN built_pkgcache
BIGINT template_id FK
TEXT arch
BOOLEAN bootc
JSONB tags
TIMESTAMPTZ created
UUID insights_id
VARCHAR org_id
TEXT[] workspaces
TIMESTAMPTZ stale_timestamp
TIMESTAMPTZ stale_warning_timestamp
TIMESTAMPTZ culled_timestamp
TEXT os_name
SMALLINT os_major
SMALLINT os_minor
TEXT rhsm_version
UUID owner_id
BOOLEAN sap_workload
TEXT[] sap_workload_sids
BOOLEAN ansible_workload
TEXT ansible_workload_controller_version
BOOLEAN mssql_workload
TEXT mssql_workload_version
}
system_patch {
BIGINT system_id PK
UUID inventory_id
INT rh_account_id PK
TIMESTAMPTZ last_evaluation
INT installable_advisory_count_cache
INT installable_advisory_enh_count_cache
INT installable_advisory_bug_count_cache
INT installable_advisory_sec_count_cache
INT packages_installed
INT packages_installable
INT packages_applicable
BOOLEAN third_party
INT applicable_advisory_count_cache
INT applicable_advisory_enh_count_cache
INT applicable_advisory_bug_count_cache
INT applicable_advisory_sec_count_cache
}
system_advisories {
INT rh_account_id FK
BIGINT system_id FK
INT advisory_id FK
INT status_id
}
advisory_metadata {
INT id PK
INT advisory_type_id
}
advisory_account_data {
INT advisory_id PK
INT rh_account_id PK
INT systems_installable
INT systems_applicable
}
system_repo {
INT rh_account_id FK
BIGINT system_id FK
}
system_package2 {
INT rh_account_id FK
BIGINT system_id FK
}
inventory_hosts_view {
UUID id
VARCHAR display_name
TIMESTAMPTZ created
TIMESTAMPTZ stale_timestamp
TIMESTAMPTZ stale_warning_timestamp
TIMESTAMPTZ culled_timestamp
JSONB tags
JSONB system_profile
UUID insights_id
VARCHAR org_id
JSONB groups
}
system_platform_view {
BIGINT id
UUID inventory_id
INT rh_account_id
TEXT vmaas_json
TEXT json_checksum
TIMESTAMPTZ last_updated
TIMESTAMPTZ unchanged_since
TIMESTAMPTZ last_evaluation
INT installable_advisory_count_cache
INT installable_advisory_enh_count_cache
INT installable_advisory_bug_count_cache
INT installable_advisory_sec_count_cache
TIMESTAMPTZ last_upload
TIMESTAMPTZ stale_timestamp
TIMESTAMPTZ stale_warning_timestamp
TIMESTAMPTZ culled_timestamp
BOOLEAN stale
TEXT display_name
INT packages_installed
INT packages_installable
INT reporter_id
BOOLEAN third_party
JSONB yum_updates
INT applicable_advisory_count_cache
INT applicable_advisory_enh_count_cache
INT applicable_advisory_bug_count_cache
INT applicable_advisory_sec_count_cache
BOOLEAN satellite_managed
BOOLEAN built_pkgcache
INT packages_applicable
BIGINT template_id
TEXT yum_checksum
TEXT arch
BOOLEAN bootc
}
rh_account ||--o{ system_inventory : has
rh_account ||--o{ system_patch : has
reporter ||--o{ system_inventory : reports
template ||--o{ system_inventory : templated_by
system_inventory ||--|| system_patch : inventory_id_sync
system_inventory ||--o{ system_advisories : has
system_patch ||--o{ system_advisories : cache_for
advisory_metadata ||--o{ system_advisories : typed_by
advisory_account_data }o--o{ advisory_metadata : aggregates
system_inventory ||--o{ system_repo : repo_of
system_inventory ||--o{ system_package2 : packages_of
system_inventory ||--o{ inventory_hosts_view : exposes
system_inventory ||--o{ system_platform_view : joined_in
system_patch ||--o{ system_platform_view : joined_in
Flow diagram for system deletion and culling using new system_inventory and system_patch tablesflowchart TD
A[delete_culled_systems]
B[delete_systems]
C[delete_system]
D[(system_inventory)]
E[(system_advisories)]
F[(system_repo)]
G[(system_package2)]
H[(system_patch)]
A -->|select inventory_id where culled_timestamp < now limit delete_limit| D
D -->|inventory_ids array| B
B -->|lock rows by rh_account_id,id| D
B -->|set stale = true for selected systems| D
B -->|delete related rows| E
B -->|delete related rows| F
B -->|delete related rows| G
B -->|delete patch rows by inventory_id| H
B -->|delete systems and return count| D
C -->|select id,rh_account_id by inventory_id for update| D
C -->|mark system stale| D
C -->|delete advisories| E
C -->|delete repos| F
C -->|delete packages| G
C -->|delete patch row by rh_account_id,system_id| H
C -->|delete from system_inventory and return inventory_id| D
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
f8f6d55 to
36ae60e
Compare
Update tables that refered to system_platform to use system_inventory instead.
c37d862 to
1842124
Compare
bf8c3b4 to
80e28fb
Compare
80e28fb to
8622539
Compare
Secure Coding Practices Checklist GitHub Link
Secure Coding Checklist
Summary by Sourcery
Split the existing system_platform responsibilities into separate system_inventory and system_patch tables, introduce corresponding views and migration functions, and update references and data generation scripts to align with the new schema and cyndi-driven inventory.hosts view.
Enhancements: