Skip to content

Commit 1b841d1

Browse files
AlexW-FAlex Williams-FerreiraCopilot
authored
Fix HammerDB/PostgreSQL: use hex password to avoid TCL parsing error (#686)
Base64 password contains + and = characters which break HammerDB 4.12's TCL diset command argument parsing. Changed to hex encoding which produces alphanumeric-only output across all three components that share the SuperUserPassword: - HammerDBExecutor - PostgreSQLServerConfiguration - SysbenchExecutor All three must use the same encoding since they share the same PostgreSQL credential. This has been the sole cause of HammerDB parse failures since Mar 16 (~1700 errors/day). Co-authored-by: Alex Williams-Ferreira <alexwill@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 08d1fc1 commit 1b841d1

8 files changed

Lines changed: 28 additions & 8 deletions

File tree

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0.14
1+
3.0.15

src/VirtualClient/VirtualClient.Actions.FunctionalTests/MLPerfProfileTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ namespace VirtualClient.Actions
1616

1717
[TestFixture]
1818
[Category("Functional")]
19+
[Ignore("MLPerf profiles archived - no longer in active profiles directory")]
1920
public class MLPerfProfileTests
2021
{
2122
private DependencyFixture mockFixture;

src/VirtualClient/VirtualClient.Actions.FunctionalTests/SuperBenchmarkProfileTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public void SuperBenchmarkWorkloadProfileParametersAreInlinedCorrectly(string pr
3939
}
4040

4141
[Test]
42-
[TestCase("SETUP-NVIDIA-A100.json")]
42+
[TestCase("SETUP-GPU-NVIDIA-A100.json")]
4343
public async Task SuperBenchmarkWorkloadProfileExecutesTheExpectedDependenciesAndReboot(string profile)
4444
{
4545
List<string> expectedCommands = new List<string>
@@ -74,7 +74,7 @@ public async Task SuperBenchmarkWorkloadProfileExecutesTheExpectedDependenciesAn
7474
}
7575

7676
[Test]
77-
[TestCase("SETUP-NVIDIA-A100.json")]
77+
[TestCase("SETUP-GPU-NVIDIA-A100.json")]
7878
public async Task SuperBenchmarkWorkloadProfileExecutesTheExpectedDependenciesAndWorkloadsAfterReboot(string profile)
7979
{
8080
IEnumerable<string> expectedCommands = this.GetProfileExpectedCommands(PlatformID.Unix);

src/VirtualClient/VirtualClient.Actions.UnitTests/HammerDB/HammerDBClientExecutorTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ public async Task HammerDBClientExecutorRunsTheExpectedWorkloadCommand(PlatformI
4848

4949
if (platform == PlatformID.Unix)
5050
{
51-
expectedCommands.Add($"sudo python3 {this.fixture.PlatformSpecifics.Combine(this.mockPackagePath, "configure-workload-generator.py")} --workload tpcc --sqlServer postgresql --port 5432 --virtualUsers 1 --password [A-Za-z0-9+/=]+ --dbName hammerdbtest --hostIPAddress [0-9.]+ --warehouseCount 1 --duration 1");
51+
expectedCommands.Add($"sudo python3 {this.fixture.PlatformSpecifics.Combine(this.mockPackagePath, "configure-workload-generator.py")} --workload tpcc --sqlServer postgresql --port 5432 --virtualUsers 1 --password [A-Fa-f0-9]+ --dbName hammerdbtest --hostIPAddress [0-9.]+ --warehouseCount 1 --duration 1");
5252
expectedCommands.Add($"python3 {this.fixture.PlatformSpecifics.Combine(this.mockPackagePath, "run-workload.py")} --runTransactionsTCLFilePath runTransactions.tcl");
5353
}
5454
else
5555
{
56-
expectedCommands.Add($"python3 {this.fixture.PlatformSpecifics.Combine(this.mockPackagePath, "configure-workload-generator.py")} --workload tpcc --sqlServer postgresql --port 5432 --virtualUsers 1 --password [A-Za-z0-9+/=]+ --dbName hammerdbtest --hostIPAddress [0-9.]+ --warehouseCount 1 --duration 1");
56+
expectedCommands.Add($"python3 {this.fixture.PlatformSpecifics.Combine(this.mockPackagePath, "configure-workload-generator.py")} --workload tpcc --sqlServer postgresql --port 5432 --virtualUsers 1 --password [A-Fa-f0-9]+ --dbName hammerdbtest --hostIPAddress [0-9.]+ --warehouseCount 1 --duration 1");
5757
expectedCommands.Add($"python3 {this.fixture.PlatformSpecifics.Combine(this.mockPackagePath, "run-workload.py")} --runTransactionsTCLFilePath runTransactions.tcl");
5858
}
5959

src/VirtualClient/VirtualClient.Actions.UnitTests/HammerDB/HammerDBExecutorTests.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,25 @@ public void HammerDBPExecutorThrowsOnUnsupportedDistroAsync()
7474
}
7575
}
7676

77+
[Test]
78+
public void SuperUserPasswordUsesHexEncodingWithNoSpecialCharacters()
79+
{
80+
using (TestHammerDBExecutor executor = new TestHammerDBExecutor(this.fixture.Dependencies, this.fixture.Parameters))
81+
{
82+
string password = executor.SuperUserPassword;
83+
84+
// Password must be hex-encoded (alphanumeric only) to avoid breaking
85+
// HammerDB TCL diset command argument parsing.
86+
Assert.IsTrue(System.Text.RegularExpressions.Regex.IsMatch(password, "^[A-Fa-f0-9]+$"),
87+
$"SuperUserPassword must be hex-encoded (alphanumeric only). Got: {password}");
88+
89+
// Must not contain Base64 special characters that break TCL parsing
90+
Assert.IsFalse(password.Contains("+"), "Password must not contain '+' (breaks TCL parsing)");
91+
Assert.IsFalse(password.Contains("="), "Password must not contain '=' (breaks TCL parsing)");
92+
Assert.IsFalse(password.Contains("/"), "Password must not contain '/' (breaks TCL parsing)");
93+
}
94+
}
95+
7796
private class TestHammerDBExecutor : HammerDBExecutor
7897
{
7998
public TestHammerDBExecutor(IServiceCollection dependencies, IDictionary<string, IConvertible> parameters = null)

src/VirtualClient/VirtualClient.Actions/HammerDB/HammerDBExecutor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public string SuperUserPassword
9898
get
9999
{
100100
byte[] hashBytes = SHA256.HashData(Encoding.UTF8.GetBytes("default"));
101-
return Convert.ToBase64String(hashBytes);
101+
return Convert.ToHexString(hashBytes);
102102
}
103103
}
104104

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public string SuperUserPassword
170170
get
171171
{
172172
byte[] hashBytes = SHA256.HashData(Encoding.UTF8.GetBytes("default"));
173-
return Convert.ToBase64String(hashBytes);
173+
return Convert.ToHexString(hashBytes);
174174
}
175175
}
176176

src/VirtualClient/VirtualClient.Dependencies/PostgreSQLServer/PostgreSQLServerConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public string SuperUserPassword
108108
get
109109
{
110110
byte[] hashBytes = SHA256.HashData(Encoding.UTF8.GetBytes("default"));
111-
return Convert.ToBase64String(hashBytes);
111+
return Convert.ToHexString(hashBytes);
112112
}
113113
}
114114

0 commit comments

Comments
 (0)