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 driver/Aeron.Driver.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package >
<metadata>
<id>Aeron.Driver</id>
<version>1.49.0</version>
<version>1.51.0</version>
<title>Aeron Driver</title>
<authors>Adaptive Financial Consulting Ltd.</authors>
<owners>Adaptive Financial Consulting Ltd.</owners>
Expand Down
Binary file added driver/aeron-test-loss-generators.jar
Binary file not shown.
Binary file modified driver/media-driver.jar
Binary file not shown.
23 changes: 19 additions & 4 deletions scripts/update-version.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
#!/bin/sh
BASEDIR=$(readlink -f $(dirname "$0"))
cd $BASEDIR/..
BASEDIR=$(cd "$(dirname "$0")" && pwd)
cd "$BASEDIR/.."

if [ "$#" -ne 2 ]; then
echo "usage: $0 <FROM_VERSION> <TO_VERSION>"
exit -1
exit 1
fi

FROM_VERSION=$1
TO_VERSION=$2

sed -i s/$FROM_VERSION/$TO_VERSION/ driver/Aeron.Driver.nuspec src/Adaptive.Aeron/Adaptive.Aeron.csproj src/Adaptive.Agrona/Adaptive.Agrona.csproj src/Adaptive.Archiver/Adaptive.Archiver.csproj src/Adaptive.Cluster/Adaptive.Cluster.csproj
FROM_MINOR=$(echo "$FROM_VERSION" | cut -d. -f2)
TO_MINOR=$(echo "$TO_VERSION" | cut -d. -f2)

# GNU sed uses `-i ''` differently than BSD sed; use a portable form via -i.bak then remove backups.
sed -i.bak "s/$FROM_VERSION/$TO_VERSION/g" \
driver/Aeron.Driver.nuspec \
src/Adaptive.Aeron/Adaptive.Aeron.csproj \
src/Adaptive.Agrona/Adaptive.Agrona.csproj \
src/Adaptive.Archiver/Adaptive.Archiver.csproj \
src/Adaptive.Cluster/Adaptive.Cluster.csproj \
src/Adaptive.Aeron/AeronVersion.cs

sed -i.bak "s/MINOR_VERSION = $FROM_MINOR/MINOR_VERSION = $TO_MINOR/g" \
src/Adaptive.Aeron/AeronVersion.cs

find driver src -name '*.bak' -delete
47 changes: 47 additions & 0 deletions src/Adaptive.Aeron.Tests/SubscriptionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

using Adaptive.Aeron.LogBuffer;
using Adaptive.Aeron.Protocol;
using Adaptive.Aeron.Status;
using Adaptive.Agrona.Concurrent;
using Adaptive.Agrona.Concurrent.Status;
using FakeItEasy;
Expand Down Expand Up @@ -155,5 +156,51 @@ public void ShouldReadDataFromMultipleSources()

Assert.AreEqual(2, _subscription.Poll(_fragmentHandler, FragmentCountLimit));
}

// Cases where TryResolveChannelEndpointPort short-circuits without reading from the CountersReader.
// These cover the 1.51.0 caching/MDS-manual logic added in Subscription.cs.
// Tests that exercise LocalSocketAddressStatus lookups (active/errored bind addresses) are not
// ported yet — they require a .NET-side Allocate helper that doesn't exist today.
[TestCase("aeron:ipc")]
[TestCase("aeron:udp?control-mode=response|control=localhost:5555")]
[TestCase("aeron:udp?endpoint=localhost:8888")]
[TestCase("aeron:udp?control-mode=manual|endpoint=localhost:0")]
[TestCase("aeron:udp?control-mode=dynamic|control=localhost:7777")]
public void TryResolveChannelEndpointPortReturnsOriginalUriIfEndpointDoesNotNeedResolving(string channel)
{
const int channelStatusId = 777;
_subscription = new Subscription(
_conductor,
channel,
StreamId1,
SubscriptionCorrelationId,
_availableImageHandler,
_unavailableImageHandler
)
{
ChannelStatusId = channelStatusId
};
A.CallTo(() => _conductor.ChannelStatus(channelStatusId)).Returns(ChannelEndpointStatus.ERRORED);

Assert.AreSame(channel, _subscription.TryResolveChannelEndpointPort());
// Subsequent calls return the same cached result.
Assert.AreSame(channel, _subscription.TryResolveChannelEndpointPort());
}

