cloudstack-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nitin Mehta (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CLOUDSTACK-4133) hitting MySQLIntegrityConstraintViolationException for key 'i_template_spool_ref__template_id__pool_id' in case of parallel deployment
Date Thu, 08 Aug 2013 18:15:48 GMT

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

Nitin Mehta commented on CLOUDSTACK-4133:
-----------------------------------------

Alena - Fair point, that we shouldn't be facing mysql exception. But, I see that this should
be a problem across the board in CS right. There must be instances where parallel threads
are trying to create the same entry in CS (meaning for the same unique constraints, thus throwing
MySQLIntegrityConstraintViolationException). How are we solving it there - say parallel vms
trying to create the router for the same account ? How are we taking care of the race conditions
?   

I did ponder on the approaches you mentioned. The first one is not fool proof and will not
work in the race conditions as here (I guess we already do this). The second one will potentially
lock the entire template id across CS and is not performant. I was thinking of acquiring global
lock on the string combination say like "templateid:"+templateId+"poolId:"+poolId, but I have
heard from Koushik that global lock code is buggy.

Since we already take the first approach you mentioned, I see that only in corner cases of
parallel deployment will we see this exception. But even there its not hurting the functionality
and we are handling it gracefully.

Do let me know your thinking on this. Since Campo is imminent I say that we should take this
up in post 4.2 release.
                
> hitting MySQLIntegrityConstraintViolationException for key 'i_template_spool_ref__template_id__pool_id'
 in case of parallel deployment
> ---------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CLOUDSTACK-4133
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-4133
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the default.) 
>          Components: Management Server
>    Affects Versions: 4.2.0
>         Environment: xenserver advanced zone
>            Reporter: shweta agarwal
>            Assignee: Nitin Mehta
>            Priority: Critical
>             Fix For: 4.2.0
>
>         Attachments: management-server.tar.gz
>
>
> Deploying 30 VMs in Parallel on xenserver host
> getting following exception ..though not consistently 
> 2013-08-07 01:06:38,694 DEBUG [db.Transaction.Transaction] (Job-Executor-103:job-177
= [ 504ce7c1-ec29-4edb-9ef6-073c89f23f21 ]) Rolling back the transaction: Time = 11934 Name
=  -AsyncJobManagerImpl$1.run:494-Executors$RunnableAdapter.call:471-FutureTask$Sync.innerRun:334-FutureTask.run:166-ThreadPoolExecutor.runWorker:1110-ThreadPoolExecutor$Worker.run:603-Thread.run:679;
called by -Transaction.rollback:896-Transaction.removeUpTo:839-Transaction.close:663-TransactionContextBuilder.interceptException:63-ComponentInstantiationPostProcessor$InterceptorDispatcher.intercept:133-PrimaryDataStoreImpl.create:239-VolumeServiceImpl.createBaseImageAsync:387-VolumeServiceImpl.createVolumeFromTemplateAsync:538-VolumeManagerImpl.recreateVolume:2488-VolumeManagerImpl.prepare:2545-VirtualMachineManagerImpl.advanceStart:934-VirtualMachineManagerImpl.start:624
> 2013-08-07 01:06:39,552 DEBUG [agent.manager.DirectAgentAttache] (DirectAgent-197:null)
Seq 1-122749286: Response Received:
> 2013-08-07 01:06:39,553 DEBUG [agent.transport.Request] (DirectAgent-197:null) Seq 1-122749286:
Processing:  { Ans: , MgmtId: 7200344900649, via: 1, Ver: v1, Flags: 10, [{"com.cloud.agent.api.Answer":{"result":true,"wait":0}}]
}
> 2013-08-07 01:06:39,557 DEBUG [agent.transport.Request] (Job-Executor-121:job-195 = [
23b53290-6961-4913-a5ba-31fdcb453a79 ]) Seq 1-122749286: Received:  { Ans: , MgmtId: 7200344900649,
via: 1, Ver: v1, Flags: 10, { Answer } }
> 2013-08-07 01:06:39,559 DEBUG [storage.datastore.PrimaryDataStoreImpl] (Job-Executor-120:job-194
= [ cac12fea-d3ed-4764-aee5-9e292b555024 ]) Failed to insert (templateId: 202, poolId: 2)
to template_spool_ref
> javax.persistence.EntityExistsException: Entity already exists:
>         at com.cloud.utils.db.GenericDaoBase.persist(GenericDaoBase.java:1346)
>         at com.cloud.utils.component.ComponentInstantiationPostProcessor$InterceptorDispatcher.intercept(ComponentInstantiationPostProcessor.java:125)
>         at org.apache.cloudstack.storage.datastore.PrimaryDataStoreImpl.create(PrimaryDataStoreImpl.java:239)
>         at org.apache.cloudstack.storage.volume.VolumeServiceImpl.createBaseImageAsync(VolumeServiceImpl.java:387)
>         at org.apache.cloudstack.storage.volume.VolumeServiceImpl.createVolumeFromTemplateAsync(VolumeServiceImpl.java:538)
>         at com.cloud.storage.VolumeManagerImpl.recreateVolume(VolumeManagerImpl.java:2488)
>         at com.cloud.storage.VolumeManagerImpl.prepare(VolumeManagerImpl.java:2545)
>         at com.cloud.vm.VirtualMachineManagerImpl.advanceStart(VirtualMachineManagerImpl.java:934)
>         at com.cloud.vm.VirtualMachineManagerImpl.start(VirtualMachineManagerImpl.java:624)
>         at org.apache.cloudstack.engine.cloud.entity.api.VMEntityManagerImpl.deployVirtualMachine(VMEntityManagerImpl.java:227)
>         at org.apache.cloudstack.engine.cloud.entity.api.VirtualMachineEntityImpl.deploy(VirtualMachineEntityImpl.java:209)
>         at com.cloud.vm.UserVmManagerImpl.startVirtualMachine(UserVmManagerImpl.java:3408)
>         at com.cloud.vm.UserVmManagerImpl.startVirtualMachine(UserVmManagerImpl.java:2968)
>         at com.cloud.vm.UserVmManagerImpl.startVirtualMachine(UserVmManagerImpl.java:2954)
>         at com.cloud.utils.component.ComponentInstantiationPostProcessor$InterceptorDispatcher.intercept(ComponentInstantiationPostProcessor.java:125)
>         at org.apache.cloudstack.api.command.user.vm.DeployVMCmd.execute(DeployVMCmd.java:420)
>         at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:158)
>         at com.cloud.async.AsyncJobManagerImpl$1.run(AsyncJobManagerImpl.java:531)
>         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
>         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
>         at java.util.concurrent.FutureTask.run(FutureTask.java:166)
>         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:679)
> Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException:
Duplicate entry '202-2' for key 'i_template_spool_ref__template_id__pool_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:532)
>                                                                                     
  

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message