Fwd: Manual add from CLI lead to duplicate resources

Thomas Segismont tsegismo at redhat.com
Thu Feb 20 14:59:09 UTC 2014


Le 20/02/2014 15:48, Jay Shaughnessy a écrit :
>
> On 2/18/2014 8:18 AM, Thomas Segismont wrote:
>> Le 17/02/2014 21:39, Jay Shaughnessy a écrit :
>>>
>>> That seems pretty strange.   Did you end up with 800 resources (the
>>> number I see in the script) and you're missing some, or did you get more
>>> than 800; the expected resources plus duplicates?  Duplicates, of
>>> course, should not happen.  It is disallowed to have the same resource
>>> key multiple times under the same parent.  So, this could be a serious
>>> issue.
>>>
>>
>> I stopped the script before so I can't say. I ran it again today,
>> running on Postgres this time. I got less of those duplicates (just one).
>>
>>> Any interesting agent log messages?
>>
>> No, nothing :(
>>
>> I thought we we had some foreign key constraint for the duplicate
>> resource key case. Shouldn't we add one? I will add the constraint
>> locally and try again. Maybe we'll see which execution flow persists
>> the duplicate.
>>
>
> It is allowed, and expected, to have resources with the same resource
> key.  They just can't be under the same parent.  Although for figuring
> out what is happening it may be a good way to flush things out.

Sure, I was talking about duplicate resource key with siblings as well.

>
>>>
>>> When the script completes are the duplicates only in the server
>>> inventory, or also on the agent?
>>
>> Only on the server. Attached is the inventory export. I also ran this
>> query:
>>
>> select r1.*
>> from rhq_resource r1
>> where
>> exists(
>> select 1 from rhq_resource r2
>> where
>> r1.resource_key = r2.resource_key
>> and r1.parent_resource_id = r2.parent_resource_id
>> and r1.id <> r2.id
>> )
>>
>> Results are in the "duplicates.csv" file
>
> I'm going to try to reproduce and investigate this today...

Great. Let me known if you any question around the script itself.

Thanks,
Thomas


More information about the rhq-devel mailing list