[Test]
public void ShouldAcceptBrokenChannelUriAtCreationTime()
{
const string channel = "broken uri";
_subscription = new Subscription(
_conductor,
channel,
StreamId1,
SubscriptionCorrelationId,
_availableImageHandler,
_unavailableImageHandler
);

Assert.AreEqual(channel, _subscription.Channel);
}
}
}
18 changes: 18 additions & 0 deletions src/Adaptive.Aeron.sln
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unsealer.Fody", "Weavers\Un
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Adaptive.Aeron.Analyzers", "Adaptive.Aeron.Analyzers\Adaptive.Aeron.Analyzers.csproj", "{926CB849-94C6-4F3E-8B4F-1DB5157A8782}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Adaptive.Archiver.IntegrationTests", "Adaptive.Archiver.IntegrationTests\Adaptive.Archiver.IntegrationTests.csproj", "{93095200-8C85-439B-BB5E-D3440BBBF334}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -457,6 +459,22 @@ Global
{926CB849-94C6-4F3E-8B4F-1DB5157A8782}.Release|x64.Build.0 = Release|Any CPU
{926CB849-94C6-4F3E-8B4F-1DB5157A8782}.Release|x86.ActiveCfg = Release|Any CPU
{926CB849-94C6-4F3E-8B4F-1DB5157A8782}.Release|x86.Build.0 = Release|Any CPU
{93095200-8C85-439B-BB5E-D3440BBBF334}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{93095200-8C85-439B-BB5E-D3440BBBF334}.Debug|Any CPU.Build.0 = Debug|Any CPU
{93095200-8C85-439B-BB5E-D3440BBBF334}.Debug|arm64.ActiveCfg = Debug|Any CPU
{93095200-8C85-439B-BB5E-D3440BBBF334}.Debug|arm64.Build.0 = Debug|Any CPU
{93095200-8C85-439B-BB5E-D3440BBBF334}.Debug|x64.ActiveCfg = Debug|Any CPU
{93095200-8C85-439B-BB5E-D3440BBBF334}.Debug|x64.Build.0 = Debug|Any CPU
{93095200-8C85-439B-BB5E-D3440BBBF334}.Debug|x86.ActiveCfg = Debug|Any CPU
{93095200-8C85-439B-BB5E-D3440BBBF334}.Debug|x86.Build.0 = Debug|Any CPU
{93095200-8C85-439B-BB5E-D3440BBBF334}.Release|Any CPU.ActiveCfg = Release|Any CPU
{93095200-8C85-439B-BB5E-D3440BBBF334}.Release|Any CPU.Build.0 = Release|Any CPU
{93095200-8C85-439B-BB5E-D3440BBBF334}.Release|arm64.ActiveCfg = Release|Any CPU
{93095200-8C85-439B-BB5E-D3440BBBF334}.Release|arm64.Build.0 = Release|Any CPU
{93095200-8C85-439B-BB5E-D3440BBBF334}.Release|x64.ActiveCfg = Release|Any CPU
{93095200-8C85-439B-BB5E-D3440BBBF334}.Release|x64.Build.0 = Release|Any CPU
{93095200-8C85-439B-BB5E-D3440BBBF334}.Release|x86.ActiveCfg = Release|Any CPU
{93095200-8C85-439B-BB5E-D3440BBBF334}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
41 changes: 40 additions & 1 deletion src/Adaptive.Aeron/Adaptive.Aeron.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<PackageId>Aeron.Client</PackageId>
<VersionPrefix>1.49.0</VersionPrefix>
<VersionPrefix>1.51.0</VersionPrefix>
<Authors>Adaptive Financial Consulting Ltd.</Authors>
<Company>Adaptive Financial Consulting Ltd.</Company>
<Product>Aeron Client</Product>
Expand Down Expand Up @@ -49,4 +49,43 @@
<ItemGroup>
<InternalsVisibleTo Include="Adaptive.Aeron.Tests" />
</ItemGroup>
<!--
Capture the current short git SHA into AeronVersion.GIT_SHA, matching the upstream
Java aeron-client's generated AeronVersion.GIT_SHA constant (which is produced by
a Gradle annotation processor). If the working tree is dirty, "+guilty" is
appended. If git is unavailable, the value falls back to "unknown".
-->
<Target Name="GenerateAeronVersionGitSha" BeforeTargets="CoreCompile">
<Exec Command="git rev-parse --short=10 HEAD"
ConsoleToMSBuild="true"
IgnoreExitCode="true"
StandardOutputImportance="Low"
WorkingDirectory="$(MSBuildProjectDirectory)">
<Output TaskParameter="ConsoleOutput" PropertyName="_GitShaRaw" />
<Output TaskParameter="ExitCode" PropertyName="_GitShaExitCode" />
</Exec>
<Exec Command="git status --porcelain"
ConsoleToMSBuild="true"
IgnoreExitCode="true"
StandardOutputImportance="Low"
WorkingDirectory="$(MSBuildProjectDirectory)"
Condition="'$(_GitShaExitCode)' == '0'">
<Output TaskParameter="ConsoleOutput" PropertyName="_GitStatusRaw" />
</Exec>
<PropertyGroup>
<_AeronGitSha Condition="'$(_GitShaExitCode)' == '0' and '$(_GitStatusRaw)' == ''">$(_GitShaRaw)</_AeronGitSha>
<_AeronGitSha Condition="'$(_GitShaExitCode)' == '0' and '$(_GitStatusRaw)' != ''">$(_GitShaRaw)+guilty</_AeronGitSha>
<_AeronGitSha Condition="'$(_GitShaExitCode)' != '0'">unknown</_AeronGitSha>
<_GeneratedGitShaFile>$(IntermediateOutputPath)AeronVersion.GitSha.g.cs</_GeneratedGitShaFile>
</PropertyGroup>
<MakeDir Directories="$(IntermediateOutputPath)" Condition="!Exists('$(IntermediateOutputPath)')" />
<WriteLinesToFile File="$(_GeneratedGitShaFile)"
Lines="// &lt;auto-generated /&gt;%0Anamespace Adaptive.Aeron%0A{%0A public partial class AeronVersion%0A {%0A public static readonly string GIT_SHA = &quot;$(_AeronGitSha)&quot;%3B%0A }%0A}%0A"
Overwrite="true"
WriteOnlyWhenDifferent="true" />
<ItemGroup>
<Compile Include="$(_GeneratedGitShaFile)" />
<FileWrites Include="$(_GeneratedGitShaFile)" />
</ItemGroup>
</Target>
</Project>
25 changes: 15 additions & 10 deletions src/Adaptive.Aeron/Aeron.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,8 @@ static Context()
baseDirName = Path.Combine(Path.GetTempPath(), "aeron");
}

