Hide Forgot
Description of problem: It's taking 1 create and 5 saves to mongo to add 1 php app Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. Create a php app 2. 3. Actual results: 1 create and 5 saves occur Expected results: Should be 1 create Additional info:
I am making the sev/priority a med. I think this needs to be addressed.
Here are the saves elaborated: /usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/lib/cloud/sdk/mongo_data_store.rb:51:in `save'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-common-0.4.4/lib/cloud-sdk-common/models/user_model.rb:50:in `save'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/app/models/application.rb:100:in `save'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/app/models/application.rb:144:in `create'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/app/controllers/legacy_broker_controller.rb:174 MongoDataStore.save(Application, danmcp270, danmcp270c, #hidden) /usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/lib/cloud/sdk/mongo_data_store.rb:51:in `save'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-common-0.4.4/lib/cloud-sdk-common/models/user_model.rb:50:in `save'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/app/models/application.rb:100:in `save'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/app/models/application.rb:209:in `configure_dependencies'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/app/controllers/legacy_broker_controller.rb:175:in `cartridge_post' MongoDataStore.save(Application, danmcp270, danmcp270c, #hidden) /usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/lib/cloud/sdk/mongo_data_store.rb:51:in `save'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-common-0.4.4/lib/cloud-sdk-common/models/user_model.rb:50:in `save'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/app/models/application.rb:100:in `save'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/app/models/application.rb:219:in `configure_dependencies'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/app/models/application.rb:967:in `call'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/app/models/application.rb:967:in `run_on_gears'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/app/models/application.rb:965:in `each'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/app/models/application.rb:965:in `run_on_gears'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/app/models/application.rb:216:in `configure_dependencies'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/app/models/application.rb:212:in `each'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/app/models/application.rb:212:in `configure_dependencies'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/app/controllers/legacy_broker_controller.rb:175:in `cartridge_post' MongoDataStore.save(Application, danmcp270, danmcp270c, #hidden) /usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/lib/cloud/sdk/mongo_data_store.rb:51:in `save'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-common-0.4.4/lib/cloud-sdk-common/models/user_model.rb:50:in `save'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/app/models/application.rb:100:in `save'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/app/models/application.rb:219:in `configure_dependencies'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/app/models/application.rb:967:in `call'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/app/models/application.rb:967:in `run_on_gears'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/app/models/application.rb:965:in `each'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/app/models/application.rb:965:in `run_on_gears'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/app/models/application.rb:216:in `configure_dependencies'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/app/models/application.rb:212:in `each'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/app/models/application.rb:212:in `configure_dependencies'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/app/controllers/legacy_broker_controller.rb:175:in `cartridge_post' MongoDataStore.save(Application, danmcp270, danmcp270c, #hidden) /usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/lib/cloud/sdk/mongo_data_store.rb:51:in `save'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-common-0.4.4/lib/cloud-sdk-common/models/user_model.rb:50:in `save'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/app/models/application.rb:100:in `save'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/app/models/application.rb:249:in `configure_dependencies'/usr/lib/ruby/gems/1.8/gems/cloud-sdk-controller-0.4.6/lib/cloud-sdk-controller/app/controllers/legacy_broker_controller.rb:175:in `cartridge_post' MongoDataStore.save(Application, danmcp270, danmcp270c, #hidden)
Save happens twice only now. Can be reduced to once, but we are unwilling to give the responsibility of save to controller. Checkin#a6edc97847022ca96f6fe3df20c455f0f203c30b
Not sure I follow the argument in comment 3. At a fundamental level can you explain why we can't have only 1 create call when adding an app?
I am in the same boat. I agree that we should have 1 create/save call. Had a discussion with Krishna earlier, and the reason of the current state of affairs is that we re-use the configure function for creating as well as modifying the app. So, the configure function does the 'save' as well. App creation has the extra step of 'create' for creation of gears first time around. We should definitely remove this in future, but as of today it exists because we have the backward compatibility scenario where the app-uuid is matched with the first-gear's uuid. Also, to hold the premise that haproxy gear should get the app-uuid (client tools manufacture the git urls from app uuid)... we do some special handling the first time around. Krishna and I have brainstormed over how to decide from the descriptor itself that which component gets the first gear etc... no conclusion to that discussion yet. Lets keep the bug open until we fix this into one create/save call. Should not be a blocking bug to any story though.
Verified this bug with devenv_stage_139, and PASS. Now only 1 save is seen when creating app. /var/www/libra/broker/log/development.log: Started POST "/broker/userinfo" for 66.187.233.202 at Thu Mar 01 06:05:08 -0500 2012 Processing by LegacyBrokerController#user_info_post as Parameters: {"json_data"=>"{\"api\":\"1.1.2\",\"rhlogin\":\"jialiu\"}", "password"=>"[FILTERED]"} User-Agent = '' MongoDataStore.find(CloudUser, jialiu, jialiu) Completed 200 OK in 53ms (Views: 1.7ms) Started POST "/broker/cartridge" for 66.187.233.202 at Thu Mar 01 06:05:10 -0500 2012 Processing by LegacyBrokerController#cartridge_post as Parameters: {"json_data"=>"{\"cartridge\":\"php-5.3\",\"action\":\"configure\",\"api\":\"1.1.2\",\"node_profile\":\"std\",\"app_name\":\"phptest\",\"rhlogin\":\"jialiu\"}", "password"=>"[FILTERED]"} User-Agent = '' MongoDataStore.find(CloudUser, jialiu, jialiu) Checking to see if application name is black listed Auto-merging group @@app/cart-php-5.3 into @@app Creating gears DEBUG: find_available_impl: district_uuid: 22f87c9801a4456e89f831a6d84b5ff2 DEBUG: rpc_get_fact: fact=active_capacity DEBUG: rpc_exec: rpc_client=#<MCollective::RPC::Client:0x7fbdcb7222f8> Next server: ip-10-111-5-15 active capacity: 0.0 Current server: ip-10-111-5-15 active capacity: 0.0 Next server: domU-12-31-39-0F-8A-52 active capacity: 0.0 Current server: ip-10-111-5-15 active capacity: 0.0 CURRENT SERVER: ip-10-111-5-15 DEBUG: find_available_impl: current_server: ip-10-111-5-15: 0.0 MongoDataStore.reserve_district_uid(22f87c9801a4456e89f831a6d84b5ff2) DEBUG: rpc_exec_direct: rpc_client=#<MCollective::RPC::Client:0x7fbdcbcf4a28> DEBUG: rpc_client.custom_request('cartridge_do', {:cartridge=>"cloud-sdk-node", :args=>"--with-app-uuid '6fb985294b8449acb0e1fa62a05eca74' --with-container-uuid '6fb985294b8449acb0e1fa62a05eca74' -i '1013'", :action=>"app-create"}, ip-10-111-5-15, {'identity' => ip-10-111-5-15}) DEBUG: [#<MCollective::RPC::Result:0x7fbdcbb57ff8 @agent="libra", @results={:statuscode=>0, :sender=>"ip-10-111-5-15", :data=>{:output=>"", :exitcode=>0}, :statusmsg=>"OK"}, @action="cartridge_do">] MongoDataStore.create(Application, jialiu, phptest, {"display_name"=>"phptest-0.0-noarch", "vendor"=>"unknown", "description"=>"", "requires"=>[], "default_profile"=>"default", "group_override_map"=>{}, "comp_instances"=> [{"parent_cart_name"=>"phptest", "group_instance_name"=>"@@app", "dependencies"=>["@@app/cart-php-5.3"], "exec_order"=>["@@app/cart-php-5.3"], "name"=>"@@app", "parent_cart_group"=>"default", "parent_cart_profile"=>"default", "cart_data"=>[], "parent_component_name"=>"default"}, {"parent_cart_name"=>"php-5.3", "group_instance_name"=>"@@app/cart-php-5.3", "dependencies"=>[], "exec_order"=>[], "name"=>"@@app/cart-php-5.3", "parent_cart_group"=>"default", "parent_cart_profile"=>"default", "cart_data"=>[], "parent_component_name"=>"default"}], "version"=>"0.0", "architecture"=>"noarch", "node_profile"=>"std", "name"=>"phptest", "scalable"=>false, "profiles"=> [{"connections"=>[], "groups"=> [{"component_refs"=>[{"component"=>"default", "name"=>"default"}], "name"=>"default", "generated"=>true, "scaling"=>{"max"=>-1, "min"=>1}}], "provides"=>[], "name"=>"default", "generated"=>true, "stop_order"=>[], "configure_order"=>[], "group_overrides"=>{}, "components"=> [{"subscribes"=> [{"required"=>false, "type"=>"FILESYSTEM:doc-root", "name"=>"doc-root"}], "depends"=>[], "publishes"=>[], "name"=>"default", "generated"=>true, "depends_service"=>[]}], "start_order"=>[]}], "license"=>"unknown", "configure_order"=>["@@app/cart-php-5.3", "@@app"], "creation_time"=>"2012-03-01T06:05:10-05:00", "uuid"=>"6fb985294b8449acb0e1fa62a05eca74", "requires_feature"=>["php-5.3"], "conn_endpoints_list"=> [{"from_connector"=> {"required"=>false, "type"=>"FILESYSTEM:doc-root", "name"=>"get-doc-root"}, "from_comp_inst"=>"@@app/cart-php-5.3", "to_connector"=> {"required"=>false, "type"=>"FILESYSTEM:doc-root", "name"=>"doc-root"}, "to_comp_inst"=>"@@app"}], "group_instances"=> [{"group_name"=>"default", "component_instances"=>["@@app", "@@app/cart-php-5.3"], "gears"=> [{"configured_components"=>[], "uid"=>1013, "node_profile"=>"std", "server_identity"=>"ip-10-111-5-15", "group_instance_name"=>"@@app/cart-php-5.3", "uuid"=>"6fb985294b8449acb0e1fa62a05eca74"}], "cart_name"=>"php-5.3", "name"=>"@@app/cart-php-5.3", "reused_by"=>["@@app", "@@app/cart-php-5.3"], "profile_name"=>"default"}], "provides_feature"=>[], "conflicts_feature"=>[], "start_order"=>["@@app/cart-php-5.3", "@@app"]} ) MongoDataStore.create(Application, jialiu, phptest, #hidden) Configure order is ["@@app/cart-php-5.3", "@@app"] DEBUG: rpc_exec_direct: rpc_client=#<MCollective::RPC::Client:0x7fbdcb88ec68> DEBUG: rpc_client.custom_request('cartridge_do', {:cartridge=>"php-5.3", :args=>"'phptest' 'jialiu' '6fb985294b8449acb0e1fa62a05eca74'", :action=>"preconfigure"}, ip-10-111-5-15, {'identity' => ip-10-111-5-15}) DEBUG: [#<MCollective::RPC::Result:0x7fbdcb7cde78 @agent="libra", @results={:statuscode=>0, :sender=>"ip-10-111-5-15", :data=>{:output=>"", :exitcode=>0}, :statusmsg=>"OK"}, @action="cartridge_do">] DEBUG: rpc_exec_direct: rpc_client=#<MCollective::RPC::Client:0x7fbdcb7bc8f8> DEBUG: rpc_client.custom_request('cartridge_do', {:cartridge=>"php-5.3", :args=>"'phptest' 'jialiu' '6fb985294b8449acb0e1fa62a05eca74'", :action=>"configure"}, ip-10-111-5-15, {'identity' => ip-10-111-5-15}) DEBUG: [#<MCollective::RPC::Result:0x7fbdcbd2f0b0 @agent="libra", @results={:statuscode=>0, :sender=>"ip-10-111-5-15", :data=>{:output=>"Initialized empty Git repository in /var/lib/libra/6fb985294b8449acb0e1fa62a05eca74/git/phptest.git/\n/var/lib/libra/6fb985294b8449acb0e1fa62a05eca74/git/phptest.git /tmp\n/tmp\n", :exitcode=>0}, :statusmsg=>"OK"}, @action="cartridge_do">] MongoDataStore.save(Application, jialiu, phptest, #hidden) DEBUG: rpc_exec_direct: rpc_client=#<MCollective::RPC::Client:0x7fbdcbca3268> DEBUG: rpc_client.custom_request('cartridge_do', {:cartridge=>"cloud-sdk-node", :args=>"--with-app-uuid '6fb985294b8449acb0e1fa62a05eca74' --with-container-uuid '6fb985294b8449acb0e1fa62a05eca74' -s 'AAAAB3NzaC1yc2EAAAADAQABAAABAQDSv44aEPcObZkAN5VI8XHW23b7JL0wBftkPwtXwHF6ppxnvpIhQNyBy5crHWGrigEOGLsJWH7hmo/rfkELuhfpdaGIB582AAJ5Eeug+Fv7yQFQodCafALhh/piXXnJ7xsnFpy6Pz5OVuxC2nRoew8oqSIjKaHTdjzuSPNRviEKLTypcREtnQp7nCCTDm3NFjaM40tDA3/i9m708qViQHv5tqkdyrfLMu5Lq+oJMrzP911aCn3F0GTc+T/cUC/R2ay5wLhv9FT+eTrDSOsMFt9BZYFT+mfSyIJhaGuxB7OUQ3qf4RRMo+0hGINRSLldFtRaZiQUyqw6nKPR460MfgMN' -t 'ssh-rsa' -m '-default'", :action=>"authorized-ssh-key-add"}, ip-10-111-5-15, {'identity' => ip-10-111-5-15}) DEBUG: [#<MCollective::RPC::Result:0x7fbdcbb27c90 @agent="libra", @results={:statuscode=>0, :sender=>"ip-10-111-5-15", :data=>{:output=>"", :exitcode=>0}, :statusmsg=>"OK"}, @action="cartridge_do">] DEBUG: DYNECT Login with path: /REST/Session/ DEBUG: DYNECT Response: {"status": "success", "data": {"token": "KAJLPB/mLLREPzM31xYPMmrnMiKMyjId8dB8XTMSZnL0QFXnORZHNbK0GcQAHbrZN08uFspE0XHyjxmMlm2rRYpZJc4flrMt/YZ3Mv6yBsdeCIOTpqRyQzzO/1tnFq1Q76omGCZ5ke8t61eXCGUUS+LEJbaJbpvN", "version": "3.3.1"}, "job_id": 70783358, "msgs": [{"INFO": "login: Login successful", "SOURCE": "BLL", "ERR_CD": null, "LVL": "INFO"}]} DEBUG: DYNECT Response data: version3.3.1tokenKAJLPB/mLLREPzM31xYPMmrnMiKMyjId8dB8XTMSZnL0QFXnORZHNbK0GcQAHbrZN08uFspE0XHyjxmMlm2rRYpZJc4flrMt/YZ3Mv6yBsdeCIOTpqRyQzzO/1tnFq1Q76omGCZ5ke8t61eXCGUUS+LEJbaJbpvN DEBUG: Public ip being configured 'ec2-184-73-117-151.compute-1.amazonaws.com' to app 'phptest' DEBUG: DYNECT put/post with path: /REST/CNAMERecord/rhcloud.com/phptest-jialiu.dev.rhcloud.com/ json data: {"ttl":"60","rdata":{"cname":"ec2-184-73-117-151.compute-1.amazonaws.com"}} and headers: {"Content-Type"=>"application/json", "Auth-Token"=>"KAJLPB/mLLREPzM31xYPMmrnMiKMyjId8dB8XTMSZnL0QFXnORZHNbK0GcQAHbrZN08uFspE0XHyjxmMlm2rRYpZJc4flrMt/YZ3Mv6yBsdeCIOTpqRyQzzO/1tnFq1Q76omGCZ5ke8t61eXCGUUS+LEJbaJbpvN"} DEBUG: DYNECT Response: {"status": "success", "data": {"zone": "rhcloud.com", "ttl": 60, "fqdn": "phptest-jialiu.dev.rhcloud.com", "record_type": "CNAME", "rdata": {"cname": "ec2-184-73-117-151.compute-1.amazonaws.com."}, "record_id": 0}, "job_id": 70783359, "msgs": [{"INFO": "add: Record added", "SOURCE": "BLL", "ERR_CD": null, "LVL": "INFO"}]} DEBUG: DYNECT Response data: rdatacnameec2-184-73-117-151.compute-1.amazonaws.com.record_typeCNAMErecord_id0ttl60fqdnphptest-jialiu.dev.rhcloud.comzonerhcloud.com DEBUG: DYNECT put/post with path: /REST/Zone/rhcloud.com/ json data: {"publish":"true"} and headers: {"Content-Type"=>"application/json", "Auth-Token"=>"KAJLPB/mLLREPzM31xYPMmrnMiKMyjId8dB8XTMSZnL0QFXnORZHNbK0GcQAHbrZN08uFspE0XHyjxmMlm2rRYpZJc4flrMt/YZ3Mv6yBsdeCIOTpqRyQzzO/1tnFq1Q76omGCZ5ke8t61eXCGUUS+LEJbaJbpvN"} DEBUG: DYNECT Response: {"status": "success", "data": {"zone_type": "Primary", "serial_style": "increment", "serial": 390052, "zone": "rhcloud.com"}, "job_id": 70783360, "msgs": [{"INFO": "publish: rhcloud.com published", "SOURCE": "BLL", "ERR_CD": null, "LVL": "INFO"}]} DEBUG: DYNECT Response data: serial390052zone_typePrimaryzonerhcloud.comserial_styleincrement DEBUG: DYNECT delete with path: /REST/Session/ and headers: {"Content-Type"=>"application/json", "Auth-Token"=>"KAJLPB/mLLREPzM31xYPMmrnMiKMyjId8dB8XTMSZnL0QFXnORZHNbK0GcQAHbrZN08uFspE0XHyjxmMlm2rRYpZJc4flrMt/YZ3Mv6yBsdeCIOTpqRyQzzO/1tnFq1Q76omGCZ5ke8t61eXCGUUS+LEJbaJbpvN"} DEBUG: DYNECT Response: {"status": "success", "data": {}, "job_id": 70783362, "msgs": [{"INFO": "logout: Logout successful", "SOURCE": "BLL", "ERR_CD": null, "LVL": "INFO"}]} DEBUG: DYNECT Response data: Completed 200 OK in 11678ms (Views: 1.6ms)
Its 1 create and 1 save. We plan to reduce this to 1 create only.
According to Comment 5 and Comment 7, this bug need further fix. Will change bug status as Assigned. Thanks.
Cannot fix until all cli-tools start using new REST apis and stop constructing URLs by themselves. Today, the cli-tools construct the git urls using the app uuid. This may not be valid anymore with scalable apps. As soon as this is done, the two steps of create/update to mongo can be reduced to one. User Story for this is already in the backlog : US2067
Since this is not fixed, and have a user story to track it, then I think we should close it as upstream but not move it to ON_QA.