Skip to content

Commit 1d4c178

Browse files
authored
Merge branch 'main' into jahnvi/perf-fetch-optimization
2 parents 1187377 + d8b11f8 commit 1d4c178

4 files changed

Lines changed: 63 additions & 108 deletions

File tree

‎eng/pipelines/pr-validation-pipeline.yml‎

Lines changed: 21 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -468,9 +468,7 @@ jobs:
468468

469469
- job: PytestOnMacOS
470470
displayName: 'macOS x86_64'
471-
# Reserve 60 minutes outside the 100-minute benchmark step for Colima/SQL
472-
# setup, pytest, fixture restore and artifact publication.
473-
timeoutInMinutes: 160
471+
timeoutInMinutes: 90
474472
pool:
475473
vmImage: 'macos-latest'
476474

@@ -568,11 +566,7 @@ jobs:
568566
pip install -r requirements.txt
569567
570568
echo "Building pybind bindings (.so) (overlapped with container setup)..."
571-
PROFILER_BUILD=0
572-
if [ "$(Build.Reason)" = "PullRequest" ]; then
573-
PROFILER_BUILD=1
574-
fi
575-
( cd mssql_python/pybind && ENABLE_PROFILING="$PROFILER_BUILD" ./build.sh )
569+
( cd mssql_python/pybind && ./build.sh )
576570
577571
echo "Waiting for container setup (Colima + SQL Server) to finish..."
578572
SQL_STATUS=0
@@ -585,10 +579,6 @@ jobs:
585579
env:
586580
DB_PASSWORD: $(DB_PASSWORD)
587581
588-
- script: python -m eng.profiler_benchmarks.controller --check-build on
589-
displayName: 'Verify native configuration and recording OFF before pytest'
590-
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
591-
592582
- template: steps/install-mssql-py-core.yml
593583
parameters:
594584
platform: unix
@@ -637,59 +627,9 @@ jobs:
637627
testResultsFiles: '**/test-results.xml'
638628
testRunTitle: 'Publish pytest results on macOS $(sqlVersion)'
639629

640-
# Download and restore AdventureWorks2022 database for benchmarking
641-
- script: |
642-
echo "Downloading AdventureWorks2022.bak..."
643-
curl -sSL -o /tmp/AdventureWorks2022.bak \
644-
https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorks2022.bak
645-
646-
echo "Copying backup into SQL Server container..."
647-
docker cp /tmp/AdventureWorks2022.bak sqlserver:/tmp/AdventureWorks2022.bak
648-
649-
echo "Restoring AdventureWorks2022 database..."
650-
docker exec sqlserver /opt/mssql-tools18/bin/sqlcmd \
651-
-S localhost -U SA -P "$DB_PASSWORD" -C \
652-
-Q "RESTORE DATABASE AdventureWorks2022 FROM DISK = '/tmp/AdventureWorks2022.bak' WITH MOVE 'AdventureWorks2022' TO '/var/opt/mssql/data/AdventureWorks2022.mdf', MOVE 'AdventureWorks2022_log' TO '/var/opt/mssql/data/AdventureWorks2022_log.ldf', REPLACE"
653-
654-
if [ $? -eq 0 ]; then
655-
echo "AdventureWorks2022 database restored successfully"
656-
else
657-
echo "Failed to restore AdventureWorks2022 database"
658-
fi
659-
660-
rm -f /tmp/AdventureWorks2022.bak
661-
docker exec sqlserver rm -f /tmp/AdventureWorks2022.bak || true
662-
displayName: 'Download and restore AdventureWorks2022 database on macOS'
663-
condition: and(succeeded(), or(eq(variables['sqlVersion'], 'SQL2022'), eq(variables['sqlVersion'], 'SQL2025')))
664-
continueOnError: true
665-
env:
666-
DB_PASSWORD: $(DB_PASSWORD)
667-
668-
# Run performance benchmarks on macOS
669-
- script: |
670-
set -euo pipefail
671-
echo "Restoring build dependencies for isolated profiling builds..."
672-
brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
673-
# Newer Homebrew refuses to load formulae from third-party taps unless the tap is trusted
674-
brew trust microsoft/mssql-release || echo "brew trust failed; attempting install anyway"
675-
HOMEBREW_ACCEPT_EULA=Y brew install msodbcsql18
676-
python -m eng.profiler_benchmarks.controller --reuse-candidate --leg "macOS-$(sqlVersion)" --output profiler-results
677-
displayName: 'Compare profiling builds on macOS $(sqlVersion)'
678-
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'), or(eq(variables['sqlVersion'], 'SQL2022'), eq(variables['sqlVersion'], 'SQL2025')))
679-
timeoutInMinutes: 100
680-
continueOnError: true
681-
env:
682-
SYSTEM_PULLREQUEST_SOURCECOMMITID: $(System.PullRequest.SourceCommitId)
683-
DB_CONNECTION_STRING: 'Server=tcp:127.0.0.1,1433;Database=AdventureWorks2022;Uid=SA;Pwd=$(DB_PASSWORD);TrustServerCertificate=yes'
684-
685-
# Both revisions and samples travel together; no historical baseline lookup.
686-
- task: PublishPipelineArtifact@1
687-
inputs:
688-
targetPath: profiler-results
689-
artifact: 'profiler-macOS-$(sqlVersion)'
690-
displayName: 'Publish paired profiler measurements'
691-
condition: and(succeededOrFailed(), eq(variables['Build.Reason'], 'PullRequest'), or(eq(variables['sqlVersion'], 'SQL2022'), eq(variables['sqlVersion'], 'SQL2025')))
692-
continueOnError: true
630+
# Routine PR profiling excludes hosted macOS because Colima-backed control
631+
# runs produced regressions with no product-code change. Functional macOS
632+
# coverage remains above; Unix performance signal comes from Ubuntu.
693633

