Skip to content

Commit 1975c87

Browse files
committed
Determine pod name using @@ServerName
1 parent e117bea commit 1975c87

2 files changed

Lines changed: 2 additions & 10 deletions

File tree

samples/features/sql-big-data-cluster/bootstrap-sample-db.cmd

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ if NOT EXIST tpcxbb_1gb.bak (
4141
set SQLCMDSERVER=%SQL_MASTER_INSTANCE%
4242
set SQLCMDUSER=sa
4343
set SQLCMDPASSWORD=%SQL_MASTER_SA_PASSWORD%
44-
for /F "usebackq" %%v in (`sqlcmd -I -b -h-1 -Q "print RTRIM((CAST(SERVERPROPERTY('ProductLevel') as nvarchar(128))));"`) do SET CTP_VERSION=%%v
45-
if /i "%CTP_VERSION%" EQU "CTP2.4" (set MASTER_POD_NAME=mssql-master-pool-0) else (set MASTER_POD_NAME=master-0)
44+
for /F "usebackq" %%v in (`sqlcmd -I -b -h-1 -Q "print @@SERVERNAME;"`) do SET MASTER_POD_NAME=%%v
4645

4746
REM Copy the backup file, restore the database, create necessary objects and data file
4847
echo Copying sales database backup file to SQL Master instance...

samples/features/sql-big-data-cluster/bootstrap-sample-db.sh

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,7 @@ then
5151
$DEBUG curl -G "https://sqlchoice.blob.core.windows.net/sqlchoice/static/tpcxbb_1gb.bak" -o tpcxbb_1gb.bak
5252
fi
5353

54-
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))));")
55-
56-
if [ "$CTP_VERSION" == "CTP2.4" ]
57-
then
58-
MASTER_POD_NAME=mssql-master-pool-0
59-
else
60-
MASTER_POD_NAME=master-0
61-
fi
54+
MASTER_POD_NAME=$(sqlcmd -S $SQL_MASTER_INSTANCE -Usa -P$SQL_MASTER_SA_PASSWORD -I -b -h-1 -Q "print @@SERVERNAME;")
6255

6356
echo Copying sales database backup file...
6457
$DEBUG kubectl cp tpcxbb_1gb.bak $CLUSTER_NAMESPACE/$MASTER_POD_NAME:var/opt/mssql/data -c mssql-server || (echo $ERROR_MESSAGE && exit 1)

0 commit comments

Comments
 (0)