-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/45872/
-----------------------------------------------------------

(Updated April 11, 2016, 9:59 a.m.)


Review request for Ambari, Sumit Mohanty and Vitalyi Brodetskyi.


Bugs: AMBARI-15762
    https://issues.apache.org/jira/browse/AMBARI-15762


Repository: ambari


Description
-------

**Problem**  
Ambari executes component installs in parallel on a host. Each install process
in the post-install phase executes certain shared/common configuration
directory related steps (stacks/HDP/2.0.6/hooks/after-
INSTALL/scripts/shared_initialization.py:link_configs() -> ... -> /resource_ma
nagement/libraries/functions/conf_select.py:convert_conf_directories_to_symlin
ks() ) on the directories listed in conf_select.py:PACKAGE_DIRS

The common configuration directory related processing fail in they are kicked
of in the same time for the same directory.

In the case the following code snippet is executed in the same time by
multiple component installs  
each will see the `backup_dir` as non existent and will try to execute the
"cp" command. One will succeed while the others fail.

    
    
    
    Execute(("cp", "-R", "-p", old_conf, backup_dir),  not_if = format("test -e 
{backup_dir}"), sudo = True)
    

Similar behaviour is seen for the following code snippet:

    
    
    
    Execute(as_sudo(["cp", "-R", "-p", os.path.join(old_conf, "*"), 
versioned_conf], auto_escape=False), only_if = format("ls -d {old_conf}/*"))
    

**Possible solution**  
Use the linux "lockfile" command or "mkdir /var/lock/mylock" (see example of
the mkdir solution here: <http://wiki.bash-hackers.org/howto/mutex>)


Diffs (updated)
-----

  ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py 
6c1a161 
  ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py 
e08e2f7 
  ambari-agent/src/test/python/resource_management/TestFcntlBasedProcessLock.py 
PRE-CREATION 
  
ambari-common/src/main/python/resource_management/libraries/functions/fcntl_based_process_lock.py
 PRE-CREATION 
  
ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/params.py
 68fe9f9 
  
ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/shared_initialization.py
 8ee2f7a 

Diff: https://reviews.apache.org/r/45872/diff/


Testing
-------

mvn clean test


Thanks,

Andrew Onischuk

Reply via email to