I am following the thread, I remember when I had this issue, I believe I added the service and then was able to delete it. See if you can try to add the component with API and then try to delete the service.
On Sun, May 17, 2015 at 1:10 PM, Alejandro Fernandez < [email protected]> wrote: > Hi Eirik, you can try deleting from the database directly. > There will be several tables related to service configs. > > First stop ambari-server, take a database dump, then run > > DELETE FROM hostcomponentdesiredstate WHERE service_name = 'STORM'; > DELETE FROM hostcomponentstate WHERE service_name = 'STORM'; > DELETE FROM servicecomponentdesiredstate WHERE service_name = 'STORM'; > DELETE FROM servicedesiredstate WHERE service_name = 'STORM'; > DELETE FROM clusterservices WHERE service_name = 'STORM'; > > DELETE FROM hostconfigmapping WHERE service_name = 'STORM'; > DELETE FROM hostgroup_configuration WHERE type_name IN ('storm-env', > 'storm-site'); > > DELETE FROM serviceconfigmapping WHERE config_id IN (select config_id FROM > clusterconfig WHERE type_name IN ('storm-env', 'storm-site')); > DELETE FROM serviceconfighosts WHERE service_config_id IN (select > config_id FROM clusterconfig WHERE type_name IN ('storm-env', > 'storm-site')); > DELETE FROM serviceconfig WHERE service_name = 'STORM'; > DELETE FROM clusterconfigmapping where type_name IN ('storm-env', > 'storm-site'); > > DELETE FROM configgrouphostmapping WHERE config_group_id IN (SELECT > group_id FROM configgroup WHERE tag = 'STORM' or service_name = 'STORM'); > DELETE FROM confgroupclusterconfigmapping WHERE config_group_id IN (SELECT > group_id FROM configgroup WHERE tag = 'STORM' or service_name = 'STORM'); > > DELETE FROM configgroup WHERE tag = 'STORM' or service_name = 'STORM'; > DELETE FROM clusterconfig WHERE type_name IN ('storm-env', 'storm-site'); > > > Thanks, > Alejandro Fernandez > > On 5/17/15, 8:09 AM, "Eirik Thorsnes" <[email protected]> wrote: > > >Hi, > > > >I turned on postgresql logging and tried to delete entire service, it > >fails and rolls back, see below. > > > >Thanks, > >Eirik > > > >=========== > > > >date; curl -i -u admin:admin -X DELETE -H 'X-Requested-By: ambari' > >http://localhost:8080/api/v1/clusters/helm/services/STORM > >Sun May 17 17:02:29 CEST 2015 > >HTTP/1.1 500 Transaction rolled back because transaction was set to > >RollbackOnly. > >Set-Cookie: AMBARISESSIONID=1a9unoldhj0p7a3rj3jik6cm;Path=/ > >Content-Type: text/plain;charset=ISO-8859-1 > >Content-Length: 104 > >Server: Jetty(7.6.7.v20120910) > > > >{ > > "status": 500, > > "message": "Transaction rolled back because transaction was set to > >RollbackOnly." > > > >=============== > > > ><2015-05-17 17:02:29 CEST - 5558ac05.14a6-1/1350> LOG: execute > ><unnamed>: SELECT user_id, active, create_time, ldap_user, user_name, > >user_password, principal_id FROM users WHERE ((LOWER(user_name) = $1) > >AND (ldap_user = $2)) > ><2015-05-17 17:02:29 CEST - 5558ac05.14a6-1/1350> DETAIL: parameters: > >$1 = 'admin', $2 = '0' > ><2015-05-17 17:02:29 CEST - 5558ac05.14a6-1/1351> LOG: execute > ><unnamed>: SELECT member_id, group_id, user_id FROM members WHERE > >(user_id = $1) > ><2015-05-17 17:02:29 CEST - 5558ac05.14a6-1/1351> DETAIL: parameters: > >$1 = '1' > ><2015-05-17 17:02:29 CEST - 5558ac05.14a6-1/1352> LOG: execute > ><unnamed>: SELECT privilege_id, permission_id, principal_id, resource_id > >FROM adminprivilege WHERE (principal_id IN ($1)) > ><2015-05-17 17:02:29 CEST - 5558ac05.14a6-1/1352> DETAIL: parameters: > >$1 = '4' > ><2015-05-17 17:02:29 CEST - 5558ac05.14a6-1/1353> LOG: execute > ><unnamed>: BEGIN > ><2015-05-17 17:02:29 CEST - 5558ac05.14a6-1/1353> LOG: execute > ><unnamed>: DELETE FROM servicedesiredstate WHERE ((cluster_id = $1) AND > >(service_name = $2)) > ><2015-05-17 17:02:29 CEST - 5558ac05.14a6-1/1353> DETAIL: parameters: > >$1 = '2', $2 = 'STORM' > ><2015-05-17 17:02:29 CEST - 5558ac05.14a6-1/1353> LOG: execute > ><unnamed>: DELETE FROM clusterservices WHERE ((cluster_id = $1) AND > >(service_name = $2)) > ><2015-05-17 17:02:29 CEST - 5558ac05.14a6-1/1353> DETAIL: parameters: > >$1 = '2', $2 = 'STORM' > ><2015-05-17 17:02:29 CEST - 5558ac05.14a6-1/1353> ERROR: update or > >delete on table "clusterservices" violates foreign key constraint > >"srvccmponentdesiredstatesrvcnm" on table "servicecomponentdesiredstate" > ><2015-05-17 17:02:29 CEST - 5558ac05.14a6-1/1353> DETAIL: Key > >(service_name,cluster_id)=(STORM,2) is still referenced from table > >"servicecomponentdesiredstate". > ><2015-05-17 17:02:29 CEST - 5558ac05.14a6-1/1353> STATEMENT: DELETE > >FROM clusterservices WHERE ((cluster_id = $1) AND (service_name = $2)) > ><2015-05-17 17:02:29 CEST - 5558ac05.14a6-1/0> ERROR: current > >transaction is aborted, commands ignored until end of transaction block > ><2015-05-17 17:02:29 CEST - 5558ac05.14a6-1/0> STATEMENT: SELECT 1 > ><2015-05-17 17:02:29 CEST - 5558ac05.14a6-1/0> LOG: execute S_2: ROLLBACK > > > >
