heat/heat/engine
Anant Patil 634c24ecfe Convergence: Concurrency subtle issues
To avoid certain concurrency related issues, the DB update API needs to
be given the traversal ID of the stack intended to be updated. By making
this change, we can void having following at all the places:

    if current_traversal != stack.current_traversal:
        return

The check for current traversal should be implicit, as a part of stack's
store and state_set methods, where self.current_traversal should be used
as expected traversal to be updated. All the state changes or updates in
DB to the stack object go through this implicit check (using
update...where).

When stack updates are triggered, the current traversal should be backed
up as previous traversal, a new traversal should be generated and the
stack should be stored in DB with expected traversal as the previous
traversal. This will ensure that no two updates can simultaneously
succeed on same stack with same traversal ID. This was one of our
primary goal.

Following example cases describe the issues we encounter:

1. When 2 updates, U1 and U2 try to update a stack concurrently:

    1. Current traversal(CT) is X
    2. U1 loads stack with CT=X
    3. U2 loads stack with CT=X
    4. U2 stores the stack and updates CT=Y
    5. U1 stores the stack and updates the CT=Z

    Both the updates have succeeded, and both would be running until
    one of the workers does stack.current_traversal == current_traversal
    and bail out.

    Ideally, U1 should have failed: only one should be allowed in case
    of concurrent update. When both U1 and U2 pass X as the expected
    traversal ID of the stack, then this problem is solved.

2. A resource R is being provisioned for stack with current traversal
   CT=X:

    1. An new update U is issued, it loads the stack with CT=X.
    2. Resource R fails and loads the stack with CT=X to mark it as FAILED.
    3. Update U updates the stack with CT=Y and goes ahead with sync_point
       etc., marks stack as UPDATE_IN_PROGRESS
    4. Resource marks the stack as UPDATE_FAILED, which to user means that
       update U has failed, but it actually is going on.

    With this patch, when Resource R fails, it will supply CT=X as
    expected traversal to be updated and will eventually fail because
    update U with CT=Y has taken over.

Partial-Bug: #1512343
Change-Id: I6ca11bed1f353786bb05fec62c89708d98159050
2015-11-26 09:45:49 +00:00
..
cfn Don't force Fn::Select index to integer 2015-11-20 16:17:03 +01:00
clients Fix variable 'url' referenced before assignment 2015-11-25 10:38:31 +08:00
constraint Remove iso8601 dependency 2015-09-03 16:39:54 +02:00
hot Correct list_join function 2015-11-16 15:34:24 +08:00
notification Remove deprecated list_notifier_drivers option 2015-06-01 16:56:21 +03:00
resources Convergence: Load resource stack with correct template 2015-11-26 14:05:21 +05:30
__init__.py Do not initialize anything during import phase 2013-04-24 10:03:06 -07:00
api.py Fix [H405] pep rule in heat/engine 2015-09-21 14:51:46 +03:00
attributes.py Fix [H405] pep rule in heat/engine 2015-09-21 14:51:46 +03:00
constraints.py Fix [H405] pep rule in heat/engine 2015-09-21 14:51:46 +03:00
dependencies.py Fix garbled docstrings 2015-11-10 11:12:36 -05:00
environment.py Fix HTTP error codes due to invalid templates 2015-11-20 21:27:13 -05:00
event.py Fix garbled docstrings 2015-11-10 11:12:36 -05:00
function.py Fix garbled docstrings 2015-11-10 11:12:36 -05:00
lifecycle_plugin.py Fix garbled docstrings 2015-11-10 11:12:36 -05:00
parameter_groups.py Fix garbled docstrings 2015-11-10 11:12:36 -05:00
parameters.py Fix garbled docstrings 2015-11-10 11:12:36 -05:00
plugin_manager.py Fix [H405] pep rule in heat/engine 2015-09-21 14:51:46 +03:00
properties.py Fix garbled docstrings 2015-11-10 11:12:36 -05:00
resource.py Convergence: Load resource stack with correct template 2015-11-26 14:05:21 +05:30
rsrc_defn.py Fix garbled docstrings 2015-11-10 11:12:36 -05:00
scheduler.py Fix garbled docstrings 2015-11-10 11:12:36 -05:00
service.py Merge "Fix HTTP error codes due to invalid templates" 2015-11-24 13:20:33 +00:00
service_software_config.py Use atomic_key for deployment metadata updates 2015-08-14 09:17:28 +12:00
service_stack_watch.py Fix garbled docstrings 2015-11-10 11:12:36 -05:00
stack.py Convergence: Concurrency subtle issues 2015-11-26 09:45:49 +00:00
stack_lock.py Reset stack status even when lock engine_id is None 2015-11-17 16:16:18 +13:00
support.py Validate support_status while searching resource registry 2015-08-31 10:01:04 +05:30
sync_point.py Fix [H405] pep rule in heat/engine 2015-09-21 14:51:46 +03:00
template.py Fix garbled docstrings 2015-11-10 11:12:36 -05:00
timestamp.py Fix garbled docstrings 2015-11-10 11:12:36 -05:00
update.py Allow in-place updates for all compatible types 2015-11-16 10:43:40 -05:00
watchrule.py Fix garbled docstrings 2015-11-10 11:12:36 -05:00
worker.py Convergence: Concurrency subtle issues 2015-11-26 09:45:49 +00:00