Skip to content

Commit a9fb406

Browse files
AlexW-FAlex Williams-FerreiraCopilot
authored
Fix Sysbench TPCC PopulateDatabase passing --warehouses 0 on small VMs (#675)
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: Alex Williams-Ferreira <alexwill@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 3ffe2e9 commit a9fb406

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/VirtualClient/VirtualClient.Actions.UnitTests/Sysbench/SysbenchConfigurationTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ public async Task SysbenchConfigurationProperlyExecutesTPCCPreparation()
276276

277277
string[] expectedCommands =
278278
{
279-
$"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\""
279+
$"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\""
280280
};
281281

282282
int commandNumber = 0;

src/VirtualClient/VirtualClient.Actions/Sysbench/SysbenchExecutor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ protected string BuildSysbenchLoggingArguments(SysbenchMode mode)
427427
int warehouseCount = mode switch
428428
{
429429
SysbenchMode.Prepare => 1,
430-
SysbenchMode.Populate => warehouseEstimate - 1,
430+
SysbenchMode.Populate => Math.Max(1, warehouseEstimate - 1),
431431
SysbenchMode.Run => warehouseEstimate,
432432
_ => warehouseEstimate
433433
};

0 commit comments

Comments
 (0)