From b49755eade7cf26e24898bc425ab049e1a9c18e6 Mon Sep 17 00:00:00 2001 From: Alex Williams-Ferreira Date: Mon, 6 Apr 2026 10:11:02 -0700 Subject: [PATCH] Fix Sysbench TPCC PopulateDatabase passing --warehouses 0 on small VMs On VMs with 4 vCPUs or fewer, GetWarehouseCount returns 1, causing the Populate mode calculation (warehouseEstimate - 1) to yield 0. This passes --warehouses 0 to populate-database.py, which calls sysbench tpcc prepare with --scale=0, dropping and recreating all tables with zero data. The client then fails with nil value errors on every run attempt. Fix: Use Math.Max(1, warehouseEstimate - 1) to ensure at least 1 warehouse is always passed to the populate step. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Sysbench/SysbenchConfigurationTests.cs | 2 +- .../VirtualClient.Actions/Sysbench/SysbenchExecutor.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/VirtualClient/VirtualClient.Actions.UnitTests/Sysbench/SysbenchConfigurationTests.cs b/src/VirtualClient/VirtualClient.Actions.UnitTests/Sysbench/SysbenchConfigurationTests.cs index ae09915ce2..529b685442 100644 --- a/src/VirtualClient/VirtualClient.Actions.UnitTests/Sysbench/SysbenchConfigurationTests.cs +++ b/src/VirtualClient/VirtualClient.Actions.UnitTests/Sysbench/SysbenchConfigurationTests.cs @@ -276,7 +276,7 @@ public async Task SysbenchConfigurationProperlyExecutesTPCCPreparation() string[] expectedCommands = { - $"python3 {this.mockPackagePath}/populate-database.py --dbName sbtest --databaseSystem MySQL --benchmark TPCC --threadCount 8 --tableCount 10 --warehouses 0 --password [A-Za-z0-9+/=]+ --hostIpAddress \"1.2.3.5\"" + $"python3 {this.mockPackagePath}/populate-database.py --dbName sbtest --databaseSystem MySQL --benchmark TPCC --threadCount 8 --tableCount 10 --warehouses 1 --password [A-Za-z0-9+/=]+ --hostIpAddress \"1.2.3.5\"" }; int commandNumber = 0; diff --git a/src/VirtualClient/VirtualClient.Actions/Sysbench/SysbenchExecutor.cs b/src/VirtualClient/VirtualClient.Actions/Sysbench/SysbenchExecutor.cs index 5703d485e5..c601232334 100644 --- a/src/VirtualClient/VirtualClient.Actions/Sysbench/SysbenchExecutor.cs +++ b/src/VirtualClient/VirtualClient.Actions/Sysbench/SysbenchExecutor.cs @@ -427,7 +427,7 @@ protected string BuildSysbenchLoggingArguments(SysbenchMode mode) int warehouseCount = mode switch { SysbenchMode.Prepare => 1, - SysbenchMode.Populate => warehouseEstimate - 1, + SysbenchMode.Populate => Math.Max(1, warehouseEstimate - 1), SysbenchMode.Run => warehouseEstimate, _ => warehouseEstimate };