Skip to content

Commit

Permalink
Revert "Backport fixes to v5 (#4057)"
Browse files Browse the repository at this point in the history
This reverts commit 8ea38bb.
  • Loading branch information
WilliamBZA committed Apr 12, 2024
1 parent 38ba643 commit 742d2d0
Show file tree
Hide file tree
Showing 20 changed files with 71 additions and 311 deletions.
Expand Up @@ -11,16 +11,14 @@ public class DatabaseConfiguration
TimeSpan auditRetentionPeriod,
int maxBodySizeToStore,
int minimumStorageLeftRequiredForIngestion,
ServerConfiguration serverConfiguration,
TimeSpan bulkInsertCommitTimeout)
ServerConfiguration serverConfiguration)
{
Name = name;
ExpirationProcessTimerInSeconds = expirationProcessTimerInSeconds;
EnableFullTextSearch = enableFullTextSearch;
AuditRetentionPeriod = auditRetentionPeriod;
MaxBodySizeToStore = maxBodySizeToStore;
ServerConfiguration = serverConfiguration;
BulkInsertCommitTimeout = bulkInsertCommitTimeout;
MinimumStorageLeftRequiredForIngestion = minimumStorageLeftRequiredForIngestion;
}

Expand All @@ -39,7 +37,5 @@ public class DatabaseConfiguration
public int MaxBodySizeToStore { get; }

public int MinimumStorageLeftRequiredForIngestion { get; internal set; } //Setting for ATT only

public TimeSpan BulkInsertCommitTimeout { get; }
}
}
26 changes: 13 additions & 13 deletions src/ServiceControl.Audit.Persistence.RavenDB/RavenLicense.json
Expand Up @@ -2,18 +2,18 @@
"Id": "64c6a174-3f3a-4e7d-ac5d-b3eedd801460",
"Name": "ParticularNservicebus (Israel)",
"Keys": [
"mGE1ppvgfJjJZXnMUHFXQXJuL",
"sQ1trVf0DZlVNhFSjclHNQ36p",
"0a9ZWIaCiqu8Mh4CDVd4koc2X",
"2Y18vLYbTm5JH4J91IZJhq3bP",
"/bzD806qeBpRcDCLt82ON0+RO",
"eXiLDs/DTOBU9sPsNZEPzUX+C",
"uMA5nm6QaaB85GEpFuahhAAyU",
"GKEkFCisMLQ4vMAcREjM0NRYX",
"GhufAh8AnwIgAJ8CIwCfAiQgn",
"wIlIJ8CJiCfAicgnwIoIJ8CKS",
"CfAiognwIrIJ8CLACfAi0AnwI",
"uIJ8CLwCfAjAggQM2LjBDMEQG",
"ODk8PT6fAiEgYoRa"
"NKhWkUrAnwvE+M6VmSxK7J6am",
"D2JME/+XVMQq9xh18W4lClw+a",
"FDWF3ZqgA89/tIgwUyc8BZ09f",
"wSsdi8WzL/w01TOB00HuGQE4r",
"jAkg7BKr7LWIRfbg02KLhiU4M",
"Y1FQx8IA4BOBK0XP+X+aaWE48",
"fLmwuqGsSc0kg0rzFdYs9AAyU",
"GKEkFCisMLQ4vMAcREjM0NRYX",
"GhufAh8AnwIgAJ8CIwCfAiQgn",
"wIlIJ8CJiCfAicgnwIoIJ8CKS",
"CfAiognwIrIJ8CLACfAi0AnwI",
"uIJ8CLwCfAjAggQM2LjBDMEQG",
"ODk8PT6fAiEgYoFY"
]
}
Expand Up @@ -14,7 +14,6 @@ public class RavenPersistenceConfiguration : IPersistenceConfiguration
public const string LogPathKey = "LogPath";
public const string RavenDbLogLevelKey = "RavenDBLogLevel";
public const string MinimumStorageLeftRequiredForIngestionKey = "MinimumStorageLeftRequiredForIngestion";
public const string BulkInsertCommitTimeoutInSecondsKey = "BulkInsertCommitTimeoutInSeconds";

