Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1553263 - [RFE] add fact name filtering during fact import
Summary: [RFE] add fact name filtering during fact import
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Fact
Version: 6.2.14
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: Unspecified
Assignee: Shimon Shtein
QA Contact: Ranjan Kumar
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-03-08 15:24 UTC by Chris Duryee
Modified: 2021-09-09 13:27 UTC (History)
11 users (show)

Fixed In Version: foreman-1.15.6.39-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1572305 (view as bug list)
Environment:
Last Closed: 2018-06-19 20:17:00 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 20929 0 Normal Closed Huge table "fact_names" makes Foreman crawl 2021-02-03 22:57:55 UTC
Red Hat Issue Tracker SAT-5015 0 None None None 2021-09-09 13:27:01 UTC
Red Hat Product Errata RHBA-2018:1950 0 None None None 2018-06-19 20:18:04 UTC

Description Chris Duryee 2018-03-08 15:24:31 UTC
Description of problem:

Satellite currently pulls in all facts reported by clients. This can lead to an extremely large (>50K) fact_names table, which can make fact import slow down. Eventually, this will lead to transaction errors logged to production.log during fact import.

For example:

 [app] [E] Fact dmi::system::uuid could not be imported because of PG::Error: ERROR:  duplicate key value violates unique constraint "index_fact_values_on_fact_name_id_and_host_id"

Version-Release number of selected component (if applicable): 6.2.14/6.3.0


How reproducible: not every time


Steps to Reproduce:
1. pull in a customer DB with a lot of fact_names
2. perform simultaneous registrations and checkins (perhaps 5 concurrent, maybe more)
3. watch for errors in production.log

Actual results: postgres errors, failed registrations


Expected results: no errors


Additional info: There are a couple of similar errors you may get. I usually see "[app] [E] Fact dmi::system::uuid could not be imported because of PG::Error: ERROR:  duplicate key value violates unique constraint "index_fact_values_on_fact_name_id_and_host_id"".

Comment 5 Satellite Program 2018-03-08 17:17:43 UTC
Upstream bug assigned to sshtein

Comment 6 Satellite Program 2018-03-08 17:17:46 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/20929 has been resolved.

Comment 17 Ranjan Kumar 2018-06-06 04:04:48 UTC
@chris

Can you please help me in 

1. Steps how to reproduce this issue? I tried to register 500 system at a time to Satellite 6.3.2 1.0 but could not found any similar error in log

2. Do i need to follow comment 7 to test this fix?

Comment 18 Chris Duryee 2018-06-08 16:38:16 UTC
(In reply to Ranjan Kumar from comment #17)
> @chris
> 
> Can you please help me in 
> 
> 1. Steps how to reproduce this issue? I tried to register 500 system at a
> time to Satellite 6.3.2 1.0 but could not found any similar error in log
> 
> 2. Do i need to follow comment 7 to test this fix?

I think comment #7 is an OK test, since it will show that the interface is filtered out.

Comment 19 Ranjan Kumar 2018-06-12 12:25:32 UTC
@chris

I tried registering 30 clients (10 in parallel) to satellite server 6.3.2.1.0 with each client having 10k facts. 

Here is script to create facts
-------
echo { >> /tmp/a.facts
for i in {1..10000}; do echo \"fact$i\": \"value$i\",; done >> /tmp/a.facts
echo } >> /tmp/a.facts
sed -zr 's/,([^,]*$)/\1/' /tmp/a.facts  > /etc/rhsm/facts/custom.facts

However, I didn't see any error mentioned in the Bugzilla.

Also, Tried comment 7 to test the fix. But i can see all the facts are listed under "net -> interface" after registration.

Here is output of hammer command
---------------------------------|----------------------------------|------
HOST                             | FACT                             | VALUE                                                                           
---------------------------------|----------------------------------|------
rhel7u4-5.gsslab.pek2.redhat.com | net::interface::dummy0                                                                                                           
rhel7u4-5.gsslab.pek2.redhat.com | net::interface::foo-veth-foo2                                                                                                    
rhel7u4-5.gsslab.pek2.redhat.com | net::interface::foo-veth-foo                                                                                                     
rhel7u4-5.gsslab.pek2.redhat.com | net::interface::foo-foo4                                                                                                         
rhel7u4-5.gsslab.pek2.redhat.com | net::interface::foo-veth-foo4                                                                                                    
rhel7u4-5.gsslab.pek2.redhat.com | net::interface::foo-foo2                                                                                                         
rhel7u4-5.gsslab.pek2.redhat.com | net::interface::foo-foo5                                                                                                         
rhel7u4-5.gsslab.pek2.redhat.com | net::interface::foo-veth-foo1                                                                                                    
rhel7u4-5.gsslab.pek2.redhat.com | net::interface::foo-veth-foo3                                                                                                    
rhel7u4-5.gsslab.pek2.redhat.com | net::interface::foo-foo3                                                                                                         
rhel7u4-5.gsslab.pek2.redhat.com | net::interface::foo-foo                                                                                                          
rhel7u4-5.gsslab.pek2.redhat.com | net::interface::foo-veth-foo5                                                                                                    
rhel7u4-5.gsslab.pek2.redhat.com | net::interface::foo-foo1   

Result truncated

Foreman version:
# rpm -qa | grep foreman
foreman-1.15.6.45-1.el7sat.noarch

I am unable to verify this bug using comment 7, let me know what to do next?

Comment 20 Chris Duryee 2018-06-12 14:09:24 UTC
re comment 19: I forgot to mention to filter for foo* in "Ignore interfaces with matching identifier" setting. I would give that a shot and register a new host to see if the interfaces show up in the fact list.

Comment 21 Mike McCune 2018-06-12 19:57:17 UTC
To filter net::interface facts coming in from subscription-manager you have to use a different notation because there is a bit of translation. The facts in subscription-manager are with dot notation, net.interface.foo, eg:

net.interface.foo-foo.mac_address: CE:44:54:F9:B8:6A

to filter these you need to use the value in the Settings as:

net.interface.foo*

eg:

[ lo, usb*, vnet*, macvtap*, _vdsmdummy_, veth*, docker*, tap*, qbr*, qvb*, qvo*, qr-*, qg-*, vlinuxbr*, vovsbr*, dummy*, net.interface.foo*]

I tested this and it worked well if you use the dot notation.

Comment 22 Ranjan Kumar 2018-06-13 06:02:12 UTC
Thaks Chris and McCune for the quick reply.

Verified! on Satellite 6.3.2 Snap 2.0

Verification Steps:
1. Built Satellite 6.3.2 Snap 2
2. Created dummy network interface on the client
   #modprobe dummy
   #ip link add name foo-veth-foo type dummy
   #ip link add name foo-foo type dummy
3. Added "net.interface.foo*" in the setting Settings -> Provisioning -> "Exclude pattern for facts stored in satellite"
4. Registerd client to satellite 
5. hammer fact list --search="host = rhel7u4-5.gsslab.pek2.redhat.com" | grep foo
   No facts found matching foo*

Detailed steps are attached

Comment 25 errata-xmlrpc 2018-06-19 20:17:00 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:1950


Note You need to log in before you can comment on or make changes to this bug.