Skip to content

Commit

Permalink
Update RavenDB and set a time limit on bulk insert operations (#3834)
Browse files Browse the repository at this point in the history
* Adjustments for building with .NET 8 SDK

* Update RavenDB

* 1-minute cancellation token on bulk inserts

* Rename cancellation source

* Additional rename
  • Loading branch information
DavidBoike authored Nov 20, 2023
1 parent f0d78f5 commit 9f180fa
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 11 deletions.
5 changes: 5 additions & 0 deletions src/Custom.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,9 @@
<InstanceName Include="Particular.ServiceControl.Monitoring" />
</ItemGroup>

<!-- workaround for https://github.com/microsoft/MSBuildSdks/issues/477 -->
<PropertyGroup>
<UseArtifactsOutput>false</UseArtifactsOutput>
</PropertyGroup>

</Project>
4 changes: 2 additions & 2 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<PackageVersion Include="PropertyChanging.Fody" Version="1.30.3" />
<PackageVersion Include="PublicApiGenerator" Version="11.0.0" />
<PackageVersion Include="RavenDB.Database" Version="3.5.10-patch-35319" />
<PackageVersion Include="RavenDB.Embedded" Version="5.4.103" />
<PackageVersion Include="RavenDB.Embedded" Version="5.4.112" />
<PackageVersion Include="RavenDB.Tests.Helpers" Version="3.5.10-patch-35319" />
<PackageVersion Include="ReactiveUI.WPF" Version="19.2.1" />
<PackageVersion Include="Rx-Linq" Version="2.2.5" />
Expand Down Expand Up @@ -93,7 +93,7 @@
</ItemGroup>

<ItemGroup>
<GlobalPackageReference Include="Microsoft.Build.Artifacts" Version="4.2.0" />
<GlobalPackageReference Include="Microsoft.Build.Artifacts" Version="6.1.2" />
<GlobalPackageReference Include="Particular.Packaging" Version="3.0.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace ServiceControl.Audit.Persistence.RavenDb.UnitOfWork
{
using System;
using System.Threading;
using System.Threading.Tasks;
using Auditing;
using Auditing.BodyStorage;
Expand All @@ -16,12 +17,14 @@
class RavenDbAuditIngestionUnitOfWork : IAuditIngestionUnitOfWork
{
BulkInsertOperation bulkInsert;
CancellationTokenSource timedCancellationSource;
TimeSpan auditRetentionPeriod;
IBodyStorage bodyStorage;

public RavenDbAuditIngestionUnitOfWork(BulkInsertOperation bulkInsert, TimeSpan auditRetentionPeriod, IBodyStorage bodyStorage)
public RavenDbAuditIngestionUnitOfWork(BulkInsertOperation bulkInsert, CancellationTokenSource timedCancellationSource, TimeSpan auditRetentionPeriod, IBodyStorage bodyStorage)
{
this.bulkInsert = bulkInsert;
this.timedCancellationSource = timedCancellationSource;
this.auditRetentionPeriod = auditRetentionPeriod;
this.bodyStorage = bodyStorage;
}
Expand Down Expand Up @@ -70,6 +73,9 @@ public Task RecordKnownEndpoint(KnownEndpoint knownEndpoint)
=> bulkInsert.StoreAsync(knownEndpoint, GetExpirationMetadata());

public async ValueTask DisposeAsync()
=> await bulkInsert.DisposeAsync().ConfigureAwait(false);
{
await bulkInsert.DisposeAsync().ConfigureAwait(false);
timedCancellationSource.Dispose();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
namespace ServiceControl.Audit.Persistence.RavenDb.UnitOfWork
{
using System;
using System.Threading;
using Persistence.UnitOfWork;
using Raven.Client.Documents.BulkInsert;
using RavenDb;
Expand All @@ -18,12 +20,12 @@ public RavenDbAuditIngestionUnitOfWorkFactory(IRavenDbDocumentStoreProvider docu

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

return new RavenDbAuditIngestionUnitOfWork(
bulkInsert, databaseConfiguration.AuditRetentionPeriod, new RavenAttachmentsBodyStorage(sessionProvider, bulkInsert, databaseConfiguration.MaxBodySizeToStore)
bulkInsert, timedCancellationSource, databaseConfiguration.AuditRetentionPeriod, new RavenAttachmentsBodyStorage(sessionProvider, bulkInsert, databaseConfiguration.MaxBodySizeToStore)
);
}

Expand Down
8 changes: 4 additions & 4 deletions src/Setup/ServiceControl.aip
Original file line number Diff line number Diff line change
Expand Up @@ -628,15 +628,15 @@
<COMPONENT cid="caphyon.advinst.msicomp.PreReqComponent">
<ROW PrereqKey="C4FE6FD5B7C4D07B3A313E754A9A6A8" DisplayName="Visual C++ Redistributable for Visual Studio 2015-2019 x64" VersionMin="14.26" SetupFileUrl="https://download.visualstudio.microsoft.com/download/pr/d60aa805-26e9-47df-b4e3-cd6fcc392333/7D7105C52FCD6766BEEE1AE162AA81E278686122C1E44890712326634D0B055E/VC_redist.x64.exe" Location="1" ExactSize="14974616" WinNTVersions="Windows 9x/ME/NT/2000/XP/Vista/Windows 7/Windows 8 x86/Windows 8.1 x86/Windows 10 x86" WinNT64Versions="Windows Vista RTM x64, Windows Vista SP1 x64, Windows Server 2008 RTM x64, Windows 7 RTM x64, Windows Server 2008 R2 RTM x64" Operator="1" NoUiComLine="/q /norestart" Options="xy" MD5="264c296cc0bf00db6ba8e7bf8cc4e706" TargetName="Visual C++ Redistributable for Visual Studio 2015-2019"/>
<ROW PrereqKey="C676C2BD547E7A6181C255B343B7A" DisplayName=".NET Framework 4.7.2 (web installer)" SetupFileUrl="Prerequisites\.NET Framework 4.7.2\NDP472-KB4054531-Web.exe" Location="0" ExactSize="0" WinNTVersions="Windows Vista x86, Windows Server 2008 x86, Windows 7 RTM x86, Windows 10 version 1507 x86, Windows 10 version 1511 x86, Windows 10 version 1803 x86, Windows 10 version 1809 x86, Windows 10 version 1903 x86, Windows 10 version 1909 x86, Windows 10 version 2004 x86" WinNT64Versions="Windows Vista x64, Windows Server 2008 x64, Windows 7 RTM x64, Windows Server 2008 R2 RTM x64, Windows 10 version 1507 x64, Windows 10 version 1511 x64, Windows 10 version 1803 x64, Windows 10 version 1809 x64, Windows Server 2019 x64, Windows 10 version 1903 x64, Windows 10 version 1909 x64, Windows 10 version 2004 x64" Operator="1" NoUiComLine="/q /norestart" Options="xy" TargetName=".NET Framework 4.7.2\NDP472-KB4054531-Web.exe"/>
<ROW PrereqKey="C6F7BF650B714DC58735D62C12F214E4" DisplayName=".NET Runtime 7.0.5 x64" VersionMin="7.0.5" SetupFileUrl="https://download.visualstudio.microsoft.com/download/pr/4b99bbc8-917a-417c-907b-d408341726a5/78b225344fbb9b80d3da3681e1d20d68/dotnet-runtime-7.0.5-win-x64.exe" Location="1" ExactSize="28228184" WinNTVersions="Windows 9x/ME/NT/2000/XP/Vista/Windows 7/Windows 8 x86/Windows 8.1 x86/Windows 10 x86" WinNT64Versions="Windows Vista x64, Windows Server 2008 x64, Windows 7 x64, Windows Server 2008 R2 x64, Windows 8 x64, Windows 8.1 x64, Windows 10 version 1507 x64, Windows 10 version 1511 x64" Operator="1" NoUiComLine="/q /norestart" Options="y" MD5="b9eda20500d8d18a48fc2479fff64f1a" TargetName=".NET 7.0"/>
<ROW PrereqKey="E25D6A62194038942640BDE651049C" DisplayName="ASP.NET Core Runtime 7.0.5 x64" VersionMin="7.0.5" SetupFileUrl="https://download.visualstudio.microsoft.com/download/pr/02d08d3a-c846-40a9-a75d-4dcfa12b2d8d/c9d48b7ce67ad4e1356d9f3630f51cf4/aspnetcore-runtime-7.0.5-win-x64.exe" Location="1" ExactSize="9588168" WinNTVersions="Windows 9x/ME/NT/2000/XP/Vista/Windows 7/Windows 8 x86/Windows 8.1 x86/Windows 10 x86" WinNT64Versions="Windows Vista x64, Windows Server 2008 x64, Windows 7 x64, Windows Server 2008 R2 x64, Windows 8 x64, Windows 8.1 x64, Windows 10 version 1507 x64, Windows 10 version 1511 x64" Operator="1" NoUiComLine="/q /norestart" Options="xy" MD5="ab40aa8d730d3db5ddfbacf887bf0aa1" TargetName="ASP.NET Core 7.0"/>
<ROW PrereqKey="C6F7BF650B714DC58735D62C12F214E4" DisplayName=".NET Runtime 7.0.14 x64" VersionMin="7.0.14" SetupFileUrl="https://download.visualstudio.microsoft.com/download/pr/5e3be9c1-4b4c-4605-b3bc-18ef04b3c8d5/b1f864adc9c81ab6680385a4270b3887/dotnet-runtime-7.0.14-win-x64.exe" Location="1" ExactSize="28253944" WinNTVersions="Windows 9x/ME/NT/2000/XP/Vista/Windows 7/Windows 8 x86/Windows 8.1 x86/Windows 10 x86" WinNT64Versions="Windows Vista x64, Windows Server 2008 x64, Windows 7 x64, Windows Server 2008 R2 x64, Windows 8 x64, Windows 8.1 x64, Windows 10 version 1507 x64, Windows 10 version 1511 x64" Operator="1" NoUiComLine="/q /norestart" Options="y" MD5="a7bc5a0906c02f68ec3efd711b499339" TargetName=".NET 7.0"/>
<ROW PrereqKey="E25D6A62194038942640BDE651049C" DisplayName="ASP.NET Core Runtime 7.0.14 x64" VersionMin="7.0.14" SetupFileUrl="https://download.visualstudio.microsoft.com/download/pr/f066ab7a-a892-4e3c-95c5-ce87791cb03d/d41a0439ee555a5635fd87dfe86ae59a/aspnetcore-runtime-7.0.14-win-x64.exe" Location="1" ExactSize="9584880" WinNTVersions="Windows 9x/ME/NT/2000/XP/Vista/Windows 7/Windows 8 x86/Windows 8.1 x86/Windows 10 x86" WinNT64Versions="Windows Vista x64, Windows Server 2008 x64, Windows 7 x64, Windows Server 2008 R2 x64, Windows 8 x64, Windows 8.1 x64, Windows 10 version 1507 x64, Windows 10 version 1511 x64" Operator="1" NoUiComLine="/q /norestart" Options="xy" MD5="2e15f47bc5202830dbd3a75663fec068" TargetName="ASP.NET Core 7.0"/>
<ATTRIBUTE name="PrereqsOrder" value="C676C2BD547E7A6181C255B343B7A C4FE6FD5B7C4D07B3A313E754A9A6A8 C6F7BF650B714DC58735D62C12F214E4 E25D6A62194038942640BDE651049C"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.PreReqSearchComponent">
<ROW SearchKey="C4FE6FD5B7C4D07B3A313E754A9A6A8Vers" Prereq="C4FE6FD5B7C4D07B3A313E754A9A6A8" SearchType="2" SearchString="HKLM\SOFTWARE\Microsoft\DevDiv\VC\Servicing\14.0\RuntimeMinimum\Version" VerMin="14.26.28720" Order="1" Property="PreReqSearch_C4FE6FD5B7C4D07B3A313E"/>
<ROW SearchKey="C676C2BD547E7A6181C255B343B7AReleas" Prereq="C676C2BD547E7A6181C255B343B7A" SearchType="9" SearchString="HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\Release" RefContent="G461813" Order="1" Property="PreReqSearch_C676C2BD547E7A6181C255"/>
<ROW SearchKey="C6F7BF650B714DC58735D62C12F214E4M_1" Prereq="C6F7BF650B714DC58735D62C12F214E4" SearchType="12" SearchString="HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x64\sharedfx\Microsoft.NETCore.App" VerMin="7.0.5" VerMax="7.0.100" Order="2" Property="PreReqSearch_1"/>
<ROW SearchKey="E25D6A62194038942640BDE651049CASP.N" Prereq="E25D6A62194038942640BDE651049C" SearchType="1" SearchString="HKLM\SOFTWARE\Microsoft\ASP.NET Core\Shared Framework\v7.0" VerMin="7.0.5" Order="1" Property="PreReqSearch_E25D6A62194038942640BD"/>
<ROW SearchKey="C6F7BF650B714DC58735D62C12F214E4M_1" Prereq="C6F7BF650B714DC58735D62C12F214E4" SearchType="12" SearchString="HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x64\sharedfx\Microsoft.NETCore.App" VerMin="7.0.14" VerMax="7.0.100" Order="2" Property="PreReqSearch_1"/>
<ROW SearchKey="E25D6A62194038942640BDE651049CASP.N" Prereq="E25D6A62194038942640BDE651049C" SearchType="1" SearchString="HKLM\SOFTWARE\Microsoft\ASP.NET Core\Shared Framework\v7.0" VerMin="7.0.14" Order="1" Property="PreReqSearch_E25D6A62194038942640BD"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.SynchronizedFolderComponent">
<ROW Directory_="APPDIR" SourcePath="&lt;WPF_PATH&gt;" Feature="ServiceControlManagment" ExcludePattern="*~|#*#|%*%|._|CVS|.cvsignore|SCCS|vssver.scc|mssccprj.scc|vssver2.scc|.svn|.DS_Store|\*|*.vshost.*" ExcludeFlags="6" FileAddOptions="4"/>
Expand Down

0 comments on commit 9f180fa

Please sign in to comment.