public IEnumerable<string> ConfigurationKeys => new[]{
DatabaseNameKey,
Expand All @@ -24,8 +23,7 @@ public class RavenPersistenceConfiguration : IPersistenceConfiguration
ExpirationProcessTimerInSecondsKey,
LogPathKey,
RavenDbLogLevelKey,
MinimumStorageLeftRequiredForIngestionKey,
BulkInsertCommitTimeoutInSecondsKey
MinimumStorageLeftRequiredForIngestionKey
};

public string Name => "RavenDB";
Expand Down Expand Up @@ -100,17 +98,14 @@ internal static DatabaseConfiguration GetDatabaseConfiguration(PersistenceSettin

var expirationProcessTimerInSeconds = GetExpirationProcessTimerInSeconds(settings);

var bulkInsertTimeout = TimeSpan.FromSeconds(GetBulkInsertCommitTimeout(settings));

return new DatabaseConfiguration(
databaseName,
expirationProcessTimerInSeconds,
settings.EnableFullTextSearchOnBodies,
settings.AuditRetentionPeriod,
settings.MaxBodySizeToStore,
minimumStorageLeftRequiredForIngestion,
serverConfiguration,
bulkInsertTimeout);
serverConfiguration);
}

static int GetExpirationProcessTimerInSeconds(PersistenceSettings settings)
Expand All @@ -137,33 +132,8 @@ static int GetExpirationProcessTimerInSeconds(PersistenceSettings settings)
return expirationProcessTimerInSeconds;
}

static int GetBulkInsertCommitTimeout(PersistenceSettings settings)
{
var bulkInsertCommitTimeoutInSeconds = BulkInsertCommitTimeoutInSecondsDefault;

if (settings.PersisterSpecificSettings.TryGetValue(BulkInsertCommitTimeoutInSecondsKey, out var bulkInsertCommitTimeoutString))
{
bulkInsertCommitTimeoutInSeconds = int.Parse(bulkInsertCommitTimeoutString);
}

if (bulkInsertCommitTimeoutInSeconds < 0)
{
Logger.Error($"BulkInsertCommitTimeout cannot be negative. Defaulting to {BulkInsertCommitTimeoutInSecondsDefault}");
return BulkInsertCommitTimeoutInSecondsDefault;
}

if (bulkInsertCommitTimeoutInSeconds > TimeSpan.FromHours(1).TotalSeconds)
{
Logger.Error($"BulkInsertCommitTimeout cannot be larger than {TimeSpan.FromHours(1).TotalSeconds}. Defaulting to {BulkInsertCommitTimeoutInSecondsDefault}");
return BulkInsertCommitTimeoutInSecondsDefault;
}

return bulkInsertCommitTimeoutInSeconds;
}

static readonly ILog Logger = LogManager.GetLogger(typeof(RavenPersistenceConfiguration));

const int ExpirationProcessTimerInSecondsDefault = 600;
const int BulkInsertCommitTimeoutInSecondsDefault = 60;
}
}
Expand Up @@ -20,7 +20,7 @@ class RavenAuditIngestionUnitOfWorkFactory : IAuditIngestionUnitOfWorkFactory