694634
- script: |
695635
python3 eng/scripts/setup_sql_container.py --cleanup --colima \
@@ -713,11 +653,13 @@ jobs:
713653
distroName: 'Ubuntu'
714654
sqlServerImage: 'mcr.microsoft.com/mssql/server:2022-latest'
715655
useAzureSQL: 'false'
656+
profilerLeg: 'Linux-SQL2022'
716657
Ubuntu_SQL2025:
717658
dockerImage: 'ubuntu:24.04'
718659
distroName: 'Ubuntu-SQL2025'
719660
sqlServerImage: 'mcr.microsoft.com/mssql/server:2025-latest'
720661
useAzureSQL: 'false'
662+
profilerLeg: 'Linux-SQL2025'
721663
${{ if ne(variables['AZURE_CONNECTION_STRING'], '') }}:
722664
Ubuntu_AzureSQL:
723665
dockerImage: 'ubuntu:24.04'
@@ -832,7 +774,8 @@ jobs:
832774
- script: |
833775
# Build pybind bindings in the container
834776
PROFILER_BUILD=0
835-
if [ "$(Build.Reason)" = "PullRequest" ] && [ "$(distroName)" = "Ubuntu" ]; then
777+
if [ "$(Build.Reason)" = "PullRequest" ] &&
778+
[[ "$(distroName)" =~ ^Ubuntu(-SQL2025)?$ ]]; then
836779
PROFILER_BUILD=1
837780
fi
838781
docker exec -e ENABLE_PROFILING="$PROFILER_BUILD" test-container-$(distroName) bash -c "
@@ -912,8 +855,8 @@ jobs:
912855
DB_PASSWORD: $(DB_PASSWORD)
913856
914857
- script: |
915-
# Download and restore AdventureWorks2022 database for benchmarking on Ubuntu only
916-
if [ "$(distroName)" = "Ubuntu" ] && [ "$(useAzureSQL)" = "false" ]; then
858+
# Download and restore AdventureWorks2022 for both Unix profiler legs.
859+
if [[ "$(distroName)" =~ ^Ubuntu(-SQL2025)?$ ]] && [ "$(useAzureSQL)" = "false" ]; then
917860
echo "Downloading AdventureWorks2022.bak..."
918861
wget -q https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorks2022.bak -O /tmp/AdventureWorks2022.bak
919862
@@ -939,14 +882,16 @@ jobs:
939882
docker exec sqlserver-$(distroName) rm -f /tmp/AdventureWorks2022.bak || true
940883
fi
941884
displayName: 'Download and restore AdventureWorks2022 database in $(distroName)'
942-
condition: and(succeeded(), eq(variables['distroName'], 'Ubuntu'), eq(variables['useAzureSQL'], 'false'))
885+
condition: and(succeeded(), eq(variables['useAzureSQL'], 'false'), or(eq(variables['distroName'], 'Ubuntu'), eq(variables['distroName'], 'Ubuntu-SQL2025')))
943886
continueOnError: true
944887
env:
945888
DB_PASSWORD: $(DB_PASSWORD)
946889
890+
# Unix profiling uses Ubuntu because it covers the shared Unix hot paths while
891+
# producing stable paired measurements on hosted agents.
947892
- script: |
948-
# Run performance benchmarks on Ubuntu with SQL Server 2022 only
949-
if [ "$(distroName)" = "Ubuntu" ] && [ "$(useAzureSQL)" = "false" ]; then
893+
# Run Unix performance benchmarks on Ubuntu with SQL Server 2022 and 2025.
894+
if [[ "$(distroName)" =~ ^Ubuntu(-SQL2025)?$ ]] && [ "$(useAzureSQL)" = "false" ]; then
950895
export SQLSERVER_IP=$(docker inspect sqlserver-$(distroName) --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}')
951896
echo "Running performance benchmarks on Ubuntu with SQL Server IP: $SQLSERVER_IP"
952897
@@ -967,13 +912,13 @@ jobs:
967912
ACCEPT_EULA=Y apt-get install -y --no-install-recommends git unixodbc unixodbc-dev libodbc2 libodbcinst2 odbcinst msodbcsql18
968913
git config --global --add safe.directory /workspace
969914
odbcinst -q -d -n "ODBC Driver 18 for SQL Server"
970-
python -m eng.profiler_benchmarks.controller --reuse-candidate --leg Linux-SQL2022 --output profiler-results
915+
python -m eng.profiler_benchmarks.controller --reuse-candidate --leg "$(profilerLeg)" --output profiler-results
971916
'
972917
else
973918
echo "Skipping performance benchmarks on $(distroName) (only runs on Ubuntu with local SQL Server)"
974919
fi
975-
displayName: 'Compare profiling builds in $(distroName) container'
976-
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'), eq(variables['distroName'], 'Ubuntu'), eq(variables['useAzureSQL'], 'false'))
920+
displayName: 'Compare profiling builds on Unix in $(distroName) container'
921+
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'), eq(variables['useAzureSQL'], 'false'), or(eq(variables['distroName'], 'Ubuntu'), eq(variables['distroName'], 'Ubuntu-SQL2025')))
977922
continueOnError: true
978923
timeoutInMinutes: 100
979924
env:
@@ -984,9 +929,9 @@ jobs:
984929
- task: PublishPipelineArtifact@1
985930
inputs:
986931
targetPath: profiler-results
987-
artifact: profiler-Linux-SQL2022
932+
artifact: profiler-$(profilerLeg)
988933
displayName: 'Publish paired profiler measurements'
989-
condition: and(succeededOrFailed(), eq(variables['Build.Reason'], 'PullRequest'), eq(variables['distroName'], 'Ubuntu'), eq(variables['useAzureSQL'], 'false'))
934+
condition: and(succeededOrFailed(), eq(variables['Build.Reason'], 'PullRequest'), eq(variables['useAzureSQL'], 'false'), or(eq(variables['distroName'], 'Ubuntu'), eq(variables['distroName'], 'Ubuntu-SQL2025')))
990935
continueOnError: true
991936

