Skip to content

Commit

Permalink
Cluster 5.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
sakno committed Jun 26, 2024
1 parent 45904b0 commit 9b86c3b
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Release Notes
====

# 06-26-2024
<a href="https://www.nuget.org/packages/dotnext.net.cluster/5.7.1">DotNext.Net.Cluster 5.7.1</a>
* Improved reliability of disk I/O for the new WAL binary format

<a href="https://www.nuget.org/packages/dotnext.aspnetcore.cluster/5.7.1">DotNext.AspNetCore.Cluster 5.7.1</a>
* Improved reliability of disk I/O for the new WAL binary format

# 06-25-2024
<a href="https://www.nuget.org/packages/dotnext.threading/5.8.0">DotNext.Threading 5.8.0</a>
* Introduced `WaitAnyAsync` method to wait on a group of cancellation tokens
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ All these things are implemented in 100% managed code on top of existing .NET AP
* [NuGet Packages](https://www.nuget.org/profiles/rvsakno)

# What's new
Release Date: 06-25-2024
Release Date: 06-26-2024

<a href="https://www.nuget.org/packages/dotnext.threading/5.8.0">DotNext.Threading 5.8.0</a>
* Introduced `WaitAnyAsync` method to wait on a group of cancellation tokens
* Added cancellation support for `WaitAsync` extension method for [WaitHandle](https://learn.microsoft.com/en-us/dotnet/api/system.threading.waithandle) class
<a href="https://www.nuget.org/packages/dotnext.net.cluster/5.7.1">DotNext.Net.Cluster 5.7.1</a>
* Improved reliability of disk I/O for the new WAL binary format

<a href="https://www.nuget.org/packages/dotnext.aspnetcore.cluster/5.7.1">DotNext.AspNetCore.Cluster 5.7.1</a>
* Improved reliability of disk I/O for the new WAL binary format

Changelog for previous versions located [here](./CHANGELOG.md).

Expand Down
6 changes: 3 additions & 3 deletions src/DotNext.Tests/Threading/Leases/LeaseTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public static async Task ConsumerTokenState()
False(consumer.Token.IsCancellationRequested);
False(consumer.Expiration.IsExpired);

await Task.Delay(150);
await Task.Delay(400);
True(consumer.Token.IsCancellationRequested);
False(await consumer.ReleaseAsync());
}
Expand Down Expand Up @@ -124,7 +124,7 @@ public static async Task AcquireUsingConsumer()
[Fact]
public static async Task WorkerProtectedWithLease()
{
var pause = TimeSpan.FromMilliseconds(100);
var pause = TimeSpan.FromMilliseconds(500);
using var provider = new TestLeaseProvider(pause);
await using var consumer = new TestLeaseConsumer(provider);
True(await consumer.TryAcquireAsync());
Expand All @@ -134,7 +134,7 @@ public static async Task WorkerProtectedWithLease()

static async Task<int> Worker(CancellationToken token)
{
await Task.Delay(TimeSpan.FromMilliseconds(250), token);
await Task.Delay(TimeSpan.FromMilliseconds(1_000), token);
return 42;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<ImplicitUsings>true</ImplicitUsings>
<IsTrimmable>true</IsTrimmable>
<Features>nullablePublicOnly</Features>
<VersionPrefix>5.7.0</VersionPrefix>
<VersionPrefix>5.7.1</VersionPrefix>
<VersionSuffix></VersionSuffix>
<Authors>.NET Foundation and Contributors</Authors>
<Product>.NEXT Family of Libraries</Product>
Expand Down
2 changes: 1 addition & 1 deletion src/cluster/DotNext.Net.Cluster/DotNext.Net.Cluster.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Nullable>enable</Nullable>
<IsTrimmable>true</IsTrimmable>
<Features>nullablePublicOnly</Features>
<VersionPrefix>5.7.0</VersionPrefix>
<VersionPrefix>5.7.1</VersionPrefix>
<VersionSuffix></VersionSuffix>
<Authors>.NET Foundation and Contributors</Authors>
<Product>.NEXT Family of Libraries</Product>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ public partial class PersistentState
private protected abstract class Partition : ConcurrentStorageAccess
{
internal const int MaxRecordsPerPartition = int.MaxValue / LogEntryMetadata.Size;
protected static readonly CacheRecord EmptyRecord = new() { PersistenceMode = CachedLogEntryPersistenceMode.CopyToBuffer };
private static readonly CacheRecord EmptyRecord = new() { PersistenceMode = CachedLogEntryPersistenceMode.CopyToBuffer };

internal readonly long FirstIndex, PartitionNumber, LastIndex;
private Partition? previous, next;
private object?[]? context;
protected MemoryOwner<CacheRecord> entryCache;
private MemoryOwner<CacheRecord> entryCache;
protected int runningIndex;

protected Partition(DirectoryInfo location, int offset, int bufferSize, int recordsPerPartition, long partitionNumber, in BufferManager manager, int readersCount, WriteMode writeMode, long initialSize, FileAttributes attributes = FileAttributes.NotContentIndexed)
Expand Down Expand Up @@ -457,19 +457,6 @@ private sealed class Table : Partition, IReadOnlyList<ReadOnlyMemory<byte>>
{
private const int HeaderSize = 512;

private static readonly ReadOnlyMemory<byte> EmptyMetadata;
private static readonly ReadOnlyMemory<byte> EphemeralMetadata;

static Table()
{
EmptyMetadata = new byte[LogEntryMetadata.Size]; // all zeroes

var ephemeral = LogEntryMetadata.Create(LogEntry.Initial, HeaderSize + LogEntryMetadata.Size, length: 0L);
var buffer = new byte[LogEntryMetadata.Size];
ephemeral.Format(buffer);
EphemeralMetadata = buffer;
}

// metadata management
private MemoryOwner<byte> header, footer;
private (ReadOnlyMemory<byte>, ReadOnlyMemory<byte>) bufferTuple;
Expand All @@ -485,7 +472,7 @@ internal Table(DirectoryInfo location, int bufferSize, int recordsPerPartition,
// init ephemeral 0 entry
if (PartitionNumber is 0L)
{
EphemeralMetadata.CopyTo(footer.Memory);
LogEntryMetadata.Create(LogEntry.Initial, HeaderSize + LogEntryMetadata.Size, length: 0L).Format(footer.Span);
}
}

Expand Down Expand Up @@ -517,6 +504,7 @@ internal override void Initialize()

fileOffset -= footer.Length;
RandomAccess.Read(Handle, footer.Span, fileOffset);
runningIndex = int.CreateChecked(LastIndex - FirstIndex);
}
else
{
Expand All @@ -534,7 +522,9 @@ internal override void Initialize()
fileOffset = HeaderSize;
}

for (Span<byte> metadataBuffer = stackalloc byte[LogEntryMetadata.Size], metadataTable = footer.Span; footerOffset < footer.Length; footerOffset += LogEntryMetadata.Size)
for (Span<byte> metadataBuffer = stackalloc byte[LogEntryMetadata.Size], metadataTable = footer.Span;
footerOffset < footer.Length;
footerOffset += LogEntryMetadata.Size, runningIndex++)
{
var count = RandomAccess.Read(Handle, metadataBuffer, fileOffset);
if (count < LogEntryMetadata.Size)
Expand Down Expand Up @@ -696,6 +686,7 @@ private async ValueTask FlushAndSealAsync(CancellationToken token)
await WriteFooterAsync(token).ConfigureAwait(false);
}

RandomAccess.FlushToDisk(Handle);
RandomAccess.SetLength(Handle, writer.FilePosition + footer.Length);

IsSealed = true;
Expand Down

0 comments on commit 9b86c3b

Please sign in to comment.