Fixed duplicate id error when creating VM work jobs#3871
Conversation
|
@blueorangutan package |
|
@blueorangutan package |
|
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
As this is clearly a bug, can you target 4.13 please, @Spaceman1984 ? |
DaanHoogland
left a comment
There was a problem hiding this comment.
code lgtm, @richardlawley can you test this patch?
|
Tageting 4.13 @DaanHoogland |
56dd2ea to
77c1064
Compare
|
@blueorangutan package |
|
@Spaceman1984 a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✖centos6 ✖centos7 ✔debian. JID-783 |
|
I don't have an easy way to test this, but the fix looks suitable. |
|
Packaging result: ✖centos6 ✔centos7 ✔debian. JID-785 |
|
@blueorangutan test |
|
@DaanHoogland a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
Trillian test result (tid-927)
|
|
@blueorangutan package |
|
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✖centos6 ✖centos7 ✔debian. JID-822 |
GabrielBrascher
left a comment
There was a problem hiding this comment.
Thanks for the PR @Spaceman1984, code LGTM (I have not tested it though).
This PR removes related VMWorkjob records when the async_job table is cleaned out. Fixes: apache#3829
AsyncJobManager contains code to expunge async job records after a configurable time (24h default). Some async jobs have corresponding vm_work_job entries, which are created using the generated key of async_job. The expunge code only removes the async_job record, leaving dangling vm_work_job rows. Because the supported version of mysql recalculates autonumber sequences based on the last current row, this can cause async jobs to be created with IDs referencing existing rows in vm_work_job, which causes a primary key violation if this clashes, showing the following log message: Unable to schedule async job for command com.cloud.vm.VmWorkStart, unexpected exception. javax.persistence.EntityExistsException: Entity already exists apache#3829 apache#3871
AsyncJobManager contains code to expunge async job records after a configurable time (24h default). Some async jobs have corresponding vm_work_job entries, which are created using the generated key of async_job. The expunge code only removes the async_job record, leaving dangling vm_work_job rows. Because the supported version of mysql recalculates autonumber sequences based on the last current row, this can cause async jobs to be created with IDs referencing existing rows in vm_work_job, which causes a primary key violation if this clashes, showing the following log message: Unable to schedule async job for command com.cloud.vm.VmWorkStart, unexpected exception. javax.persistence.EntityExistsException: Entity already exists apache#3829 apache#3871
Description
This PR removes related VMWorkjob records when the async_job table is cleaned out.
Fixes: #3829
Types of changes
Screenshots (if appropriate):
How Has This Been Tested?
This was tested by taking these steps: