You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@ambari.apache.org by Attila Doroszlai <ad...@hortonworks.com> on 2017/04/28 11:38:57 UTC
Review Request 58840: AMBARI-20886. Create idempotent Ambari DB
Schema SQL script for AzureDB
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/58840/
-----------------------------------------------------------
Review request for Ambari, Jonathan Hurley, Laszlo Puskas, Sandor Magyari, and Sebastian Toader.
Bugs: AMBARI-20886
https://issues.apache.org/jira/browse/AMBARI-20886
Repository: ambari
Description
-------
Based on existing SQL Server script generate at compile-time for AzureDB a SQL script that:
* runs CREATE TABLE, CREATE INDEX and ADD CONSTRAINT statements only if the objects do not exist yet,
* DELETEs rows before running INSERT statements.
Diffs
-----
ambari-server/pom.xml da1f09eceb999650c33729120b6959462445a115
ambari-server/src/main/perl/azuredb_create_generator.pl PRE-CREATION
ambari-server/src/main/perl/azuredb_delete_generator.pl PRE-CREATION
ambari-server/src/main/resources/.gitignore PRE-CREATION
ambari-server/src/main/sh/azuredb_create_generator.sh PRE-CREATION
Diff: https://reviews.apache.org/r/58840/diff/1/
Testing
-------
Tested with Microsoft SQL Server on Linux using Docker:
```
$ mvn -q -pl ambari-server clean generate-resources
$ export MSSQL_PASSWORD='hVn?1AY6b\l&'
$ docker run -e 'ACCEPT_EULA=Y' -e "SA_PASSWORD=$MSSQL_PASSWORD" --name mssql -p 1433:1433 -v $(PWD):/tmp/ambari -d microsoft/mssql-server-linux
ba7ad59f747eac75e696cbab8ed7f30af0c98dc81250ee393ebf0e01e71f2965
$ docker exec -it mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$MSSQL_PASSWORD"
1> select count(*) from sys.objects;
2> go
-----------
107
(1 rows affected)
$ docker exec -it mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$MSSQL_PASSWORD" -i /tmp/ambari/ambari-server/src/main/resources/Ambari-DDL-AzureDB-CREATE.sql
(0 rows affected)
$ docker exec -it mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$MSSQL_PASSWORD"
1> select count(*) from sys.objects;
2> go
-----------
525
(1 rows affected)
1> select count(*) from ambari_sequences;
2> go
-----------
54
(1 rows affected)
$ docker exec -it mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$MSSQL_PASSWORD" -i /tmp/ambari/ambari-server/src/main/resources/Ambari-DDL-AzureDB-CREATE.sql
(1 rows affected)
(1 rows affected)
(184 rows affected)
(53 rows affected)
(7 rows affected)
(1 rows affected)
(8 rows affected)
(3 rows affected)
(1 rows affected)
(3 rows affected)
(54 rows affected)
(54 rows affected)
(3 rows affected)
(1 rows affected)
(3 rows affected)
(8 rows affected)
(1 rows affected)
(7 rows affected)
(53 rows affected)
(1 rows affected)
(14 rows affected)
(19 rows affected)
(24 rows affected)
(31 rows affected)
(42 rows affected)
(53 rows affected)
(1 rows affected)
(1 rows affected)
$ docker exec -it mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$MSSQL_PASSWORD"
1> select count(*) from sys.objects;
2> go
-----------
525
(1 rows affected)
1> select count(*) from ambari_sequences;
2> go
-----------
54
(1 rows affected)
$ docker rm -f mssql
mssql
$ docker run -e 'ACCEPT_EULA=Y' -e "SA_PASSWORD=$MSSQL_PASSWORD" --name mssql -p 1433:1433 -v $(PWD):/tmp/ambari -d microsoft/mssql-server-linux
5dfdd09a70b76f5cd9716fff94680b758c92f3850b227c0c274eea800bdf3402
$ docker exec -it mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$MSSQL_PASSWORD" -i /tmp/ambari/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
(54 rows affected)
(3 rows affected)
(1 rows affected)
(3 rows affected)
(8 rows affected)
(1 rows affected)
(7 rows affected)
(53 rows affected)
(1 rows affected)
(14 rows affected)
(19 rows affected)
(24 rows affected)
(31 rows affected)
(42 rows affected)
(53 rows affected)
(1 rows affected)
(1 rows affected)
$ docker exec -it mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$MSSQL_PASSWORD"
1> select count(*) from sys.objects;
2> go
-----------
525
(1 rows affected)
1> select count(*) from ambari_sequences;
2> go
-----------
54
(1 rows affected)
```
Thanks,
Attila Doroszlai
Re: Review Request 58840: AMBARI-20886. Create idempotent Ambari DB
Schema SQL script for AzureDB
Posted by Attila Doroszlai <ad...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/58840/
-----------------------------------------------------------
(Updated April 28, 2017, 3:46 p.m.)
Review request for Ambari, Jonathan Hurley, Laszlo Puskas, Sandor Magyari, and Sebastian Toader.
Changes
-------
Fixed `/usr/bin/env: perl -wpl -0073: No such file or directory` error on Linux
Bugs: AMBARI-20886
https://issues.apache.org/jira/browse/AMBARI-20886
Repository: ambari
Description
-------
Based on existing SQL Server script generate at compile-time for AzureDB a SQL script that:
* runs CREATE TABLE, CREATE INDEX and ADD CONSTRAINT statements only if the objects do not exist yet,
* DELETEs rows before running INSERT statements.
Diffs (updated)
-----
ambari-server/pom.xml da1f09eceb999650c33729120b6959462445a115
ambari-server/src/main/assemblies/server.xml 27835265f78a3a7aed37eaa544e25679eee8b400
ambari-server/src/main/perl/azuredb_create_generator.pl PRE-CREATION
ambari-server/src/main/perl/azuredb_delete_generator.pl PRE-CREATION
ambari-server/src/main/resources/.gitignore PRE-CREATION
ambari-server/src/main/sh/azuredb_create_generator.sh PRE-CREATION
Diff: https://reviews.apache.org/r/58840/diff/3/
Changes: https://reviews.apache.org/r/58840/diff/2-3/
Testing
-------
Tested with Microsoft SQL Server on Linux using Docker:
```
$ mvn -q -pl ambari-server clean generate-resources
$ export MSSQL_PASSWORD='hVn?1AY6b\l&'
$ docker run -e 'ACCEPT_EULA=Y' -e "SA_PASSWORD=$MSSQL_PASSWORD" --name mssql -p 1433:1433 -v $(PWD):/tmp/ambari -d microsoft/mssql-server-linux
ba7ad59f747eac75e696cbab8ed7f30af0c98dc81250ee393ebf0e01e71f2965
$ docker exec -it mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$MSSQL_PASSWORD"
1> select count(*) from sys.objects;
2> go
-----------
107
(1 rows affected)
$ docker exec -it mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$MSSQL_PASSWORD" -i /tmp/ambari/ambari-server/src/main/resources/Ambari-DDL-AzureDB-CREATE.sql
(0 rows affected)
$ docker exec -it mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$MSSQL_PASSWORD"
1> select count(*) from sys.objects;
2> go
-----------
525
(1 rows affected)
1> select count(*) from ambari_sequences;
2> go
-----------
54
(1 rows affected)
$ docker exec -it mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$MSSQL_PASSWORD" -i /tmp/ambari/ambari-server/src/main/resources/Ambari-DDL-AzureDB-CREATE.sql
(1 rows affected)
(1 rows affected)
(184 rows affected)
(53 rows affected)
(7 rows affected)
(1 rows affected)
(8 rows affected)
(3 rows affected)
(1 rows affected)
(3 rows affected)
(54 rows affected)
(54 rows affected)
(3 rows affected)
(1 rows affected)
(3 rows affected)
(8 rows affected)
(1 rows affected)
(7 rows affected)
(53 rows affected)
(1 rows affected)
(14 rows affected)
(19 rows affected)
(24 rows affected)
(31 rows affected)
(42 rows affected)
(53 rows affected)
(1 rows affected)
(1 rows affected)
$ docker exec -it mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$MSSQL_PASSWORD"
1> select count(*) from sys.objects;
2> go
-----------
525
(1 rows affected)
1> select count(*) from ambari_sequences;
2> go
-----------
54
(1 rows affected)
$ docker rm -f mssql
mssql
$ docker run -e 'ACCEPT_EULA=Y' -e "SA_PASSWORD=$MSSQL_PASSWORD" --name mssql -p 1433:1433 -v $(PWD):/tmp/ambari -d microsoft/mssql-server-linux
5dfdd09a70b76f5cd9716fff94680b758c92f3850b227c0c274eea800bdf3402
$ docker exec -it mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$MSSQL_PASSWORD" -i /tmp/ambari/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
(54 rows affected)
(3 rows affected)
(1 rows affected)
(3 rows affected)
(8 rows affected)
(1 rows affected)
(7 rows affected)
(53 rows affected)
(1 rows affected)
(14 rows affected)
(19 rows affected)
(24 rows affected)
(31 rows affected)
(42 rows affected)
(53 rows affected)
(1 rows affected)
(1 rows affected)
$ docker exec -it mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$MSSQL_PASSWORD"
1> select count(*) from sys.objects;
2> go
-----------
525
(1 rows affected)
1> select count(*) from ambari_sequences;
2> go
-----------
54
(1 rows affected)
```
Thanks,
Attila Doroszlai
Re: Review Request 58840: AMBARI-20886. Create idempotent Ambari DB
Schema SQL script for AzureDB
Posted by Attila Doroszlai <ad...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/58840/
-----------------------------------------------------------
(Updated April 28, 2017, 2:20 p.m.)
Review request for Ambari, Jonathan Hurley, Laszlo Puskas, Sandor Magyari, and Sebastian Toader.
Changes
-------
Include generated SQL file in the package
Bugs: AMBARI-20886
https://issues.apache.org/jira/browse/AMBARI-20886
Repository: ambari
Description
-------
Based on existing SQL Server script generate at compile-time for AzureDB a SQL script that:
* runs CREATE TABLE, CREATE INDEX and ADD CONSTRAINT statements only if the objects do not exist yet,
* DELETEs rows before running INSERT statements.
Diffs (updated)
-----
ambari-server/pom.xml da1f09eceb999650c33729120b6959462445a115
ambari-server/src/main/assemblies/server.xml 27835265f78a3a7aed37eaa544e25679eee8b400
ambari-server/src/main/perl/azuredb_create_generator.pl PRE-CREATION
ambari-server/src/main/perl/azuredb_delete_generator.pl PRE-CREATION
ambari-server/src/main/resources/.gitignore PRE-CREATION
ambari-server/src/main/sh/azuredb_create_generator.sh PRE-CREATION
Diff: https://reviews.apache.org/r/58840/diff/2/
Changes: https://reviews.apache.org/r/58840/diff/1-2/
Testing
-------
Tested with Microsoft SQL Server on Linux using Docker:
```
$ mvn -q -pl ambari-server clean generate-resources
$ export MSSQL_PASSWORD='hVn?1AY6b\l&'
$ docker run -e 'ACCEPT_EULA=Y' -e "SA_PASSWORD=$MSSQL_PASSWORD" --name mssql -p 1433:1433 -v $(PWD):/tmp/ambari -d microsoft/mssql-server-linux
ba7ad59f747eac75e696cbab8ed7f30af0c98dc81250ee393ebf0e01e71f2965
$ docker exec -it mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$MSSQL_PASSWORD"
1> select count(*) from sys.objects;
2> go
-----------
107
(1 rows affected)
$ docker exec -it mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$MSSQL_PASSWORD" -i /tmp/ambari/ambari-server/src/main/resources/Ambari-DDL-AzureDB-CREATE.sql
(0 rows affected)
$ docker exec -it mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$MSSQL_PASSWORD"
1> select count(*) from sys.objects;
2> go
-----------
525
(1 rows affected)
1> select count(*) from ambari_sequences;
2> go
-----------
54
(1 rows affected)
$ docker exec -it mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$MSSQL_PASSWORD" -i /tmp/ambari/ambari-server/src/main/resources/Ambari-DDL-AzureDB-CREATE.sql
(1 rows affected)
(1 rows affected)
(184 rows affected)
(53 rows affected)
(7 rows affected)
(1 rows affected)
(8 rows affected)
(3 rows affected)
(1 rows affected)
(3 rows affected)
(54 rows affected)
(54 rows affected)
(3 rows affected)
(1 rows affected)
(3 rows affected)
(8 rows affected)
(1 rows affected)
(7 rows affected)
(53 rows affected)
(1 rows affected)
(14 rows affected)
(19 rows affected)
(24 rows affected)
(31 rows affected)
(42 rows affected)
(53 rows affected)
(1 rows affected)
(1 rows affected)
$ docker exec -it mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$MSSQL_PASSWORD"
1> select count(*) from sys.objects;
2> go
-----------
525
(1 rows affected)
1> select count(*) from ambari_sequences;
2> go
-----------
54
(1 rows affected)
$ docker rm -f mssql
mssql
$ docker run -e 'ACCEPT_EULA=Y' -e "SA_PASSWORD=$MSSQL_PASSWORD" --name mssql -p 1433:1433 -v $(PWD):/tmp/ambari -d microsoft/mssql-server-linux
5dfdd09a70b76f5cd9716fff94680b758c92f3850b227c0c274eea800bdf3402
$ docker exec -it mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$MSSQL_PASSWORD" -i /tmp/ambari/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
(54 rows affected)
(3 rows affected)
(1 rows affected)
(3 rows affected)
(8 rows affected)
(1 rows affected)
(7 rows affected)
(53 rows affected)
(1 rows affected)
(14 rows affected)
(19 rows affected)
(24 rows affected)
(31 rows affected)
(42 rows affected)
(53 rows affected)
(1 rows affected)
(1 rows affected)
$ docker exec -it mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$MSSQL_PASSWORD"
1> select count(*) from sys.objects;
2> go
-----------
525
(1 rows affected)
1> select count(*) from ambari_sequences;
2> go
-----------
54
(1 rows affected)
```
Thanks,
Attila Doroszlai