Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<Version>9.50.0</Version>
<Version>9.50.1</Version>
<LangVersion>13.0</LangVersion>
<Authors>Jeremy D. Miller;Babu Annamalai;Jaedyn Tonee</Authors>
<PackageIconUrl>https://martendb.io/logo.png</PackageIconUrl>
Expand Down
10 changes: 5 additions & 5 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -810,15 +810,15 @@
model command's spec generation, and jasperfx#1010 stops the daemon starting a shard while its
projection is being rebuilt. Neither reaches a Marten runtime path; the bump keeps the five
packages moving together, which they have since marten#5305. -->
<PackageVersion Include="JasperFx" Version="2.87.0" />
<PackageVersion Include="JasperFx.Events" Version="2.87.0" />
<PackageVersion Include="JasperFx" Version="2.87.1" />
<PackageVersion Include="JasperFx.Events" Version="2.87.1" />
<!--
The shared cross-store event sourcing compliance suites (#5116). Source-only package: the
suites compile inside EventSourcingTests so JasperFx's aggregate source generator can bind
Marten's own session types. Marten.Testing needs it too because MartenComplianceFixture,
which closes the seam, lives beside the rest of the harness.
-->
<PackageVersion Include="JasperFx.Events.ComplianceTests" Version="2.87.0" />
<PackageVersion Include="JasperFx.Events.ComplianceTests" Version="2.87.1" />
<!--
No longer ahead of the rest of the JasperFx line. As of the 2.59.0 bump (marten#5305) the
whole family moves together, and this note is kept for the history below. This package is
Expand All @@ -837,11 +837,11 @@
which does not care how the instance was constructed. The generator is otherwise byte-identical
from 2.38.0 through 2.42.0, so this is an isolated swap of that one fix.
-->
<PackageVersion Include="JasperFx.Events.SourceGenerator" Version="2.87.0">
<PackageVersion Include="JasperFx.Events.SourceGenerator" Version="2.87.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
<PackageVersion Include="JasperFx.SourceGenerator" Version="2.87.0" />
<PackageVersion Include="JasperFx.SourceGenerator" Version="2.87.1" />
<PackageVersion Include="Jil" Version="3.0.0-alpha2" />
<PackageVersion Include="Lamar" Version="7.1.1" />
<PackageVersion Include="Lamar.Microsoft.DependencyInjection" Version="15.0.0" />
Expand Down
22 changes: 22 additions & 0 deletions src/CoreTests/document_store_usage_tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,28 @@ public async Task event_store_usage_includes_global_aggregates_when_present()
usage.GlobalAggregates.ShouldContain(g => g.FullName == typeof(User).FullName);
}

// JasperFx/wolverine#5002: the database half of TryCreateUsage on its own, for Wolverine's heartbeat
[Fact]
public async Task describing_the_databases_alone_matches_the_usage()
{
var host = await BuildHost(opts =>
{
opts.DatabaseSchemaName = $"{SchemaName}_describe_databases";
});

var store = host.Services.GetRequiredService<IEventStore>();

var databases = await store.TryDescribeDatabasesAsync(CancellationToken.None);
var usage = await store.TryCreateUsage(CancellationToken.None);

databases.ShouldNotBeNull();
databases.Cardinality.ShouldBe(usage!.Database.Cardinality);
databases.MainDatabase!.DatabaseName.ShouldBe(usage.Database.MainDatabase!.DatabaseName);
databases.MainDatabase.ServerName.ShouldBe(usage.Database.MainDatabase.ServerName);
databases.Databases.Select(x => x.DatabaseName)
.ShouldBe(usage.Database.Databases.Select(x => x.DatabaseName));
}

private Task<IHost> BuildHost(Action<StoreOptions> configure)
{
return StartHostAsync(configure);
Expand Down
10 changes: 10 additions & 0 deletions src/Marten/DocumentStore.EventStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,16 @@ async Task ISubscriptionRunner<ISubscription>.ExecuteAsync(ISubscription subscri
await session.ExecuteBatchAsync(batch, token).ConfigureAwait(false);
}

/// <summary>
/// JasperFx/wolverine#5002 — just the database half of <c>TryCreateUsage</c>, straight from the tenancy.
/// Wolverine asks for it on every leader heartbeat, and the full usage also reads the highest event
/// sequence and describes every projection, subscription, event type and tag type.
/// </summary>
async Task<DatabaseUsage?> IEventStore.TryDescribeDatabasesAsync(CancellationToken token)
{
return await Options.Tenancy.DescribeDatabasesAsync(token).ConfigureAwait(false);
}

async Task<EventStoreUsage?> IEventStore.TryCreateUsage(CancellationToken token)
{
var usage = new EventStoreUsage(Subject, this)
Expand Down
Loading