Skip to content

Commit 9f180fa

Browse files
authored
Update RavenDB and set a time limit on bulk insert operations (#3834)
* Adjustments for building with .NET 8 SDK * Update RavenDB * 1-minute cancellation token on bulk inserts * Rename cancellation source * Additional rename
1 parent f0d78f5 commit 9f180fa

File tree

5 files changed

+24
-11
lines changed

5 files changed

+24
-11
lines changed

src/Custom.Build.props

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,9 @@
2424
<InstanceName Include="Particular.ServiceControl.Monitoring" />
2525
</ItemGroup>
2626

27+
<!-- workaround for https://github.com/microsoft/MSBuildSdks/issues/477 -->
28+
<PropertyGroup>
29+
<UseArtifactsOutput>false</UseArtifactsOutput>
30+
</PropertyGroup>
31+
2732
</Project>

src/Directory.Packages.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
<PackageVersion Include="PropertyChanging.Fody" Version="1.30.3" />
6464
<PackageVersion Include="PublicApiGenerator" Version="11.0.0" />
6565
<PackageVersion Include="RavenDB.Database" Version="3.5.10-patch-35319" />
66-
<PackageVersion Include="RavenDB.Embedded" Version="5.4.103" />
66+
<PackageVersion Include="RavenDB.Embedded" Version="5.4.112" />
6767
<PackageVersion Include="RavenDB.Tests.Helpers" Version="3.5.10-patch-35319" />
6868
<PackageVersion Include="ReactiveUI.WPF" Version="19.2.1" />
6969
<PackageVersion Include="Rx-Linq" Version="2.2.5" />
@@ -93,7 +93,7 @@
9393
</ItemGroup>
9494

9595
<ItemGroup>
96-
<GlobalPackageReference Include="Microsoft.Build.Artifacts" Version="4.2.0" />
96+
<GlobalPackageReference Include="Microsoft.Build.Artifacts" Version="6.1.2" />
9797
<GlobalPackageReference Include="Particular.Packaging" Version="3.0.0" />
9898
</ItemGroup>
9999

src/ServiceControl.Audit.Persistence.RavenDb5/UnitOfWork/RavenDbAuditIngestionUnitOfWork.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
namespace ServiceControl.Audit.Persistence.RavenDb.UnitOfWork
22
{
33
using System;
4+
using System.Threading;
45
using System.Threading.Tasks;
56
using Auditing;
67
using Auditing.BodyStorage;
@@ -16,12 +17,14 @@
1617
class RavenDbAuditIngestionUnitOfWork : IAuditIngestionUnitOfWork
1718
{
1819
BulkInsertOperation bulkInsert;
20+
CancellationTokenSource timedCancellationSource;
1921
TimeSpan auditRetentionPeriod;
2022
IBodyStorage bodyStorage;
2123

22-
public RavenDbAuditIngestionUnitOfWork(BulkInsertOperation bulkInsert, TimeSpan auditRetentionPeriod, IBodyStorage bodyStorage)
24+
public RavenDbAuditIngestionUnitOfWork(BulkInsertOperation bulkInsert, CancellationTokenSource timedCancellationSource, TimeSpan auditRetentionPeriod, IBodyStorage bodyStorage)
2325
{
2426
this.bulkInsert = bulkInsert;
27+
this.timedCancellationSource = timedCancellationSource;
2528
this.auditRetentionPeriod = auditRetentionPeriod;
2629
this.bodyStorage = bodyStorage;
2730
}
@@ -70,6 +73,9 @@ public Task RecordKnownEndpoint(KnownEndpoint knownEndpoint)
7073
=> bulkInsert.StoreAsync(knownEndpoint, GetExpirationMetadata());
7174

7275
public async ValueTask DisposeAsync()
73-
=> await bulkInsert.DisposeAsync().ConfigureAwait(false);
76+
{
77+
await bulkInsert.DisposeAsync().ConfigureAwait(false);
78+
timedCancellationSource.Dispose();
79+
}
7480
}
7581
}

src/ServiceControl.Audit.Persistence.RavenDb5/UnitOfWork/RavenDbAuditUnitOfWorkFactory.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
namespace ServiceControl.Audit.Persistence.RavenDb.UnitOfWork
22
{
3+
using System;
4+
using System.Threading;
35
using Persistence.UnitOfWork;
46
using Raven.Client.Documents.BulkInsert;
57
using RavenDb;
@@ -18,12 +20,12 @@ public RavenDbAuditIngestionUnitOfWorkFactory(IRavenDbDocumentStoreProvider docu
1820

1921
public IAuditIngestionUnitOfWork StartNew(int batchSize)
2022
{
23+
var timedCancellationSource = new CancellationTokenSource(TimeSpan.FromMinutes(1));
2124
var bulkInsert = documentStoreProvider.GetDocumentStore()
22-
.BulkInsert(
23-
options: new BulkInsertOptions { SkipOverwriteIfUnchanged = true, });
25+
.BulkInsert(new BulkInsertOptions { SkipOverwriteIfUnchanged = true, }, timedCancellationSource.Token);
2426

2527
return new RavenDbAuditIngestionUnitOfWork(
26-
bulkInsert, databaseConfiguration.AuditRetentionPeriod, new RavenAttachmentsBodyStorage(sessionProvider, bulkInsert, databaseConfiguration.MaxBodySizeToStore)
28+
bulkInsert, timedCancellationSource, databaseConfiguration.AuditRetentionPeriod, new RavenAttachmentsBodyStorage(sessionProvider, bulkInsert, databaseConfiguration.MaxBodySizeToStore)
2729
);
2830
}
2931

src/Setup/ServiceControl.aip

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -628,15 +628,15 @@
628628
<COMPONENT cid="caphyon.advinst.msicomp.PreReqComponent">
629629
<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"/>
630630
<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"/>
631-
<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"/>
632-
<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"/>
631+
<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"/>
632+
<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"/>
633633
<ATTRIBUTE name="PrereqsOrder" value="C676C2BD547E7A6181C255B343B7A C4FE6FD5B7C4D07B3A313E754A9A6A8 C6F7BF650B714DC58735D62C12F214E4 E25D6A62194038942640BDE651049C"/>
634634
</COMPONENT>
635635
<COMPONENT cid="caphyon.advinst.msicomp.PreReqSearchComponent">
636636
<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"/>
637637
<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"/>
638-
<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"/>
639-
<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"/>
638+
<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"/>
639+
<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"/>
640640
</COMPONENT>
641641
<COMPONENT cid="caphyon.advinst.msicomp.SynchronizedFolderComponent">
642642
<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"/>

0 commit comments

Comments
 (0)