Skip to content

Commit aeaff6c

Browse files
Merge pull request #163 from akkadotnet/dev
v1.4.12 Release
2 parents 53c86ec + 5549a85 commit aeaff6c

16 files changed

+1050
-186
lines changed

RELEASE_NOTES.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
#### 1.4.5 May 12 2020 ####
1+
#### 1.4.12 November 26 2020 ####
22

3-
* Bump Akka version to 1.4.5
4-
* [Fixed: InvalidCastExceptions when recovering legacy data in ToPersistenceRepresentation and ToSelectedSnapshot](https://github.com/akkadotnet/Akka.Persistence.MongoDB/issues/134)
5-
* Upgraded MongoDb driver to 2.10.4
3+
* Bump Akka version to 1.4.12
4+
* Corrected `CurrentPersistentIds` query and `AllPersistentIds` queries to be more memory efficient and query entity ID data directly from Mongo
5+
* Introduced `AllEvents` and `CurrentEvents` query to read the entire MongoDb journal
6+
* Deprecated previous `GetMaxSeqNo` behavior - we no longer query the max sequence number directly from the journal AND the metadata collection. We only get that data directly from the metadata collection itself, which should make this query an O(1) operation rather than O(n)

src/Akka.Persistence.MongoDb.Tests/Akka.Persistence.MongoDb.Tests.csproj

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@
77

88
<ItemGroup>
99
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" />
10-
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
10+
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)">
11+
<PrivateAssets>all</PrivateAssets>
12+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
13+
</PackageReference>
1114
<PackageReference Include="xunit" Version="$(XunitVersion)" />
1215
<PackageReference Include="Akka.Persistence.TCK" Version="$(AkkaVersion)" />
1316
<PackageReference Include="FluentAssertions" Version="5.10.3" />
14-
<PackageReference Include="Mongo2Go" Version="2.2.12" />
17+
<PackageReference Include="Mongo2Go" Version="2.2.14" />
1518
<PackageReference Include="System.Net.NetworkInformation" Version="4.3.0" />
1619
</ItemGroup>
1720

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
//-----------------------------------------------------------------------
2+
// <copyright file="MongoDbAllEventsSpec.cs" company="Akka.NET Project">
3+
// Copyright (C) 2017 Akka.NET Contrib <https://github.com/AkkaNetContrib/Akka.Persistence.MongoDB>
4+
// </copyright>
5+
//-----------------------------------------------------------------------
6+
7+
using Akka.Configuration;
8+
using Akka.Persistence.MongoDb.Query;
9+
using Akka.Persistence.Query;
10+
using Akka.Persistence.TCK.Query;
11+
using Akka.Util.Internal;
12+
using Xunit;
13+
using Xunit.Abstractions;
14+
15+
namespace Akka.Persistence.MongoDb.Tests
16+
{
17+
[Collection("MongoDbSpec")]
18+
public class MongoDbAllEventsSpec: AllEventsSpec, IClassFixture<DatabaseFixture>
19+
{
20+
private static Config CreateSpecConfig(DatabaseFixture databaseFixture, int id)
21+
{
22+
// akka.test.single-expect-default = 10s
23+
var specString = @"
24+
akka.test.single-expect-default = 10s
25+
akka.persistence {
26+
publish-plugin-commands = on
27+
journal {
28+
plugin = ""akka.persistence.journal.mongodb""
29+
mongodb {
30+
class = ""Akka.Persistence.MongoDb.Journal.MongoDbJournal, Akka.Persistence.MongoDb""
31+
connection-string = """ + databaseFixture.ConnectionString + id + @"""
32+
auto-initialize = on
33+
collection = ""EventJournal""
34+
}
35+
}
36+
query {
37+
mongodb {
38+
class = ""Akka.Persistence.MongoDb.Query.MongoDbReadJournalProvider, Akka.Persistence.MongoDb""
39+
refresh-interval = 1s
40+
}
41+
}
42+
}";
43+
44+
return ConfigurationFactory.ParseString(specString);
45+
}
46+
public static readonly AtomicCounter Counter = new AtomicCounter(0);
47+
48+
public MongoDbAllEventsSpec(ITestOutputHelper output, DatabaseFixture databaseFixture) : base(CreateSpecConfig(databaseFixture, Counter.GetAndIncrement()), "MongoDbAllEventsSpec", output)
49+
{
50+
ReadJournal = Sys.ReadJournalFor<MongoDbReadJournal>(MongoDbReadJournal.Identifier);
51+
}
52+
}
53+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
//-----------------------------------------------------------------------
2+
// <copyright file="MongoDbCurrentAllEventsSpec.cs" company="Akka.NET Project">
3+
// Copyright (C) 2017 Akka.NET Contrib <https://github.com/AkkaNetContrib/Akka.Persistence.MongoDB>
4+
// </copyright>
5+
//-----------------------------------------------------------------------
6+
7+
using Akka.Configuration;
8+
using Akka.Persistence.MongoDb.Query;
9+
using Akka.Persistence.Query;
10+
using Akka.Persistence.TCK.Query;
11+
using Akka.Util.Internal;
12+
using Xunit;
13+
using Xunit.Abstractions;
14+
15+
namespace Akka.Persistence.MongoDb.Tests
16+
{
17+
[Collection("MongoDbSpec")]
18+
public class MongoDbCurrentAllEventsSpec : CurrentAllEventsSpec, IClassFixture<DatabaseFixture>
19+
{
20+
private static Config CreateSpecConfig(DatabaseFixture databaseFixture, int id)
21+
{
22+
// akka.test.single-expect-default = 10s
23+
var specString = @"
24+
akka.test.single-expect-default = 10s
25+
akka.persistence {
26+
publish-plugin-commands = on
27+
journal {
28+
plugin = ""akka.persistence.journal.mongodb""
29+
mongodb {
30+
class = ""Akka.Persistence.MongoDb.Journal.MongoDbJournal, Akka.Persistence.MongoDb""
31+
connection-string = """ + databaseFixture.ConnectionString + id + @"""
32+
auto-initialize = on
33+
collection = ""EventJournal""
34+
}
35+
}
36+
query {
37+
mongodb {
38+
class = ""Akka.Persistence.MongoDb.Query.MongoDbReadJournalProvider, Akka.Persistence.MongoDb""
39+
refresh-interval = 1s
40+
}
41+
}
42+
}";
43+
44+
return ConfigurationFactory.ParseString(specString);
45+
}
46+
public static readonly AtomicCounter Counter = new AtomicCounter(0);
47+
48+
public MongoDbCurrentAllEventsSpec(ITestOutputHelper output, DatabaseFixture databaseFixture) : base(CreateSpecConfig(databaseFixture, Counter.GetAndIncrement()), "MongoDbCurrentAllEventsSpec", output)
49+
{
50+
ReadJournal = Sys.ReadJournalFor<MongoDbReadJournal>(MongoDbReadJournal.Identifier);
51+
}
52+
}
53+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using Akka.Configuration;
2+
using Akka.Persistence.TestKit.Performance;
3+
using Akka.Util.Internal;
4+
using System;
5+
using Xunit;
6+
using Xunit.Abstractions;
7+
8+
namespace Akka.Persistence.MongoDb.Tests
9+
{
10+
[Collection("MongoDbSpec")]
11+
public class MongoDbJournalPerfSpec: JournalPerfSpec, IClassFixture<DatabaseFixture>
12+
{
13+
private static Config CreateSpecConfig(DatabaseFixture databaseFixture, int id)
14+
{
15+
// akka.test.single-expect-default = 10s
16+
var specString = @"
17+
akka.persistence {
18+
publish-plugin-commands = on
19+
journal {
20+
plugin = ""akka.persistence.journal.mongodb""
21+
mongodb {
22+
class = ""Akka.Persistence.MongoDb.Journal.MongoDbJournal, Akka.Persistence.MongoDb""
23+
connection-string = """ + databaseFixture.ConnectionString + id + @"""
24+
auto-initialize = on
25+
collection = ""EventJournal""
26+
}
27+
}
28+
}";
29+
30+
return ConfigurationFactory.ParseString(specString);
31+
}
32+
public static readonly AtomicCounter Counter = new AtomicCounter(0);
33+
34+
public MongoDbJournalPerfSpec(ITestOutputHelper output, DatabaseFixture databaseFixture) : base(CreateSpecConfig(databaseFixture, Counter.GetAndIncrement()), "MongoDbJournalPerfSpec", output)
35+
{
36+
EventsCount = 1000;
37+
ExpectDuration = TimeSpan.FromMinutes(10);
38+
MeasurementIterations = 1;
39+
}
40+
}
41+
}

src/Akka.Persistence.MongoDb.Tests/MongoDbPersistenceIdsSpec.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
using Akka.Streams.TestKit;
1818
using System.Linq;
1919
using System.Diagnostics;
20+
using System.Threading.Tasks;
21+
using System.Reflection;
22+
using Reactive.Streams;
2023

2124
namespace Akka.Persistence.MongoDb.Tests
2225
{
@@ -59,7 +62,6 @@ class = ""Akka.Persistence.MongoDb.Query.MongoDbReadJournalProvider, Akka.Persis
5962

6063
return ConfigurationFactory.ParseString(specString);
6164
}
62-
6365
[Fact]
6466
public void ReadJournal_ConcurrentMessaging_should_work()
6567
{

src/Akka.Persistence.MongoDb/Akka.Persistence.MongoDb.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
</ItemGroup>
1111
<ItemGroup>
1212
<PackageReference Include="Akka.Persistence.Query" Version="$(AkkaVersion)" />
13-
<PackageReference Include="MongoDB.Driver" Version="2.10.4" />
13+
<PackageReference Include="akka.streams" Version="$(AkkaVersion)" />
14+
<PackageReference Include="MongoDB.Driver" Version="2.11.4" />
1415
</ItemGroup>
1516
</Project>

src/Akka.Persistence.MongoDb/Journal/JournalEntry.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public class JournalEntry
3535
[BsonElement("Manifest")]
3636
public string Manifest { get; set; }
3737

38+
3839
[BsonElement("Ordering")]
3940
public BsonTimestamp Ordering { get; set; }
4041

0 commit comments

Comments
 (0)