AERON_DIR_PROP_DEFAULT = baseDirName + "-" + Environment.UserName;
var userName = Environment.UserName;
AERON_DIR_PROP_DEFAULT = baseDirName + "-" + (string.IsNullOrEmpty(userName) ? "default" : userName);
}

/// <summary>
Expand Down Expand Up @@ -1487,7 +1488,8 @@ static Context()
/// <seealso cref="PRINT_CONFIGURATION_ON_START_PROP_NAME"/>
public static bool ShouldPrintConfigurationOnStart()
{
return "true".Equals(Config.GetProperty(PRINT_CONFIGURATION_ON_START_PROP_NAME));
// Use bool.TryParse for case-insensitive parsing to match Java's parseBoolean.
return bool.TryParse(Config.GetProperty(PRINT_CONFIGURATION_ON_START_PROP_NAME), out var b) && b;
}

/// <summary>
Expand All @@ -1502,7 +1504,7 @@ public static TextWriter FallbackLogger()
case "stdout":
return Console.Out;

case "noop":
case "no_op":
return new StreamWriter(Stream.Null);

case "stderr":
Expand Down Expand Up @@ -1537,7 +1539,11 @@ public Context ConcludeAeronDirectory()
{
if (null == _aeronDirectory)
{
_aeronDirectory = new DirectoryInfo(_aeronDirectoryName);
// Match Java's CommonContext.concludeAeronDirectory() which calls
// new File(name).getCanonicalFile() — normalises ./.. and resolves to the
// absolute path. Two processes referencing the same dir via different
// relative paths must agree on the canonical form to share the CnC file.
_aeronDirectory = new DirectoryInfo(Path.GetFullPath(_aeronDirectoryName));
}

return this;
Expand Down Expand Up @@ -2569,7 +2575,6 @@ public void Dispose()
_cncMetaDataBuffer?.Dispose();
_countersMetaDataBuffer?.Dispose();
_countersValuesBuffer?.Dispose();
_cncByteBuffer?.Dispose();
}

/// <summary>
Expand Down Expand Up @@ -2672,7 +2677,7 @@ private void ConnectToDriver()
{
if (clock.Time() > deadlineMs)
{
throw new DriverTimeoutException("no driver heartbeat detected.");
throw new DriverTimeoutException("no driver heartbeat detected");
}

Sleep(Configuration.AWAITING_IDLE_SLEEP_MS);
Expand All @@ -2683,7 +2688,7 @@ private void ConnectToDriver()
{
if (timeMs > deadlineMs)
{
throw new DriverTimeoutException("no driver heartbeat detected.");
throw new DriverTimeoutException("no driver heartbeat detected");
}

IoUtil.Unmap(_cncByteBuffer);
Expand Down Expand Up @@ -2769,7 +2774,7 @@ public MappedByteBuffer MapExistingCncFile(Action<string> logProgress)
{
if (null != logProgress)
{
logProgress("INFO: Aeron CnC file " + cncFile + "exists");
logProgress("INFO: Aeron CnC file exists: " + cncFile);
}

return IoUtil.MapExistingFile(cncFile, CncFileDescriptor.CNC_FILE);
Expand Down Expand Up @@ -2853,7 +2858,7 @@ MappedByteBuffer cncByteBuffer
{
if (UnixTimeConverter.CurrentUnixTimeMillis() > (startTimeMs + driverTimeoutMs))
{
throw new DriverTimeoutException("CnC file is created but not initialised.");
throw new DriverTimeoutException("CnC file is created but not initialised");
}

Sleep(1);
Expand All @@ -2866,7 +2871,7 @@ MappedByteBuffer cncByteBuffer
);

long timestampMs = toDriverBuffer.ConsumerHeartbeatTime();
long nowMs = DateTime.Now.ToFileTimeUtc();
long nowMs = UnixTimeConverter.CurrentUnixTimeMillis();
long timestampAgeMs = nowMs - timestampMs;

logger("INFO: Aeron toDriver consumer heartbeat age is (ms):" + timestampAgeMs);
Expand Down
Loading
Loading