Return-Path: X-Original-To: apmail-incubator-cloudstack-users-archive@minotaur.apache.org Delivered-To: apmail-incubator-cloudstack-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F34DAD3EE for ; Thu, 14 Feb 2013 09:29:31 +0000 (UTC) Received: (qmail 14554 invoked by uid 500); 14 Feb 2013 09:29:30 -0000 Delivered-To: apmail-incubator-cloudstack-users-archive@incubator.apache.org Received: (qmail 13561 invoked by uid 500); 14 Feb 2013 09:29:28 -0000 Mailing-List: contact cloudstack-users-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cloudstack-users@incubator.apache.org Delivered-To: mailing list cloudstack-users@incubator.apache.org Received: (qmail 12093 invoked by uid 99); 14 Feb 2013 09:29:27 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Feb 2013 09:29:27 +0000 X-ASF-Spam-Status: No, hits=-0.5 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of rohityadav89@gmail.com designates 74.125.83.42 as permitted sender) Received: from [74.125.83.42] (HELO mail-ee0-f42.google.com) (74.125.83.42) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Feb 2013 09:29:19 +0000 Received: by mail-ee0-f42.google.com with SMTP id b47so1099291eek.29 for ; Thu, 14 Feb 2013 01:28:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:sender:from:date:x-google-sender-auth :message-id:subject:to:cc:content-type; bh=M/rpYIsc5KSR3pwjE4SaamFc4IUuFuXlxDxpSrs/+q8=; b=Qrzrs+IRqW5+wKvcMEN1f78V2JT+4PUk5vst3R+Pwi0zG2EAmwed8bF35gCwOkLdlO 9/iJoqS/wttvf0mMnrvB3Ho1gllCW1vOYoB9x0TwB8DRTn+WK/Trwk6b9Nv+/QvNGek5 ue0vt9qW/Czvb6ZWGSkSSKbRr1O+K8tS85cjwUhc+0QH0v0A/yhfmc43C7oJ8gQFTZYx QZ/tn6+19eLh1ECWWxg//XTxZ0Udq8z0qQDScxB2vzHGXKcIOemTrF3rNjVCRIpAowVs +r8El5XhcyC8JRxEC74qV+v2rtXq+U2TWYbzU9ZE463YTJ5LLItTyF9pOnzS5k3sSe0n jm6Q== X-Received: by 10.14.173.67 with SMTP id u43mr16852750eel.22.1360834138787; Thu, 14 Feb 2013 01:28:58 -0800 (PST) MIME-Version: 1.0 Sender: rohityadav89@gmail.com Received: by 10.223.4.154 with HTTP; Thu, 14 Feb 2013 01:28:38 -0800 (PST) From: Rohit Yadav Date: Thu, 14 Feb 2013 14:58:38 +0530 X-Google-Sender-Auth: FQAUWQUInqdogXtlK3WokMIz0wM Message-ID: Subject: [PROPOSAL] DatabaseCreator: the db deployer, dbv upgrader and db cleaner To: cloudstack-dev@incubator.apache.org, cloudstack-users@incubator.apache.org Cc: alex.huang@apache.org, Abhinandan Prateek Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org Had discussions with Alex and Abhi on DatabaseCreator. I was earlier not sure why we need it or how sysadmins would use it. We had a hangout on G+: https://www.youtube.com/watch?v=Xp2AGii1szQ Let's talk about the present database deployment and the issues: - We've two different routes to deploydb, for developers it's DatabaseCreator now (used to be a maven plugin), for sysadmins it's cloudstack-setup-database - Upgrades are done by mgmt server, this has issues when there is a clustered mgmt server, i.e. multiple mgmt servers sharing the same database, we do upgrade by: a. Turn down one mgmt server, upgrade it, start it. This mgmt server checks in db the cloudstack version, upgrades the db b. Sysadmins meanwhile upgrades all the other mgmt server c. When all mgmt servers are upgraded, they ask the cluster manager to run the cleanup. The whole process is automated, an error can introduce whole sets of issues. How will DatabaseCreator help: - Would give a single tool used by both developer and sysadmins. Agony of the sysadmins would be much better understood by developers. Sysadmins would still use cloudstack-setup-database which would be wrapper around DatabaseCreator - Upgrade would be driven by sysadmin, giving them explicit power to backup database, deploy etc. For example in case of multiple (clustered) mgmt server, the upgrade would be like: a. Upgrade database using DatabaseCreator, this step do a backup and would just upgrade the db such that it's backward compatible to the old database and old mgmt servers can still run on it. When this succeeds, system can proceed. Transaction update would provide a way to rollback. b. Sysadmins would stop, upgrade and start mgmt server one by one. c. Sysadmins would run the final cleanup operation, this would do a final round of cleaning up. If everything goes well, they just did a rolling CloudStack upgrade with little to no downtime (no downtime as at least one mgmt server was running :) TODOs for 4.1: - We stick to major db version as 4.0, create-schema is not touched unless it's a major version. So, next change is to be done only for 5.0. - We move out any 4.1 changes to 4041 upgrade sql file and have a upgrade path (a upgrading logic/class). - Fix cloudstack-setup-databases, fix packaging. For 4.2/future: - Refactor out code that does upgrading in mgmt server to a separate artifact which would also have DatabaseCreator. - Implement tool so it supports the operations as discussed above - Replace the current pythonic implementation with DatabaseCreator, have same routes for both developers and sysadmins NOTE TO DEVELOPERS: - WE NEVER CHANGE create-schema.sql - WE TEST AND IMPLEMENT UPGRADE PATHS from version a to version b - WE CLEANUP PROPERLY via our upgrade sql files and upgrade classes Comments, suggestions, flames? Regards.