Skip to content

Commit 500160b

Browse files
committed
updated postgresql configuration logic
1 parent 2e08fe9 commit 500160b

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

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

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,16 +197,27 @@ private async Task ConfigurePostgreSQLServerAsync(EventContext telemetryContext,
197197
.FirstOrDefault()?.IPAddress
198198
?? IPAddress.Loopback.ToString();
199199

200-
string innoDbDirs = !string.IsNullOrEmpty(this.StripeDiskMountPoint) ? this.StripeDiskMountPoint : await this.GetPostgreSQLInnodbDirectoriesAsync(cancellationToken);
201-
202200
string arguments = $"{this.packageDirectory}/configure-server.py --dbName {this.DatabaseName} --serverIp {serverIp} --password {this.SuperUserPassword} --port {this.Port} --inMemory {this.SharedMemoryBuffer}";
203201

204-
if (innoDbDirs != null)
202+
string innoDbDirs = string.Empty;
203+
if (this.Parameters.ContainsKey(nameof(this.DiskFilter)) || !string.IsNullOrEmpty(this.StripeDiskMountPoint))
205204
{
206-
if (innoDbDirs.Split(';', StringSplitOptions.RemoveEmptyEntries).Length == 1)
205+
innoDbDirs = this.Parameters.ContainsKey(nameof(this.DiskFilter)) ? await this.GetPostgreSQLInnodbDirectoriesAsync(cancellationToken) : string.Empty;
206+
innoDbDirs = !string.IsNullOrEmpty(this.StripeDiskMountPoint) ? this.StripeDiskMountPoint : innoDbDirs;
207+
208+
if (!string.IsNullOrEmpty(innoDbDirs))
207209
{
208-
string cleanDirectory = innoDbDirs.TrimEnd(';');
209-
arguments += $" --innodbDirectory {cleanDirectory}";
210+
if (innoDbDirs.Split(';', StringSplitOptions.RemoveEmptyEntries).Length == 1)
211+
{
212+
string cleanDirectory = innoDbDirs.TrimEnd(';');
213+
arguments += $" --innodbDirectory {cleanDirectory}";
214+
}
215+
else
216+
{
217+
throw new WorkloadException(
218+
"Multiple InnoDB directories detected. Please specify a single directory for PostgreSQL configuration when using the DiskFilter parameter explicitly for PostgreSQLServerConfiguration.",
219+
ErrorReason.InvalidProfileDefinition);
220+
}
210221
}
211222
}
212223

0 commit comments

Comments
 (0)