992937
- script: |

‎eng/profiler_benchmarks/README.md‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,14 @@ Partial results never produce a verdict.
2727

2828
## Publication
2929

30-
Five environments publish raw samples: Windows and macOS on SQL Server 2022/2025,
31-
and Ubuntu on SQL Server 2022. The privileged publisher runs trusted base code,
32-
authenticates benchmark producers, validates bounded artifacts, and ignores stale
33-
heads. A failed aggregate build can still publish when its authenticated artifacts
34-
validate. Missing, malformed, canceled, incomplete, or invalid data remains unavailable.
30+
Four environments publish raw samples: Windows and Unix on SQL Server 2022/2025.
31+
Unix measurements run on Ubuntu. Routine macOS profiling is intentionally excluded:
32+
hosted macOS plus Colima produced false regressions on a documentation-only control
33+
PR, while macOS remains covered by functional CI. The privileged publisher runs
34+
trusted base code, authenticates benchmark producers, validates bounded artifacts,
35+
and ignores stale heads. A failed aggregate build can still publish when its
36+
authenticated artifacts validate. Missing, malformed, canceled, incomplete, or
37+
invalid data remains unavailable.
3538

3639
The publisher waits up to 220 minutes inside a 230-minute workflow. The first main
3740
comparison after introduction may be incomplete because its parent lacks this

‎eng/profiler_benchmarks/report.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
import zipfile
1515
import zlib
1616

17-
LEGS = ("Windows-SQL2022", "Windows-SQL2025", "macOS-SQL2022", "macOS-SQL2025", "Linux-SQL2022")
17+
# Hosted macOS plus Colima produced false regressions on a documentation-only
18+
# control PR. Routine reports use stable Ubuntu measurements as the Unix signal.
19+
LEGS = ("Windows-SQL2022", "Windows-SQL2025", "Linux-SQL2022", "Linux-SQL2025")
1820
TASK_NAMES = {
1921
"connect": "Connection opening",
2022
"select": "SELECT queries",
@@ -208,7 +210,7 @@ def _validate(report, build_id=None, head=None, source=None, base=None, suite=No
208210
for value in env.values():
209211
text(value)
210212
expected_os, sql = report["leg"].split("-")
211-
if env["os"] != {"macOS": "Darwin"}.get(expected_os, expected_os):
213+
if env["os"] != expected_os:
212214
raise ValueError("Artifact platform does not match its leg")
213215
if not env["sql_version"].startswith({"SQL2022": "16.", "SQL2025": "17."}[sql]):
214216
raise ValueError("Artifact SQL version does not match its leg")
@@ -391,6 +393,7 @@ def escape(value):
391393

392394
def environment_name(leg):
393395
operating_system, sql = leg.split("-")
396+
operating_system = {"Linux": "Unix"}.get(operating_system, operating_system)
394397
return f"{operating_system} / SQL Server {sql.removeprefix('SQL')}"
395398

396399

0 commit comments

Comments
 (0)