public IAuditIngestionUnitOfWork StartNew(int batchSize)
{
var timedCancellationSource = new CancellationTokenSource(databaseConfiguration.BulkInsertCommitTimeout);
var timedCancellationSource = new CancellationTokenSource(TimeSpan.FromMinutes(1));
var bulkInsert = documentStoreProvider.GetDocumentStore()
.BulkInsert(new BulkInsertOptions { SkipOverwriteIfUnchanged = true, }, timedCancellationSource.Token);

Expand Down
Expand Up @@ -27,7 +27,7 @@ public static async Task<EmbeddedDatabase> GetInstance(CancellationToken cancell
var logsMode = "Operations";
var serverUrl = $"http://localhost:{PortUtility.FindAvailablePort(33334)}";

embeddedDatabase = EmbeddedDatabase.Start(new DatabaseConfiguration("audit", 60, true, TimeSpan.FromMinutes(5), 120000, 5, new ServerConfiguration(dbPath, serverUrl, logPath, logsMode), TimeSpan.FromSeconds(60)));
embeddedDatabase = EmbeddedDatabase.Start(new DatabaseConfiguration("audit", 60, true, TimeSpan.FromMinutes(5), 120000, 5, new ServerConfiguration(dbPath, serverUrl, logPath, logsMode)));

//make sure that the database is up
while (true)
Expand Down

This file was deleted.

25 changes: 0 additions & 25 deletions src/ServiceControl.Config.Tests/FilePathExtensionsTests.cs

This file was deleted.

@@ -1,6 +1,5 @@
namespace ServiceControl.Config.Tests
{
using System;
using System.ComponentModel;
using NUnit.Framework;
using ServiceControlInstaller.Engine.Configuration.ServiceControl;
Expand All @@ -9,9 +8,6 @@

class AddErrorInstanceScreenLoadedTests
{
static readonly string programDataPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
static readonly string programX86Path = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86);

[Test]
public void Error_and_Audit_Instances_are_selected_for_install()
{
Expand Down Expand Up @@ -152,11 +148,11 @@ public void Destination_path_is_null()

var errorInfo = (INotifyDataErrorInfo)viewModel;

Assert.That(viewModel.ErrorDestinationPath, Is.EqualTo($@"{programX86Path}\Particular Software\Particular.ServiceControl"));
Assert.IsNull(viewModel.ErrorDestinationPath);

Assert.IsEmpty(errorInfo.GetErrors(nameof(viewModel.ErrorDestinationPath)));

Assert.That(viewModel.AuditDestinationPath, Is.EqualTo($@"{programX86Path}\Particular Software\Particular.ServiceControl.Audit"));
Assert.IsNull(viewModel.AuditDestinationPath);

Assert.IsEmpty(errorInfo.GetErrors(nameof(viewModel.AuditDestinationPath)));
}
Expand All @@ -168,11 +164,11 @@ public void Log_path_is_null()

var errorInfo = (INotifyDataErrorInfo)viewModel;

Assert.That(viewModel.ErrorLogPath, Is.EqualTo($@"{programDataPath}\Particular\ServiceControl\Particular.ServiceControl\Logs"));
Assert.IsNull(viewModel.ErrorLogPath);

Assert.IsEmpty(errorInfo.GetErrors(nameof(viewModel.ErrorLogPath)));

Assert.That(viewModel.AuditLogPath, Is.EqualTo($@"{programDataPath}\Particular\ServiceControl\Particular.ServiceControl.Audit\Logs"));
Assert.IsNull(viewModel.AuditLogPath);

Assert.IsEmpty(errorInfo.GetErrors(nameof(viewModel.AuditLogPath)));
}
Expand All @@ -185,11 +181,11 @@ public void Database_path_is_null()

var errorInfo = (INotifyDataErrorInfo)viewModel;

Assert.That(viewModel.ErrorDatabasePath, Is.EqualTo($@"{programDataPath}\Particular\ServiceControl\Particular.ServiceControl\DB"));
Assert.IsNull(viewModel.ErrorDatabasePath);

Assert.IsEmpty(errorInfo.GetErrors(nameof(viewModel.ErrorDatabasePath)));

Assert.That(viewModel.AuditDatabasePath, Is.EqualTo($@"{programDataPath}\Particular\ServiceControl\Particular.ServiceControl.Audit\DB"));
Assert.IsNull(viewModel.AuditDatabasePath);

Assert.IsEmpty(errorInfo.GetErrors(nameof(viewModel.AuditDatabasePath)));
}
Expand Down
Expand Up @@ -30,9 +30,9 @@ public void Convention_name_cannot_be_empty_when_instance_names_are_not_provided

var notifyErrorInfo = GetNotifyErrorInfo(viewModel);

Assert.That(instanceNamesProvided); // Provided because the convention auto-fills them on instantiation
Assert.IsFalse(instanceNamesProvided);

Assert.IsEmpty(notifyErrorInfo.GetErrors(nameof(viewModel.ConventionName)));
Assert.IsNotEmpty(notifyErrorInfo.GetErrors(nameof(viewModel.ConventionName)));
}

[Test]
Expand Down
Expand Up @@ -30,9 +30,9 @@ public void Convention_name_cannot_be_empty_when_instance_names_are_not_provided

var notifyErrorInfo = GetNotifyErrorInfo(viewModel);

Assert.That(instanceNamesProvided); // Provided because the convention default auto-fills them on instantiation
Assert.IsFalse(instanceNamesProvided);

Assert.IsEmpty(notifyErrorInfo.GetErrors(nameof(viewModel.ConventionName)));
Assert.IsNotEmpty(notifyErrorInfo.GetErrors(nameof(viewModel.ConventionName)));
}

[Test]
Expand Down

0 comments on commit 742d2d0

Please sign in to comment.