From 1975c87bc88e37df1d6fd3e35b06ffdc36b8ff47 Mon Sep 17 00:00:00 2001 From: Umachandar Jayachandran Date: Thu, 22 Aug 2019 10:03:25 -0700 Subject: [PATCH] Determine pod name using @@SERVERNAME --- .../sql-big-data-cluster/bootstrap-sample-db.cmd | 3 +-- .../features/sql-big-data-cluster/bootstrap-sample-db.sh | 9 +-------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/samples/features/sql-big-data-cluster/bootstrap-sample-db.cmd b/samples/features/sql-big-data-cluster/bootstrap-sample-db.cmd index 412ad4fa..a994bb2f 100644 --- a/samples/features/sql-big-data-cluster/bootstrap-sample-db.cmd +++ b/samples/features/sql-big-data-cluster/bootstrap-sample-db.cmd @@ -41,8 +41,7 @@ if NOT EXIST tpcxbb_1gb.bak ( set SQLCMDSERVER=%SQL_MASTER_INSTANCE% set SQLCMDUSER=sa set SQLCMDPASSWORD=%SQL_MASTER_SA_PASSWORD% -for /F "usebackq" %%v in (`sqlcmd -I -b -h-1 -Q "print RTRIM((CAST(SERVERPROPERTY('ProductLevel') as nvarchar(128))));"`) do SET CTP_VERSION=%%v -if /i "%CTP_VERSION%" EQU "CTP2.4" (set MASTER_POD_NAME=mssql-master-pool-0) else (set MASTER_POD_NAME=master-0) +for /F "usebackq" %%v in (`sqlcmd -I -b -h-1 -Q "print @@SERVERNAME;"`) do SET MASTER_POD_NAME=%%v REM Copy the backup file, restore the database, create necessary objects and data file echo Copying sales database backup file to SQL Master instance... diff --git a/samples/features/sql-big-data-cluster/bootstrap-sample-db.sh b/samples/features/sql-big-data-cluster/bootstrap-sample-db.sh index d3a3bbc8..147a151b 100644 --- a/samples/features/sql-big-data-cluster/bootstrap-sample-db.sh +++ b/samples/features/sql-big-data-cluster/bootstrap-sample-db.sh @@ -51,14 +51,7 @@ then $DEBUG curl -G "https://sqlchoice.blob.core.windows.net/sqlchoice/static/tpcxbb_1gb.bak" -o tpcxbb_1gb.bak fi -CTP_VERSION=$(sqlcmd -S $SQL_MASTER_INSTANCE -Usa -P$SQL_MASTER_SA_PASSWORD -I -b -h-1 -Q "print RTRIM((CAST(SERVERPROPERTY('ProductLevel') as nvarchar(128))));") - -if [ "$CTP_VERSION" == "CTP2.4" ] -then - MASTER_POD_NAME=mssql-master-pool-0 -else - MASTER_POD_NAME=master-0 -fi +MASTER_POD_NAME=$(sqlcmd -S $SQL_MASTER_INSTANCE -Usa -P$SQL_MASTER_SA_PASSWORD -I -b -h-1 -Q "print @@SERVERNAME;") echo Copying sales database backup file... $DEBUG kubectl cp tpcxbb_1gb.bak $CLUSTER_NAMESPACE/$MASTER_POD_NAME:var/opt/mssql/data -c mssql-server || (echo $ERROR_MESSAGE && exit 1)