rackerlabs/qonos — pull request #277 by venkateshsampath (2014-01-17 15:35:50+00:00)
Title: Fix duplicate scheduled images

This patch fixes the issue of the same job sometimes being picked up by
two workers when polling for jobs concurrently.

- In order to avoid the concurrency issue, the sqlalchemy's optimistic
locking feature is used.
more info:
http://docs.sqlalchemy.org/en/rel_0_7/orm/mapper_config.html?highlight=uuid#sqlalchemy.orm.mapper
- Based on optimistic locking feature, a new column 'version_id' is
introduced in 'jobs' table that will allow versioning of records when
in use.
- Because of versioning of job records when accessed, if two workers try
to pick up/update the same job, a StaleDataError will be thrown and
hence prevent the duplication of scheduled images.

related to rm1348