diff --git a/Directory.Build.props b/Directory.Build.props index 951346699f..92f06b9868 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ - 9.50.0 + 9.50.1 13.0 Jeremy D. Miller;Babu Annamalai;Jaedyn Tonee https://martendb.io/logo.png diff --git a/Directory.Packages.props b/Directory.Packages.props index b3b2ec432b..4710672724 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -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. --> - - + + - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/CoreTests/document_store_usage_tests.cs b/src/CoreTests/document_store_usage_tests.cs index 96616adbad..9bf22f5785 100644 --- a/src/CoreTests/document_store_usage_tests.cs +++ b/src/CoreTests/document_store_usage_tests.cs @@ -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(); + + 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 BuildHost(Action configure) { return StartHostAsync(configure); diff --git a/src/Marten/DocumentStore.EventStore.cs b/src/Marten/DocumentStore.EventStore.cs index 2844586631..3c6b8aab1a 100644 --- a/src/Marten/DocumentStore.EventStore.cs +++ b/src/Marten/DocumentStore.EventStore.cs @@ -644,6 +644,16 @@ async Task ISubscriptionRunner.ExecuteAsync(ISubscription subscri await session.ExecuteBatchAsync(batch, token).ConfigureAwait(false); } + /// + /// JasperFx/wolverine#5002 — just the database half of TryCreateUsage, 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. + /// + async Task IEventStore.TryDescribeDatabasesAsync(CancellationToken token) + { + return await Options.Tenancy.DescribeDatabasesAsync(token).ConfigureAwait(false); + } + async Task IEventStore.TryCreateUsage(CancellationToken token) { var usage = new EventStoreUsage(Subject, this)