diff --git a/releasenotes.md b/releasenotes.md index a3f12b88..8e90a62d 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -1,5 +1,14 @@ # vNext +## 0.15.1 + +- Forced Mongodb drivers to use LINQ 2 provider due to excessive number of bugs for LINQ 3 +- Added support for symbol server outside of azure devops with internal builds. + +## 0.14-0.15 + +- Mostly driver updates. + ## 0.13.0 - Added multi partition read. diff --git a/src/NStore.BaseSqlPersistence/NStore.BaseSqlPersistence.csproj b/src/NStore.BaseSqlPersistence/NStore.BaseSqlPersistence.csproj index 74eaea24..d34ed61a 100644 --- a/src/NStore.BaseSqlPersistence/NStore.BaseSqlPersistence.csproj +++ b/src/NStore.BaseSqlPersistence/NStore.BaseSqlPersistence.csproj @@ -5,7 +5,13 @@ netstandard2.0;net48 netstandard2.0 https://github.com/ProximoSrl/NStore - https://github.com/ProximoSrl/NStore + https://github.com/ProximoSrl/NStore + true + true + snupkg + true + True + True Git LICENSE.md @@ -14,6 +20,13 @@ + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + diff --git a/src/NStore.Core.Tests/NStore.Core.Tests.csproj b/src/NStore.Core.Tests/NStore.Core.Tests.csproj index 30c3fac6..dae5db9b 100644 --- a/src/NStore.Core.Tests/NStore.Core.Tests.csproj +++ b/src/NStore.Core.Tests/NStore.Core.Tests.csproj @@ -18,6 +18,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/NStore.Core/NStore.Core.csproj b/src/NStore.Core/NStore.Core.csproj index 7f5eaf67..2de46fb8 100644 --- a/src/NStore.Core/NStore.Core.csproj +++ b/src/NStore.Core/NStore.Core.csproj @@ -6,6 +6,12 @@ false https://github.com/ProximoSrl/NStore https://github.com/ProximoSrl/NStore + true + true + snupkg + true + True + True Git LICENSE.md NStore.Core @@ -21,4 +27,10 @@ + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + \ No newline at end of file diff --git a/src/NStore.Domain.Tests/NStore.Domain.Tests.csproj b/src/NStore.Domain.Tests/NStore.Domain.Tests.csproj index 0d808aeb..596cdc97 100644 --- a/src/NStore.Domain.Tests/NStore.Domain.Tests.csproj +++ b/src/NStore.Domain.Tests/NStore.Domain.Tests.csproj @@ -10,6 +10,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/NStore.Domain/NStore.Domain.csproj b/src/NStore.Domain/NStore.Domain.csproj index a122eb91..170203e8 100644 --- a/src/NStore.Domain/NStore.Domain.csproj +++ b/src/NStore.Domain/NStore.Domain.csproj @@ -5,7 +5,13 @@ netstandard2.0 false https://github.com/ProximoSrl/NStore - https://github.com/ProximoSrl/NStore + https://github.com/ProximoSrl/NStore + true + true + snupkg + true + True + True Git LICENSE.md full @@ -17,6 +23,12 @@ + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + diff --git a/src/NStore.Persistence.LiteDB.Tests/NStore.Persistence.LiteDB.Tests.csproj b/src/NStore.Persistence.LiteDB.Tests/NStore.Persistence.LiteDB.Tests.csproj index 26895d19..4e5f9174 100644 --- a/src/NStore.Persistence.LiteDB.Tests/NStore.Persistence.LiteDB.Tests.csproj +++ b/src/NStore.Persistence.LiteDB.Tests/NStore.Persistence.LiteDB.Tests.csproj @@ -26,6 +26,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/NStore.Persistence.LiteDB/NStore.Persistence.LiteDB.csproj b/src/NStore.Persistence.LiteDB/NStore.Persistence.LiteDB.csproj index c5a4f120..bd7c0ff7 100644 --- a/src/NStore.Persistence.LiteDB/NStore.Persistence.LiteDB.csproj +++ b/src/NStore.Persistence.LiteDB/NStore.Persistence.LiteDB.csproj @@ -1,26 +1,33 @@ - - - netstandard2.0 - netstandard2.0;net48 - netstandard2.0 - - false - https://github.com/ProximoSrl/NStore - https://github.com/ProximoSrl/NStore - Git - full - true - - - - AssemblyInfo.cs - - - - - - - - - + + + netstandard2.0 + netstandard2.0;net48 + netstandard2.0 + + false + https://github.com/ProximoSrl/NStore + https://github.com/ProximoSrl/NStore + true + true + snupkg + Git + full + true + + + + AssemblyInfo.cs + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + \ No newline at end of file diff --git a/src/NStore.Persistence.Mongo.Tests/MongoPersistenceSpecificTests.cs b/src/NStore.Persistence.Mongo.Tests/MongoPersistenceSpecificTests.cs index e4921067..1d7e3c4d 100644 --- a/src/NStore.Persistence.Mongo.Tests/MongoPersistenceSpecificTests.cs +++ b/src/NStore.Persistence.Mongo.Tests/MongoPersistenceSpecificTests.cs @@ -245,6 +245,50 @@ public async Task Verify_that_after_append_async_we_have_intercepted_the_call() } } + public abstract class insert_id_already_existing_base : BasePersistenceTest + { + protected internal override MongoPersistenceOptions GetMongoPersistenceOptions() + { + var options = base.GetMongoPersistenceOptions(); + options.UseLocalSequence = GetUseLocalSequence(); + options.SequenceCollectionName = "sequence_test"; + return options; + } + + protected abstract bool GetUseLocalSequence(); + + [Fact] + public async Task resilient_to_multiple_persistence_write_concurrently() + { + IPersistence store2 = Create(false); + string partition1 = Guid.NewGuid().ToString(); + string partition2 = Guid.NewGuid().ToString(); + + await Store.AppendAsync(partition1, 1, new { data = "first attempt" }).ConfigureAwait(false); + //now store2 inserts a chunk with another id + await store2.AppendAsync(partition2, 1, new { data = "first attempt" }).ConfigureAwait(false); + + var chunk = await Store.AppendAsync(partition1, 2, new { data = "second data" }).ConfigureAwait(false); + Assert.Equal(3, chunk.Position); + } + } + + public class insert_id_already_existing_base_local_sequence : insert_id_already_existing_base + { + protected override bool GetUseLocalSequence() + { + return true; + } + } + + public class insert_id_already_existing_base_db_sequence : insert_id_already_existing_base + { + protected override bool GetUseLocalSequence() + { + return false; + } + } + /// /// Correctly initialize the seed when you want to use the sequence generated it /// diff --git a/src/NStore.Persistence.Mongo.Tests/NStore.Persistence.Mongo.Tests.csproj b/src/NStore.Persistence.Mongo.Tests/NStore.Persistence.Mongo.Tests.csproj index ef351b09..0413927b 100644 --- a/src/NStore.Persistence.Mongo.Tests/NStore.Persistence.Mongo.Tests.csproj +++ b/src/NStore.Persistence.Mongo.Tests/NStore.Persistence.Mongo.Tests.csproj @@ -28,6 +28,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/NStore.Persistence.Mongo/MongoPersistence.cs b/src/NStore.Persistence.Mongo/MongoPersistence.cs index 2fa19aad..f001a076 100644 --- a/src/NStore.Persistence.Mongo/MongoPersistence.cs +++ b/src/NStore.Persistence.Mongo/MongoPersistence.cs @@ -3,7 +3,6 @@ using NStore.Core.Logging; using NStore.Core.Persistence; using System; -using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Threading; @@ -72,6 +71,13 @@ private void Connect() _options.CustomizePartitionSettings(partitionsBuild); var settings = MongoClientSettings.FromUrl(partitionsBuild.ToMongoUrl()); + + //by default we will use LINQv2. There are bugs in older version of mongo < 4.4 + //and we feel safer to use the old LINQ provider. + settings.LinqProvider = MongoDB.Driver.Linq.LinqProvider.V2; + + //The caller has the option to force the use of other link provider due to customization + //of the partition client settings. _options.CustomizePartitionClientSettings(settings); var partitionsClient = new MongoClient(settings); @@ -472,6 +478,7 @@ await PushToSubscriber(0, subscription, options, filter, true, cancellationToken CancellationToken cancellationToken = default ) { + int retry = 0; while (true) { try @@ -482,6 +489,13 @@ await _chunks.InsertOneAsync(chunk, cancellationToken: cancellationToken) } catch (MongoWriteException ex) { + //Circuit breaker, if for same reason we cannot write the chunk, we need to stop the process not retrying infiinte times. + if (retry++ > 100) + { + _logger.LogError($"Error During InternalPersistAsync. Reached number of max {retry} retry count: {ex.Message}.\n{ex}"); + throw; + } + //Need to understand what kind of exception we had, some of them could lead to a retry if (ex.WriteError.Category == ServerErrorCategory.DuplicateKey) { @@ -526,7 +540,7 @@ await _chunks.InsertOneAsync(chunk, cancellationToken: cancellationToken) } } - _logger.LogError($"Error During InternalPersistAsync: {ex.Message}.\n{ex.ToString()}"); + _logger.LogError($"Error During InternalPersistAsync: {ex.Message}.\n{ex}"); throw; } } @@ -598,15 +612,17 @@ private async Task CreateIndexAsync(CancellationToken cancellationToken) private async Task ReloadSequence(CancellationToken cancellationToken = default) { var filter = Builders.Filter.Empty; - var lastSequenceNumber = await _chunks + var lastRecord = await _chunks .Find(filter) .SortByDescending(x => x.Position) - .Project(x => x.Position) + .Project(Builders.Projection.Include("_id")) .Limit(1) - .FirstOrDefaultAsync(cancellationToken: cancellationToken) + .ToCursorAsync() .ConfigureAwait(false); - this._sequence = lastSequenceNumber; + var record = await lastRecord.FirstOrDefaultAsync(cancellationToken).ConfigureAwait(false); + + this._sequence = record == null ? 0 : record["_id"].AsInt64; } private async Task EnsureFirstSequenceRecord() diff --git a/src/NStore.Persistence.Mongo/NStore.Persistence.Mongo.csproj b/src/NStore.Persistence.Mongo/NStore.Persistence.Mongo.csproj index ce1edcec..eaf9a12e 100644 --- a/src/NStore.Persistence.Mongo/NStore.Persistence.Mongo.csproj +++ b/src/NStore.Persistence.Mongo/NStore.Persistence.Mongo.csproj @@ -6,13 +6,23 @@ false https://github.com/ProximoSrl/NStore - https://github.com/ProximoSrl/NStore + https://github.com/ProximoSrl/NStore + true + true + snupkg + true + True + True Git LICENSE.md full true + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/NStore.Persistence.MsSql.Tests/NStore.Persistence.MsSql.Tests.csproj b/src/NStore.Persistence.MsSql.Tests/NStore.Persistence.MsSql.Tests.csproj index ec51edce..bf338797 100644 --- a/src/NStore.Persistence.MsSql.Tests/NStore.Persistence.MsSql.Tests.csproj +++ b/src/NStore.Persistence.MsSql.Tests/NStore.Persistence.MsSql.Tests.csproj @@ -27,6 +27,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/NStore.Persistence.MsSql/NStore.Persistence.MsSql.csproj b/src/NStore.Persistence.MsSql/NStore.Persistence.MsSql.csproj index fdf4a46e..f4b9b9c0 100644 --- a/src/NStore.Persistence.MsSql/NStore.Persistence.MsSql.csproj +++ b/src/NStore.Persistence.MsSql/NStore.Persistence.MsSql.csproj @@ -6,13 +6,23 @@ false https://github.com/ProximoSrl/NStore - https://github.com/ProximoSrl/NStore + https://github.com/ProximoSrl/NStore + true + true + snupkg + true + True + True Git LICENSE.md full true + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/NStore.Persistence.Sqlite.Tests/NStore.Persistence.Sqlite.Tests.csproj b/src/NStore.Persistence.Sqlite.Tests/NStore.Persistence.Sqlite.Tests.csproj index ab1ee9d7..9baa57a5 100644 --- a/src/NStore.Persistence.Sqlite.Tests/NStore.Persistence.Sqlite.Tests.csproj +++ b/src/NStore.Persistence.Sqlite.Tests/NStore.Persistence.Sqlite.Tests.csproj @@ -30,6 +30,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/NStore.Persistence.Sqlite/NStore.Persistence.Sqlite.csproj b/src/NStore.Persistence.Sqlite/NStore.Persistence.Sqlite.csproj index a24bf7b9..68672d6e 100644 --- a/src/NStore.Persistence.Sqlite/NStore.Persistence.Sqlite.csproj +++ b/src/NStore.Persistence.Sqlite/NStore.Persistence.Sqlite.csproj @@ -1,27 +1,34 @@ - - - netstandard2.0 - netstandard2.0;net48 - netstandard2.0 - false - https://github.com/ProximoSrl/NStore - https://github.com/ProximoSrl/NStore - Git - LICENSE.md - full - true - - - - - - - AssemblyInfo.cs - - - - - - - + + + netstandard2.0 + netstandard2.0;net48 + netstandard2.0 + false + https://github.com/ProximoSrl/NStore + https://github.com/ProximoSrl/NStore + true + true + snupkg + Git + LICENSE.md + full + true + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + AssemblyInfo.cs + + + + + + + \ No newline at end of file diff --git a/src/NStore.Persistence.Tests/NStore.Persistence.Tests.csproj b/src/NStore.Persistence.Tests/NStore.Persistence.Tests.csproj index 5a27b44d..e4b2200f 100644 --- a/src/NStore.Persistence.Tests/NStore.Persistence.Tests.csproj +++ b/src/NStore.Persistence.Tests/NStore.Persistence.Tests.csproj @@ -11,6 +11,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/NStore.Quickstart/NStore.Quickstart.csproj b/src/NStore.Quickstart/NStore.Quickstart.csproj index 7d373873..95b8a17c 100644 --- a/src/NStore.Quickstart/NStore.Quickstart.csproj +++ b/src/NStore.Quickstart/NStore.Quickstart.csproj @@ -5,6 +5,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/NStore.Sample.Tests/NStore.Sample.Tests.csproj b/src/NStore.Sample.Tests/NStore.Sample.Tests.csproj index acf0568c..ad81229c 100644 --- a/src/NStore.Sample.Tests/NStore.Sample.Tests.csproj +++ b/src/NStore.Sample.Tests/NStore.Sample.Tests.csproj @@ -9,6 +9,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/NStore.Sample/NStore.Sample.csproj b/src/NStore.Sample/NStore.Sample.csproj index 622495c1..43456aff 100644 --- a/src/NStore.Sample/NStore.Sample.csproj +++ b/src/NStore.Sample/NStore.Sample.csproj @@ -16,6 +16,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/NStore.Tpl/NStore.Tpl.csproj b/src/NStore.Tpl/NStore.Tpl.csproj index c8d3fc34..190f7081 100644 --- a/src/NStore.Tpl/NStore.Tpl.csproj +++ b/src/NStore.Tpl/NStore.Tpl.csproj @@ -1,32 +1,39 @@ - - - netstandard2.0 - netstandard2.0;net48 - netstandard2.0 - false - https://github.com/ProximoSrl/NStore - https://github.com/ProximoSrl/NStore - Git - LICENSE.md - full - true - - - - - - - - - - - - - - - - - AssemblyInfo.cs - - + + + netstandard2.0 + netstandard2.0;net48 + netstandard2.0 + false + https://github.com/ProximoSrl/NStore + https://github.com/ProximoSrl/NStore + true + true + snupkg + Git + LICENSE.md + full + true + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + AssemblyInfo.cs + + \ No newline at end of file diff --git a/src/NStore.Tutorial/NStore.Tutorial.csproj b/src/NStore.Tutorial/NStore.Tutorial.csproj index c11ec9d2..719ba646 100644 --- a/src/NStore.Tutorial/NStore.Tutorial.csproj +++ b/src/NStore.Tutorial/NStore.Tutorial.csproj @@ -15,6 +15,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/NStore.sln b/src/NStore.sln index 37310e06..5f50997f 100644 --- a/src/NStore.sln +++ b/src/NStore.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.31105.61 +# Visual Studio Version 17 +VisualStudioVersion = 17.7.33808.371 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NStore.Core", "NStore.Core\NStore.Core.csproj", "{0AAD1793-0A61-42E6-9EBC-6729058EBE70}" EndProject @@ -26,6 +26,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution .editorconfig = .editorconfig ..\LICENSE = ..\LICENSE ..\README.md = ..\README.md + ..\releasenotes.md = ..\releasenotes.md EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NStore.Tpl", "NStore.Tpl\NStore.Tpl.csproj", "{AE81867F-7915-4EF5-BF16-1B84EE147FF3}"