Skip to content

Commit

Permalink
Revert "Backport fixes to v5" (#4079)
Browse files Browse the repository at this point in the history
* Revert "Backport fixes to v5 (#4057)"

This reverts commit 8ea38bb.

* RavenDb License refresh

* Bump Azure.Identity from 1.10.4 to 1.11.0 (#4065) (#4084)

Bumps [Azure.Identity](https://github.com/Azure/azure-sdk-for-net) from 1.10.4 to 1.11.0.
- [Release notes](https://github.com/Azure/azure-sdk-for-net/releases)
- [Commits](Azure/azure-sdk-for-net@Azure.Identity_1.10.4...Azure.Identity_1.11.0)

---
updated-dependencies:
- dependency-name: Azure.Identity
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: John Simons <john.simons@particular.net>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
3 people committed Apr 16, 2024
1 parent 38ba643 commit 42b861a
Show file tree
Hide file tree
Showing 19 changed files with 46 additions and 286 deletions.
2 changes: 1 addition & 1 deletion src/Directory.Packages.props
Expand Up @@ -7,7 +7,7 @@

<ItemGroup Label="Versions for direct package references">
<PackageVersion Include="Autofac" Version="7.1.0" />
<PackageVersion Include="Azure.Identity" Version="1.10.4" />
<PackageVersion Include="Azure.Identity" Version="1.11.0" />
<PackageVersion Include="ByteSize" Version="2.1.1" />
<PackageVersion Include="Caliburn.Micro" Version="4.0.212" />
<PackageVersion Include="Dapper" Version="2.1.21" />
Expand Down
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; }
}
}
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 42b861a

Please sign in to comment.