Bug 743426

Summary: cannot purge latest individual plugin config history item
Product: [Other] RHQ Project Reporter: Mike Foley <mfoley>
Component: Core ServerAssignee: RHQ Project Maintainer <rhq-maint>
Status: NEW --- QA Contact: Mike Foley <mfoley>
Severity: high Docs Contact:
Priority: medium    
Version: 4.1CC: hrupp, mazz
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugzilla.redhat.com/show_bug.cgi?id=743305
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Mike Foley 2011-10-04 17:29:35 EDT
Description of problem:  cannot purge individual plugin config history items

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

How reproducible:
100% ... by mazz and myself

Steps to Reproduce:
1. make any change to RHQ Agent resource's connection settings (Inventory-->Connection Settings) 
2. now go to Connection Settings History
3. try to delete the connection setting history
Actual results:

Expected results:

Additional info:
Message :	
Failed to delete the configuration history items.
Severity :	
Time :	
Tuesday, October 4, 2011 5:24:43 PM Etc/GMT+4
Detail :	
java.lang.RuntimeException:[1317763483261] javax.ejb.EJBException:javax.persistence.EntityNotFoundException: deleted entity passed to persist: [org.rhq.core.domain.configuration.Configuration#] -> javax.persistence.EntityNotFoundException:deleted entity passed to persist: [org.rhq.core.domain.configuration.Configuration#]
[1317763483261] javax.ejb.EJBException:javax.persistence.EntityNotFoundException: deleted entity passed to persist: [org.rhq.core.domain.configuration.Configuration#] -> javax.persistence.EntityNotFoundException:deleted entity passed to persist: [org.rhq.core.domain.configuration.Configuration#]
    at Unknown.java_lang_RuntimeException_$RuntimeException__Ljava_lang_RuntimeException_2Ljava_lang_RuntimeException_2(Unknown source:0)
    at Unknown.com_google_gwt_user_client_rpc_core_java_lang_RuntimeException_1FieldSerializer_instantiate__Lcom_google_gwt_user_client_rpc_SerializationStreamReader_2Ljava_lang_RuntimeException_2(Unknown source:0)
    at Unknown.com_google_gwt_user_client_rpc_impl_SerializerBase$MethodMap_$instantiate__Lcom_google_gwt_user_client_rpc_impl_SerializerBase$MethodMap_2Lcom_google_gwt_user_client_rpc_SerializationStreamReader_2Ljava_lang_String_2Ljava_lang_Object_2(Unknown source:0)
    at Unknown.com_google_gwt_user_client_rpc_impl_SerializerBase_$instantiate__Lcom_google_gwt_user_client_rpc_impl_SerializerBase_2Lcom_google_gwt_user_client_rpc_SerializationStreamReader_2Ljava_lang_String_2Ljava_lang_Object_2(Unknown source:0)
    at Unknown.com_google_gwt_user_client_rpc_impl_AbstractSerializationStreamReader_$readObject__Lcom_google_gwt_user_client_rpc_impl_AbstractSerializationStreamReader_2Ljava_lang_Object_2(Unknown source:0)
    at Unknown.com_google_gwt_user_client_rpc_impl_RequestCallbackAdapter_$onResponseReceived__Lcom_google_gwt_user_client_rpc_impl_RequestCallbackAdapter_2Lcom_google_gwt_http_client_Request_2Lcom_google_gwt_http_client_Response_2V(Unknown source:0)
    at Unknown.org_rhq_enterprise_gui_coregui_client_util_rpc_TrackingRequestCallback_onResponseReceived__Lcom_google_gwt_http_client_Request_2Lcom_google_gwt_http_client_Response_2V(Unknown source:0)
    at Unknown.com_google_gwt_http_client_Request_$fireOnResponseReceived__Lcom_google_gwt_http_client_Request_2Lcom_google_gwt_http_client_RequestCallback_2V(Unknown source:0)
    at Unknown.com_google_gwt_http_client_RequestBuilder$1_onReadyStateChange__Lcom_google_gwt_xhr_client_XMLHttpRequest_2V(Unknown source:0)
    at Unknown.anonymous(Unknown source:0)
    at Unknown.com_google_gwt_core_client_impl_Impl_entry0__Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2(Unknown source:0)
    at Unknown.anonymous(Unknown source:0)
    at Unknown.handleEvent(Unknown source:0)
    at Unknown.SJOWContentBoundary(Unknown source:0)
    at Unknown.anonymous(Unknown source:0)
Comment 1 John Mazzitelli 2011-10-04 17:31:38 EDT
I found that if I have more than one history item, I can delete one of them. But if I have only one left, I can't delete it. This might be OK (since it probably is pointing to the current config). but we should bomb out like this and we probably should not try to purge it at all if we really aren't allowing us to remove the last one. Not sure what the full issue is here, but certainly I was able to delete history items but only if it wasn't the last one left in the list.
Comment 2 John Mazzitelli 2011-10-04 17:37:43 EDT
ok, narrowed it down. It turns out this error occurs when you attempt to delete the LATEST plugin config history item.

To test:

1) go to RHQ Agent resource
2) change a plugin config (aka connection property) setting to anything
3) repeat step 2 a couple more times - get N update history items
4) Go to Inventory>ConnectionPropertyHistory and see your N history items
5) try to delete the LATEST one (see the timestamp to determine that)

notice you get an error

the buttons are probably disabled now due to the bad error. Just navigate away and then back again to this page. Now try to delete any history item that IS NOT the latest history item. You'll find you can do it successfully.

So, I think it is probably OK that we don't delete the latest history item. We are preserving the current history item in effect. HOWEVER, we should not bomb out with this ugly error. We should spit out a yellow warning message saying "you can't remove the latest update history item". We do something very similar for the RESOURCE config history list - do the same test but for resource config changes and you'll see you'll get a yellow warning saying you can't delete the current history item.
Comment 3 Mike Foley 2011-10-05 10:25:56 EDT
a restriction in the code and architecture.  should not get ugly error message.