cloudstack-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Prachi Damle (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CLOUDSTACK-7590) Deletion of Account is not deleting the account from the database
Date Tue, 11 Nov 2014 00:50:34 GMT

    [ https://issues.apache.org/jira/browse/CLOUDSTACK-7590?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14205701#comment-14205701
] 

Prachi Damle commented on CLOUDSTACK-7590:
------------------------------------------

Root cause of this issue is this fix: https://issues.apache.org/jira/browse/CLOUDSTACK-7073
We have added a unique constraint on the user table on username and domainId

So the databases prior to 4.5, which allowed the duplicate usernames will fail to upgrade
to 4.5 due to this schema change.
Also, traditionally we have the 'removed' column in the DB to mark a user as removed, and
no unique constraint allowing us to add another user with same name.

We need to revert https://issues.apache.org/jira/browse/CLOUDSTACK-7073.

Fix for https://issues.apache.org/jira/browse/CLOUDSTACK-7073 should be done through java
code.

> Deletion of Account is not deleting the account from the database
> -----------------------------------------------------------------
>
>                 Key: CLOUDSTACK-7590
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-7590
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the default.) 
>          Components: Management Server
>    Affects Versions: 4.5.0
>            Reporter: Chandan Purushothama
>            Assignee: Prachi Damle
>            Priority: Critical
>             Fix For: 4.5.0
>
>
> Deletion of account marks the account as removed in the database but doesnt remove the
record from the database as shown below:
> <noformat>
> mysql> select * from account where removed is not null \G
> *************************** 1. row ***************************
>              id: 7
>    account_name: CSRegularVPNClientUser
>            uuid: 96e06a77-fa96-4e38-b380-023d406d445e
>            type: 0
>       domain_id: 1
>           state: enabled
>         removed: 2014-09-20 00:33:41
>  cleanup_needed: 0
>  network_domain: NULL
> default_zone_id: NULL
>         default: 0
> 1 row in set (0.00 sec)
> mysql>
> *If anyone wants to recreate the account with the same name. It fails with the below
exception:*
> {noformat}
> 2014-09-20 00:27:05,880 DEBUG [c.c.u.AccountManagerImpl] (catalina-exec-11:ctx-bfa880b6
ctx-e82baf36 ctx-1b71100c) Creating user: CSRegularVPNClientUser, accountId: 6 timezone:null
> 2014-09-20 00:27:05,882 DEBUG [c.c.u.d.T.Transaction] (catalina-exec-11:ctx-bfa880b6
ctx-e82baf36 ctx-1b71100c) Rolling back the transaction: Time = 16 Name =  catalina-exec-11;
called by -TransactionLegacy.rollback:902-TransactionLegacy.removeUpTo:845-TransactionLegacy.close:669-TransactionContextInterceptor.invoke:36-ReflectiveMethodInvocation.proceed:161-ExposeInvocationInterceptor.invoke:91-ReflectiveMethodInvocation.proceed:172-JdkDynamicAopProxy.invoke:204-$Proxy67.persist:-1-AccountManagerImpl.createUser:1962-AccountManagerImpl$2.doInTransaction:1039-AccountManagerImpl$2.doInTransaction:1027
> 2014-09-20 00:27:05,898 ERROR [c.c.a.ApiServer] (catalina-exec-11:ctx-bfa880b6 ctx-e82baf36
ctx-1b71100c) unhandled exception executing api command: [Ljava.lang.String;@5b4cfa82
> javax.persistence.EntityExistsException: Entity already exists:
>         at com.cloud.utils.db.GenericDaoBase.persist(GenericDaoBase.java:1398)
>         at com.cloud.user.dao.UserDaoImpl.persist(UserDaoImpl.java:141)
>         at com.cloud.user.dao.UserDaoImpl.persist(UserDaoImpl.java:33)
>         at sun.reflect.GeneratedMethodAccessor105.invoke(Unknown Source)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:601)
>         at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
>         at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
>         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
>         at com.cloud.utils.db.TransactionContextInterceptor.invoke(TransactionContextInterceptor.java:34)
>         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
>         at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
>         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
>         at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>         at $Proxy67.persist(Unknown Source)
>         at com.cloud.user.AccountManagerImpl.createUser(AccountManagerImpl.java:1962)
>         at com.cloud.user.AccountManagerImpl$2.doInTransaction(AccountManagerImpl.java:1039)
>         at com.cloud.user.AccountManagerImpl$2.doInTransaction(AccountManagerImpl.java:1027)
>         at com.cloud.utils.db.Transaction$2.doInTransaction(Transaction.java:49)
>         at com.cloud.utils.db.Transaction.execute(Transaction.java:37)
>         at com.cloud.utils.db.Transaction.execute(Transaction.java:46)
>         at com.cloud.user.AccountManagerImpl.createUserAccount(AccountManagerImpl.java:1027)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:601)
>         at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
>         at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
>         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
>         at org.apache.cloudstack.network.contrail.management.EventUtils$EventInterceptor.invoke(EventUtils.java:106)
>         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
>         at com.cloud.event.ActionEventInterceptor.invoke(ActionEventInterceptor.java:51)
>         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
>         at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
>         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
>         at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>         at $Proxy103.createUserAccount(Unknown Source)
>         at org.apache.cloudstack.api.command.admin.account.CreateAccountCmd.execute(CreateAccountCmd.java:178)
>         at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:141)
>         at com.cloud.api.ApiServer.queueCommand(ApiServer.java:694)
>         at com.cloud.api.ApiServer.handleRequest(ApiServer.java:517)
>         at com.cloud.api.ApiServlet.processRequestInContext(ApiServlet.java:273)
>         at com.cloud.api.ApiServlet$1.run(ApiServlet.java:117)
>         at org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:56)
>         at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:103)
>         at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:53)
>         at com.cloud.api.ApiServlet.processRequest(ApiServlet.java:114)
>         at com.cloud.api.ApiServlet.doGet(ApiServlet.java:76)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
>         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
>         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555)
>         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
>         at org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:889)
>         at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:721)
>         at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:2268)
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>         at java.lang.Thread.run(Thread.java:722)
> Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException:
Duplicate entry 'CSRegularVPNClientUser-1' for key 'username_domain_id'
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
>         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>         at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
>         at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
>         at com.mysql.jdbc.Util.getInstance(Util.java:386)
>         at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1040)
>         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3597)
>         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3529)
>         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1990)
>         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2151)
>         at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2625)
>         at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119)
>         at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2415)
>         at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2333)
>         at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2318)
>         at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
>         at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
>         at com.cloud.utils.db.GenericDaoBase.persist(GenericDaoBase.java:1363)
>         ... 64 more
> </noformat>
> 2014-09-20 00:27:05,903 DEBUG [c.c.a.ApiServlet] (catalina-exec-11:ctx-bfa880b6 ctx-e82baf36
ctx-1b71100c) ===END===  10.216.51.74 -- GET  username=CSRegularVPNClientUser&domainid=67a6f7dc-4047-11e4-9e25-5a8ae31eab72&firstname=CSRegularVPNClientUser&lastname=CSRegularVPNClientUser&email=test-S5XWMF%40cloudstack.org&apiKey=aAAdPAVcNDNlYRtqsu7zxXQB2RNLd7yuDxjiOk4W9w3pGAiHcOmrhQahv16pqaMy43aDgadlTMO-qGrlTOc2Gw&command=createAccount&accounttype=0&signature=Ii0C7t5A3WlRoe04tAEBvtWjB0U%3D&response=json
> 2014-09-20 00:27:06,042 DEBUG [c.c.a.ApiServlet] (catalina-exec-14:ctx-e289f9f7) ===START===
 10.216.51.74 -- GET  username=CSRegularVPNClientUser&apiKey=aAAdPAVcNDNlYRtqsu7zxXQB2RNLd7yuDxjiOk4W9w3pGAiHcOmrhQahv16pqaMy43aDgadlTMO-qGrlTOc2Gw&command=listUsers&signature=XjS0FiZp3Q7QoT%2BxxPZN1%2BKtlEc%3D&response=json&listall=True
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message