----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/58840/#review173347 -----------------------------------------------------------
ambari-server/src/main/perl/azuredb_delete_generator.pl Lines 20 (patched) <https://reviews.apache.org/r/58840/#comment246368> Why introduce a dependency on perl? Can't this be done with shell script or python so it's consistent with the rest of Ambari? - Alejandro Fernandez On April 28, 2017, 4:21 p.m., Attila Doroszlai wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/58840/ > ----------------------------------------------------------- > > (Updated April 28, 2017, 4:21 p.m.) > > > Review request for Ambari, Jonathan Hurley, Laszlo Puskas, Sandor Magyari, > Sumit Mohanty, Sebastian Toader, and Sid Wagle. > > > 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/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/ > > > 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 > >