You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vb...@apache.org on 2013/12/26 12:47:50 UTC
git commit: AMBARI-4175. ambari-server reset does not work for MySQL
as Ambari DB.(vbrodetskyi)
Updated Branches:
refs/heads/trunk 8c277cb55 -> 6f38b1bdb
AMBARI-4175. ambari-server reset does not work for MySQL as Ambari DB.(vbrodetskyi)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6f38b1bd
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6f38b1bd
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6f38b1bd
Branch: refs/heads/trunk
Commit: 6f38b1bdb5bff8b1a8fa485ec268a1340d6e727e
Parents: 8c277cb
Author: Vitaly Brodetskyi <vb...@hortonworks.com>
Authored: Thu Dec 26 13:47:02 2013 +0200
Committer: Vitaly Brodetskyi <vb...@hortonworks.com>
Committed: Thu Dec 26 13:47:02 2013 +0200
----------------------------------------------------------------------
ambari-server/src/main/python/ambari-server.py | 7 +++++--
ambari-server/src/main/resources/Ambari-DDL-MySQL-DROP.sql | 1 +
2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/6f38b1bd/ambari-server/src/main/python/ambari-server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari-server.py b/ambari-server/src/main/python/ambari-server.py
index 9ec00a1..6482cd5 100755
--- a/ambari-server/src/main/python/ambari-server.py
+++ b/ambari-server/src/main/python/ambari-server.py
@@ -309,9 +309,10 @@ DATABASE_CLI_TOOLS_USAGE = ['su -postgres --command=psql -f {0} -v username=\'"{
'sqlplus {1}/{2} < {0} ',
'mysql --user={1} --password={2} {3}<{0}']
+MYSQL_INIT_SCRIPT = '/var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql'
DATABASE_INIT_SCRIPTS = ['/var/lib/ambari-server/resources/Ambari-DDL-Postgres-REMOTE-CREATE.sql',
'/var/lib/ambari-server/resources/Ambari-DDL-Oracle-CREATE.sql',
- '/var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql']
+ MYSQL_INIT_SCRIPT]
DATABASE_DROP_SCRIPTS = ['/var/lib/ambari-server/resources/Ambari-DDL-Postgres-REMOTE-DROP.sql',
'/var/lib/ambari-server/resources/Ambari-DDL-Oracle-DROP.sql',
'/var/lib/ambari-server/resources/Ambari-DDL-MySQL-DROP.sql']
@@ -342,8 +343,9 @@ REGEX_ANYTHING = ".*"
POSTGRES_EXEC_ARGS = "-h {0} -p {1} -d {2} -U {3} -f {4} -v username='\"{3}\"'"
ORACLE_EXEC_ARGS = "-S -L '{0}/{1}@(description=(address=(protocol=TCP)(host={2})(port={3}))(connect_data=({6}={4})))' @{5} {0}"
-MYSQL_EXEC_ARGS = "--host={0} --port={1} --user={2} --password={3} {4} " \
+MYSQL_EXEC_ARGS_WITH_USER_VARS = "--host={0} --port={1} --user={2} --password={3} {4} " \
"-e\"set @schema=\'{4}\'; set @username=\'{2}\'; source {5};\""
+MYSQL_EXEC_ARGS_WO_USER_VARS = "--force --host={0} --port={1} --user={2} --password={3} --database={4} < {5} 2> /dev/null"
ORACLE_UPGRADE_STACK_ARGS = "-S '{0}/{1}@(description=(address=(protocol=TCP)(host={2})(port={3}))(connect_data=({6}={4})))' @{5} {7} {8}"
@@ -1375,6 +1377,7 @@ def execute_remote_script(args, scriptPath):
)))
return retcode, out, err
elif args.database == "mysql":
+ MYSQL_EXEC_ARGS = MYSQL_EXEC_ARGS_WO_USER_VARS if MYSQL_INIT_SCRIPT == scriptPath else MYSQL_EXEC_ARGS_WITH_USER_VARS
retcode, out, err = run_in_shell('{0} {1}'.format(tool, MYSQL_EXEC_ARGS.format(
args.database_host,
args.database_port,
http://git-wip-us.apache.org/repos/asf/ambari/blob/6f38b1bd/ambari-server/src/main/resources/Ambari-DDL-MySQL-DROP.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-MySQL-DROP.sql b/ambari-server/src/main/resources/Ambari-DDL-MySQL-DROP.sql
index 185694f..62d3bbd 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-DROP.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-DROP.sql
@@ -16,6 +16,7 @@
-- limitations under the License.
--
+SET SESSION group_concat_max_len = 1000000;
SET FOREIGN_KEY_CHECKS = 0;
SET @tables = NULL;
SELECT GROUP_CONCAT(table_schema, '.', table_name) INTO @tables