You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iggy.apache.org by "lukaszzborek (via GitHub)" <gi...@apache.org> on 2026/09/01 19:08:13 UTC
[PR] refactor(csharp): update integer properties to unsigned types for consistency [iggy]
lukaszzborek opened a new pull request, #4027:
URL: https://github.com/apache/iggy/pull/4027
(no comment)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(csharp): update integer properties to unsigned types for consistency [iggy]
Posted by "lukaszzborek (via GitHub)" <gi...@apache.org>.
lukaszzborek commented on code in PR #4027:
URL: https://github.com/apache/iggy/pull/4027#discussion_r3915524355
##########
foreign/csharp/Iggy_SDK/IggyClient/Implementations/TcpMessageStream.Vsr.cs:
##########
@@ -88,7 +88,7 @@ public sealed partial class TcpMessageStream : ISessionGenerationProvider
/// <c>RESYNC_REQUIRED_PARTITION_SENTINEL</c> (<c>u32::MAX</c>). The reply header carries no status for an
/// empty poll, so the sentinel is the only channel the coordinator has to ask for a re-sync.
/// </summary>
- private const int VsrResyncRequiredPartitionSentinel = -1;
+ private const uint VsrResyncRequiredPartitionSentinel = uint.MaxValue;
Review Comment:
fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(csharp): update integer properties to unsigned types for consistency [iggy]
Posted by "lukaszzborek (via GitHub)" <gi...@apache.org>.
lukaszzborek commented on PR #4027:
URL: https://github.com/apache/iggy/pull/4027#issuecomment-5511675077
2 extra comments from @spetz was also done in this PR
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(csharp): update integer properties to unsigned types for consistency [iggy]
Posted by "hubcio (via GitHub)" <gi...@apache.org>.
hubcio commented on code in PR #4027:
URL: https://github.com/apache/iggy/pull/4027#discussion_r3908581853
##########
foreign/csharp/Iggy_SDK_Tests/MapperTests/BinaryMapper.cs:
##########
@@ -615,4 +673,199 @@ private static byte[] BuildEncryptedFrame(AesMessageEncryptor encryptor, uint of
return BinaryFactory.CreateMessageFrame(0, Guid.NewGuid(), offsetDelta, 0, cipherHeaders, cipherPayload);
}
+
+ [Fact]
+ public void MapClusterMetadata_OversizedNodesCount_Throws()
+ {
+ var payload = new byte[8];
+ BinaryPrimitives.WriteUInt32LittleEndian(payload.AsSpan(0, 4), 0); // cluster name length
+ BinaryPrimitives.WriteUInt32LittleEndian(payload.AsSpan(4, 4), uint.MaxValue); // nodes count
+
+ Assert.Throws<MalformedResponseException>(() => Mappers.BinaryMapper.MapClusterMetadata(payload));
+ }
+
+ [Fact]
+ public void MapClusterMetadata_MultiByteNodeName_KeepsWalkAligned()
+ {
+ var payload = CreateClusterMetadataPayload("cluster",
+ ("nödé-1", "10.0.0.1", 8090, 1, 1),
+ ("node-2", "10.0.0.2", 8091, 0, 1));
+
+ var metadata = Mappers.BinaryMapper.MapClusterMetadata(payload);
+
+ Assert.Equal("cluster", metadata.Name);
+ Assert.Equal(2, metadata.Nodes.Length);
+ Assert.Equal("nödé-1", metadata.Nodes[0].Name);
+ Assert.Equal("10.0.0.1", metadata.Nodes[0].Ip);
+ Assert.Equal(8090, metadata.Nodes[0].Endpoints.Tcp);
+ Assert.Equal("node-2", metadata.Nodes[1].Name);
+ Assert.Equal("10.0.0.2", metadata.Nodes[1].Ip);
+ Assert.Equal(8091, metadata.Nodes[1].Endpoints.Tcp);
+ }
+
+ [Fact]
+ public void MapClusterMetadata_TruncatedNode_Throws()
+ {
+ var payload = CreateClusterMetadataPayload("cluster", ("node-1", "10.0.0.1", 8090, 1, 1));
+ var truncated = payload.AsSpan(0, payload.Length - 3).ToArray();
+
+ Assert.ThrowsAny<SystemException>(() => Mappers.BinaryMapper.MapClusterMetadata(truncated));
Review Comment:
`MalformedResponseException` is not a `SystemException`, so this only passes because of the slicing exception from the unguarded tail. assert `Throws<MalformedResponseException>` once the tail is checked.
##########
foreign/csharp/Iggy_SDK/Mappers/BinaryMapper.cs:
##########
@@ -706,7 +720,7 @@ headers[new HeaderKey
}
var valueLength = BinaryPrimitives.ReadInt32LittleEndian(payload[position..(position + 4)]);
- if (valueLength is <= 0 or > 255)
+ if (valueLength is <= 0 or > 255 || !ValueLengthMatchesKind(valueKind, valueLength))
Review Comment:
one header with a bad width now nulls the whole `UserHeaders` map, which callers read as "no headers". throw `MalformedResponseException` from the getter instead, like `MapHeaders` does at line 641.
##########
foreign/csharp/Iggy_SDK/Mappers/BinaryMapper.cs:
##########
@@ -758,6 +772,71 @@ internal static HeaderKind MapHeaderKind(byte value)
};
}
+ /// <summary>
+ /// The typed accessors on <see cref="HeaderValue" /> slice the raw bytes by kind, so a value whose
+ /// length disagrees with its kind byte is rejected at parse time instead of throwing in the caller's
+ /// message handler.
+ /// </summary>
+ private static bool ValueLengthMatchesKind(HeaderKind kind, int length)
+ {
+ var width = HeaderKindWidth(kind);
+ return width == 0 || width == length;
+ }
+
+ private static int HeaderKindWidth(HeaderKind kind)
+ {
+ return kind switch
+ {
+ HeaderKind.Bool or HeaderKind.Int8 or HeaderKind.Uint8 => 1,
+ HeaderKind.Int16 or HeaderKind.Uint16 => 2,
+ HeaderKind.Int32 or HeaderKind.Uint32 or HeaderKind.Float => 4,
+ HeaderKind.Int64 or HeaderKind.Uint64 or HeaderKind.Double => 8,
+ HeaderKind.Int128 or HeaderKind.Uint128 => 16,
+ _ => 0
+ };
+ }
+
+ /// <summary>
+ /// The bytes left in the payload bound how many elements can exist, so a count above that is rejected
+ /// before the list is pre-sized instead of failing mid-loop.
+ /// </summary>
+ private static int ValidatedCollectionSize(uint count, int remaining, int minElementSize, string field)
+ {
+ if (count > Math.Max(remaining, 0) / minElementSize)
+ {
+ throw new MalformedResponseException(
+ $"{field} {count} exceeds remaining payload of {remaining} bytes.");
+ }
+
+ return (int)count;
+ }
+
+ /// <summary>
+ /// Length prefixes are u32 on the wire. Reading them signed would let 2^31 and above go negative and
+ /// surface as a slicing exception instead of <see cref="MalformedResponseException" />.
+ /// </summary>
+ private static int ReadLength(ReadOnlySpan<byte> payload, int position, string field)
+ {
+ var length = BinaryPrimitives.ReadUInt32LittleEndian(payload[position..(position + 4)]);
Review Comment:
also at line 1415.
this slice is unguarded, so a payload cut inside the prefix throws `ArgumentOutOfRangeException` - the exact thing the doc comment above says this helper prevents. check `position + 4 > payload.Length` first.
##########
foreign/csharp/Iggy_SDK_Tests/MapperTests/BinaryMapper.cs:
##########
@@ -615,4 +673,199 @@ private static byte[] BuildEncryptedFrame(AesMessageEncryptor encryptor, uint of
return BinaryFactory.CreateMessageFrame(0, Guid.NewGuid(), offsetDelta, 0, cipherHeaders, cipherPayload);
}
+
+ [Fact]
+ public void MapClusterMetadata_OversizedNodesCount_Throws()
+ {
+ var payload = new byte[8];
+ BinaryPrimitives.WriteUInt32LittleEndian(payload.AsSpan(0, 4), 0); // cluster name length
+ BinaryPrimitives.WriteUInt32LittleEndian(payload.AsSpan(4, 4), uint.MaxValue); // nodes count
+
+ Assert.Throws<MalformedResponseException>(() => Mappers.BinaryMapper.MapClusterMetadata(payload));
+ }
+
+ [Fact]
+ public void MapClusterMetadata_MultiByteNodeName_KeepsWalkAligned()
+ {
+ var payload = CreateClusterMetadataPayload("cluster",
+ ("nödé-1", "10.0.0.1", 8090, 1, 1),
+ ("node-2", "10.0.0.2", 8091, 0, 1));
+
+ var metadata = Mappers.BinaryMapper.MapClusterMetadata(payload);
+
+ Assert.Equal("cluster", metadata.Name);
+ Assert.Equal(2, metadata.Nodes.Length);
+ Assert.Equal("nödé-1", metadata.Nodes[0].Name);
+ Assert.Equal("10.0.0.1", metadata.Nodes[0].Ip);
+ Assert.Equal(8090, metadata.Nodes[0].Endpoints.Tcp);
+ Assert.Equal("node-2", metadata.Nodes[1].Name);
+ Assert.Equal("10.0.0.2", metadata.Nodes[1].Ip);
+ Assert.Equal(8091, metadata.Nodes[1].Endpoints.Tcp);
+ }
+
+ [Fact]
+ public void MapClusterMetadata_TruncatedNode_Throws()
+ {
+ var payload = CreateClusterMetadataPayload("cluster", ("node-1", "10.0.0.1", 8090, 1, 1));
+ var truncated = payload.AsSpan(0, payload.Length - 3).ToArray();
+
+ Assert.ThrowsAny<SystemException>(() => Mappers.BinaryMapper.MapClusterMetadata(truncated));
+ }
+
+ [Fact]
+ public void MapClusterMetadata_NameLengthExceedsPayload_Throws()
+ {
+ var payload = CreateClusterMetadataPayload("cluster", ("node-1", "10.0.0.1", 8090, 1, 1));
+ BinaryPrimitives.WriteUInt32LittleEndian(payload.AsSpan(0, 4), uint.MaxValue);
+
+ Assert.Throws<MalformedResponseException>(() => Mappers.BinaryMapper.MapClusterMetadata(payload));
+ }
+
+ [Fact]
+ public void MapClient_OversizedConsumerGroupsCount_Throws()
+ {
+ var payload = new byte[17];
+ BinaryPrimitives.WriteUInt32LittleEndian(payload.AsSpan(0, 4), 1); // client id
+ BinaryPrimitives.WriteUInt32LittleEndian(payload.AsSpan(4, 4), 1); // user id
+ payload[8] = 1; // transport tcp
+ BinaryPrimitives.WriteInt32LittleEndian(payload.AsSpan(9, 4), 0); // address length
+ BinaryPrimitives.WriteInt32LittleEndian(payload.AsSpan(13, 4), int.MaxValue); // consumer groups count
+
+ Assert.Throws<MalformedResponseException>(() => Mappers.BinaryMapper.MapClient(payload));
+ }
+
+ [Theory]
+ [InlineData(0, ClientTransport.Unknown)]
+ [InlineData(1, ClientTransport.Tcp)]
+ [InlineData(2, ClientTransport.Quic)]
+ [InlineData(3, ClientTransport.Http)]
+ [InlineData(4, ClientTransport.WebSocket)]
+ [InlineData(9, ClientTransport.Unknown)]
+ public void MapClient_MapsEveryWireTransport(byte wire, ClientTransport expected)
+ {
+ var payload = CreateClientPayload(userId: 7, transport: wire);
+
+ var response = Mappers.BinaryMapper.MapClient(payload);
+
+ Assert.Equal(expected, response.Transport);
+ Assert.Equal(7u, response.UserId);
+ }
+
+ [Fact]
+ public void MapClient_UnauthenticatedSentinel_YieldsNullUserId()
+ {
+ var payload = CreateClientPayload(userId: uint.MaxValue, transport: 1);
+
+ var response = Mappers.BinaryMapper.MapClient(payload);
+
+ Assert.Null(response.UserId);
+ }
+
+ [Theory]
+ [InlineData(5)]
+ [InlineData(6)]
+ [InlineData(200)]
+ public void MapClusterMetadata_UnknownStatus_MapsToUnknown(byte status)
+ {
+ var payload = CreateClusterMetadataPayload("cluster", ("node", "127.0.0.1", 8090, 1, status));
+
+ var metadata = Mappers.BinaryMapper.MapClusterMetadata(payload);
+
+ Assert.Equal(ClusterNodeStatus.Unknown, metadata.Nodes[0].Status);
+ }
+
+ [Fact]
+ public void MapClusterMetadata_UnknownRole_Throws()
+ {
+ var payload = CreateClusterMetadataPayload("cluster", ("node", "127.0.0.1", 8090, 2, 0));
+
+ Assert.Throws<MalformedResponseException>(() => Mappers.BinaryMapper.MapClusterMetadata(payload));
+ }
+
+ [Fact]
+ public void MapClient_AddressLengthAboveInt32_ThrowsMalformed()
+ {
+ var payload = CreateClientPayload(userId: 7, transport: 1);
+ BinaryPrimitives.WriteUInt32LittleEndian(payload.AsSpan(9, 4), 0x8000_0000);
+
+ Assert.Throws<MalformedResponseException>(() => Mappers.BinaryMapper.MapClient(payload));
+ }
+
+ private static byte[] CreateClientPayload(uint userId, byte transport)
+ {
+ var payload = new byte[17];
+ BinaryPrimitives.WriteUInt32LittleEndian(payload.AsSpan(0, 4), 1);
+ BinaryPrimitives.WriteUInt32LittleEndian(payload.AsSpan(4, 4), userId);
+ payload[8] = transport;
+ BinaryPrimitives.WriteUInt32LittleEndian(payload.AsSpan(9, 4), 0);
+ BinaryPrimitives.WriteUInt32LittleEndian(payload.AsSpan(13, 4), 0);
+ return payload;
+ }
+
+ [Fact]
+ public void MapTopics_OversizedTopicsCount_Throws()
+ {
+ var payload = new byte[4];
+ BinaryPrimitives.WriteUInt32LittleEndian(payload, uint.MaxValue);
+
+ Assert.ThrowsAny<Exception>(() => Mappers.BinaryMapper.MapTopics(payload));
Review Comment:
the path throws `MalformedResponseException` deterministically and the sibling tests at lines 684 and 734 assert it. use `Assert.Throws<MalformedResponseException>` here too.
##########
foreign/csharp/Iggy_SDK/Mappers/BinaryMapper.cs:
##########
@@ -1244,16 +1330,29 @@ var partitionId
PartitionsCount = partitionsCount,
Partitions = partitions
},
- 8 + partitionsCount * 4);
+ (int)readBytes);
}
private static (ConsumerGroupResponse consumerGroup, int readBytes) MapToConsumerGroup(ReadOnlySpan<byte> payload,
int position)
{
+ if (position + CONSUMER_GROUP_HEADER_SIZE > payload.Length)
+ {
+ throw new MalformedResponseException(
+ $"Malformed consumer group at byte {position}: {payload.Length - position} bytes cannot hold a " +
+ "consumer group header.");
+ }
+
var id = BinaryPrimitives.ReadUInt32LittleEndian(payload[position..(position + 4)]);
var partitionsCount = BinaryPrimitives.ReadUInt32LittleEndian(payload[(position + 4)..(position + 8)]);
var membersCount = BinaryPrimitives.ReadUInt32LittleEndian(payload[(position + 8)..(position + 12)]);
var nameLength = payload[position + 12];
+ if (position + CONSUMER_GROUP_HEADER_SIZE + nameLength > payload.Length)
+ {
+ throw new MalformedResponseException(
+ $"Malformed consumer group at byte {position}: name length {nameLength} does not fit the response.");
+ }
+
var name = Encoding.UTF8.GetString(payload[(position + 13)..(position + 13 + nameLength)]);
Review Comment:
`position + 13` is `CONSUMER_GROUP_HEADER_SIZE`. same for `MEMBER_HEADER_SIZE` at line 1323.
##########
foreign/csharp/Iggy_SDK/Kinds/Consumer.cs:
##########
@@ -48,6 +48,20 @@ public static Consumer New(int id)
};
}
+ /// <summary>
+ /// Creates a new regular consumer identifier.
+ /// </summary>
+ /// <param name="id">Identifier value</param>
+ /// <returns>Consumer instance</returns>
+ public static Consumer New(uint id)
Review Comment:
also at line 98.
`New(uint)` and `Group(uint)` have no callers. either use them or drop them.
##########
foreign/csharp/Iggy_SDK.Tests.Integration/ClusterRedirectionTests.cs:
##########
@@ -135,7 +135,7 @@ public async Task ConnectToFollowerWithPersonalAccessToken_Should_RedirectToLead
}
authResponse.ShouldNotBeNull();
- authResponse!.UserId.ShouldBeGreaterThanOrEqualTo(0);
+ authResponse!.UserId.ShouldBeGreaterThanOrEqualTo(0u);
Review Comment:
`>= 0u` on a `uint` always passes, so this asserts nothing now. drop it or assert `UserId.ShouldNotBe(uint.MaxValue)`.
##########
foreign/csharp/Iggy_SDK/Mappers/BinaryMapper.cs:
##########
@@ -624,12 +632,18 @@ internal static Dictionary<HeaderKey, HeaderValue> MapHeaders(ReadOnlySpan<byte>
var valueKind = MapHeaderKind(payload[position]);
position++;
- var valueLength = BinaryPrimitives.ReadInt32LittleEndian(payload[position..(position + 4)]);
- if (valueLength is 0 or > 255)
+ var valueLength = (int)BinaryPrimitives.ReadUInt32LittleEndian(payload[position..(position + 4)]);
+ if (valueLength is <= 0 or > 255)
{
throw new ArgumentException("Value has incorrect size, must be between 1 and 255", nameof(valueLength));
}
+ if (!ValueLengthMatchesKind(valueKind, valueLength))
Review Comment:
`MapHeaders` has no production callers, only tests - `TryMapHeaders` is the real path. drop it, or make it `TryMapHeaders(payload) ?? throw new MalformedResponseException(...)` so there is one parser to keep in sync.
##########
foreign/csharp/Iggy_SDK/Mappers/BinaryMapper.cs:
##########
@@ -706,7 +720,7 @@ headers[new HeaderKey
}
var valueLength = BinaryPrimitives.ReadInt32LittleEndian(payload[position..(position + 4)]);
Review Comment:
also at line 690.
still `ReadInt32LittleEndian` while `MapHeaders` moved to `ReadUInt32LittleEndian` - and this is the copy on the production path. swap both.
##########
foreign/csharp/Iggy_SDK/Contracts/Tcp/TcpContracts.cs:
##########
@@ -335,7 +335,7 @@ private static int CalculatePermissionsSize(Permissions data)
{
var size = 10;
- if (data.Streams is not null)
+ if (data.Streams is { Count: > 0 })
Review Comment:
this walks the same tree as `GetBytesFromPermissions` with hand-kept offsets, only to size a `stackalloc` that grows with the caller's streams x topics. one pass into an `ArrayBufferWriter<byte>` would drop the pre-pass and the stack risk.
##########
foreign/csharp/Iggy_SDK_Tests/Utils/BinaryFactory.cs:
##########
@@ -167,20 +167,21 @@ internal static byte[] CreatePartitionPayload(int id, int segmentsCount, int cur
internal static byte[] CreateGroupPayload(uint id, uint membersCount, uint partitionsCount, string name,
List<int>? partitionsOnMember = null)
Review Comment:
`List<int>? partitionsOnMember` and the `WriteInt32` calls below are the last signed bits in this factory now that the mapper reads `uint`. widen them.
##########
foreign/csharp/Iggy_SDK/Mappers/BinaryMapper.cs:
##########
@@ -1318,18 +1413,23 @@ private static void EnsureFits(ReadOnlySpan<byte> payload, int position, int len
internal static ClusterMetadata MapClusterMetadata(ReadOnlySpan<byte> payload)
{
var nameLength = BinaryPrimitives.ReadUInt32LittleEndian(payload[..4]);
+ if (nameLength > payload.Length - 4 - 4)
+ {
+ throw new MalformedResponseException(
+ $"Cluster name length {nameLength} exceeds remaining payload of {payload.Length - 4} bytes.");
Review Comment:
the check keeps 8 bytes back but the message says `payload.Length - 4`. `ReadString(payload, ref position, "Cluster name")` plus a 4-byte check before the nodes count read would replace this block and fix the message.
##########
foreign/csharp/Iggy_SDK/Consumers/IggyConsumer.cs:
##########
@@ -444,7 +444,7 @@ private async Task PollMessagesAsync(CancellationToken ct)
{
_logger.LogDebug("No new messages found, committing offset {Offset} for partition {PartitionId}",
lastPolledPartitionOffset, messages.PartitionId);
- await StoreOffsetAsync(lastPolledPartitionOffset, (uint)messages.PartitionId, false, ct);
+ await StoreOffsetAsync(lastPolledPartitionOffset, messages.PartitionId, false, ct);
Review Comment:
line 453 still does `AddOrUpdate` with a lambda while the rented loop switched to `_lastPolledOffset[id] = currentOffset`. same indexer here.
##########
foreign/csharp/Iggy_SDK/Mappers/BinaryMapper.cs:
##########
@@ -758,6 +772,71 @@ internal static HeaderKind MapHeaderKind(byte value)
};
}
+ /// <summary>
+ /// The typed accessors on <see cref="HeaderValue" /> slice the raw bytes by kind, so a value whose
+ /// length disagrees with its kind byte is rejected at parse time instead of throwing in the caller's
+ /// message handler.
+ /// </summary>
+ private static bool ValueLengthMatchesKind(HeaderKind kind, int length)
Review Comment:
the rust decoder rejects a key whose length doesn't match its kind too. apply this to `keyKind`/`keyLength` as well - after the null return at line 723 becomes a real error, or it just adds another silent drop.
##########
foreign/csharp/Iggy_SDK/Mappers/BinaryMapper.cs:
##########
@@ -611,8 +619,8 @@ internal static Dictionary<HeaderKey, HeaderValue> MapHeaders(ReadOnlySpan<byte>
var keyKind = MapHeaderKind(payload[position]);
position++;
- var keyLength = BinaryPrimitives.ReadInt32LittleEndian(payload[position..(position + 4)]);
- if (keyLength is 0 or > 255)
+ var keyLength = (int)BinaryPrimitives.ReadUInt32LittleEndian(payload[position..(position + 4)]);
+ if (keyLength is <= 0 or > 255)
{
throw new ArgumentException("Key has incorrect size, must be between 1 and 255", nameof(keyLength));
Review Comment:
also at line 638.
`ArgumentException` here and `MalformedResponseException` at line 643 for the same kind of bad wire data. use `MalformedResponseException` for both.
##########
foreign/csharp/Iggy_SDK/Mappers/BinaryMapper.cs:
##########
@@ -1339,37 +1439,31 @@ internal static ClusterMetadata MapClusterMetadata(ReadOnlySpan<byte> payload)
};
}
- private static ClusterNode MapClusterNode(ReadOnlySpan<byte> payload)
+ private static ClusterNode MapClusterNode(ReadOnlySpan<byte> payload, ref int position)
{
- var position = 0;
-
- // Read name
- var nameLength = BinaryPrimitives.ReadUInt32LittleEndian(payload[position..(position + 4)]);
- position += 4;
+ var name = ReadString(payload, ref position, "Cluster node name");
+ var ip = ReadString(payload, ref position, "Cluster node ip");
- var name = Encoding.UTF8.GetString(payload[position..(position + (int)nameLength)]);
- position += (int)nameLength;
-
- // Read IP
- var ipLength = BinaryPrimitives.ReadUInt32LittleEndian(payload[position..(position + 4)]);
- position += 4;
-
- var ip = Encoding.UTF8.GetString(payload[position..(position + (int)ipLength)]);
- position += (int)ipLength;
-
- // Read transport endpoints (4 ports, each 2 bytes)
var tcp = BinaryPrimitives.ReadUInt16LittleEndian(payload[position..(position + 2)]);
Review Comment:
nothing checks that the 10-byte tail fits, so a truncated node throws `ArgumentOutOfRangeException` instead of `MalformedResponseException` like the other mappers. add `if (position + 10 > payload.Length) throw new MalformedResponseException(...)` first.
##########
foreign/csharp/Iggy_SDK.Tests.Integration/PersonalAccessTokenTests.cs:
##########
@@ -91,7 +91,7 @@ public async Task LoginWithPersonalAccessToken_Should_Be_Successfully(Protocol p
var authResponse = await loginClient.LoginWithPersonalAccessTokenAsync(response!.Token);
authResponse.ShouldNotBeNull();
- authResponse.UserId.ShouldBeGreaterThanOrEqualTo(0);
+ authResponse.UserId.ShouldBeGreaterThanOrEqualTo(0u);
Review Comment:
always true on a `uint`. drop it or assert `UserId.ShouldNotBe(uint.MaxValue)`.
##########
foreign/csharp/Iggy_SDK/Mappers/BinaryMapper.cs:
##########
@@ -1309,7 +1404,7 @@ private static void EnsureFits(ReadOnlySpan<byte> payload, int position, int len
{
Review Comment:
`EnsureFits` has one caller left after this change (line 1377). inline it.
##########
foreign/csharp/Iggy_SDK/Kinds/Partitioning.cs:
##########
@@ -72,6 +72,24 @@ public static Partitioning PartitionId(int value)
};
}
+ /// <summary>
+ /// Creates a partitioning strategy that use a specific partition id.
+ /// </summary>
+ /// <param name="value">Partition id</param>
+ /// <returns>Partitioning instance</returns>
+ public static Partitioning PartitionId(uint value)
Review Comment:
the `int` overload above duplicates this body and lets `PartitionId(-1)` send partition 4294967295. make it forward: `ArgumentOutOfRangeException.ThrowIfNegative(value); return PartitionId((uint)value);` - same for `Consumer.New`/`Group` and `Identifier.Numeric`.
##########
foreign/csharp/Iggy_SDK.Tests.Integration/SystemTests.cs:
##########
@@ -141,7 +141,7 @@ await client.SendMessagesAsync(Identifier.String(streamName),
var response = await client.GetStatsAsync();
response.ShouldNotBeNull();
- response.ProcessId.ShouldBeGreaterThanOrEqualTo(0);
+ response.ProcessId.ShouldBeGreaterThanOrEqualTo(0u);
Review Comment:
always true on a `uint`. drop it or assert `ProcessId.ShouldNotBe(0u)`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(csharp): update integer properties to unsigned types for consistency [iggy]
Posted by "lukaszzborek (via GitHub)" <gi...@apache.org>.
lukaszzborek commented on code in PR #4027:
URL: https://github.com/apache/iggy/pull/4027#discussion_r3909032239
##########
foreign/csharp/Iggy_SDK/Kinds/Consumer.cs:
##########
@@ -48,6 +48,20 @@ public static Consumer New(int id)
};
}
+ /// <summary>
+ /// Creates a new regular consumer identifier.
+ /// </summary>
+ /// <param name="id">Identifier value</param>
+ /// <returns>Consumer instance</returns>
+ public static Consumer New(uint id)
Review Comment:
kept, `int` overloads now forward to `uint` ones
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(csharp): update integer properties to unsigned types for consistency [iggy]
Posted by "lukaszzborek (via GitHub)" <gi...@apache.org>.
lukaszzborek commented on code in PR #4027:
URL: https://github.com/apache/iggy/pull/4027#discussion_r3909033736
##########
foreign/csharp/Iggy_SDK/Mappers/BinaryMapper.cs:
##########
@@ -706,7 +720,7 @@ headers[new HeaderKey
}
var valueLength = BinaryPrimitives.ReadInt32LittleEndian(payload[position..(position + 4)]);
- if (valueLength is <= 0 or > 255)
+ if (valueLength is <= 0 or > 255 || !ValueLengthMatchesKind(valueKind, valueLength))
Review Comment:
moved to `MapHeaders` and throw `MalformedResponseException`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(csharp): update integer properties to unsigned types for consistency [iggy]
Posted by "hubcio (via GitHub)" <gi...@apache.org>.
hubcio commented on code in PR #4027:
URL: https://github.com/apache/iggy/pull/4027#discussion_r3915781087
##########
foreign/csharp/Iggy_SDK/Mappers/BinaryMapper.cs:
##########
@@ -773,25 +795,15 @@ private static bool TryMapHeaderKind(byte value, out HeaderKind kind)
private static Dictionary<HeaderKey, HeaderValue> MapOptions(ReadOnlySpan<byte> payload, int position,
out int readBytes)
{
- // Every length here is server-controlled. Read the block length as long
- // so a value above int.MaxValue cannot wrap negative, and bound each
- // entry against the block before slicing: an entry that overruns `end`
- // would otherwise be accepted and silently consume the response bytes
- // that follow the block.
- var optionsLength = BinaryPrimitives.ReadUInt32LittleEndian(payload[position..(position + 4)]);
- var available = (long)payload.Length - (position + 4);
- if (optionsLength > available)
- {
- throw new MalformedResponseException(
- $"Malformed options block at byte {position}: declared length {optionsLength} exceeds the " +
- $"{available} bytes remaining in the payload.");
- }
-
- readBytes = 4 + (int)optionsLength;
+ // Every length here is server-controlled. Bound each entry against the
+ // block before slicing: an entry that overruns `end` would otherwise be
+ // accepted and silently consume the response bytes that follow the block.
+ var optionsLength = ReadLength(payload, position, "Options block");
+ readBytes = 4 + optionsLength;
var options = new Dictionary<HeaderKey, HeaderValue>();
var cursor = position + 4;
- var end = cursor + (int)optionsLength;
+ var end = cursor + optionsLength;
while (cursor < end)
{
var keyKindCode = ReadOptionByte(payload, ref cursor, end, position);
Review Comment:
`MapOptions` never runs `ValueLengthMatchesKind`, so a 3-byte `Uint64` option parses clean here and then throws out of `BitConverter.ToUInt64` in the caller. rust checks the width on this path too - add the same check `MapHeaders` does.
##########
foreign/csharp/Iggy_SDK/Vsr/ConsumerGroupClientState.cs:
##########
@@ -38,12 +38,15 @@ internal sealed class ConsumerGroupClientState
/// <summary>Nothing tells this client when another one resizes a topic, so the count expires on its own.</summary>
private const long PartitionCountTtlMs = 30_000;
- /// <summary>True when a non-empty assignment is cached for the group.</summary>
+ /// <summary>
+ /// True when an assignment is cached for the group, even one holding zero partitions. Treating an empty
+ /// assignment as missing would re-sync on every poll of a member that owns nothing.
+ /// </summary>
internal bool HasAssignment(GroupKey key)
Review Comment:
a zero-partition member now only picks up a rebalance on the next ping, so pickup latency is whatever `HeartbeatInterval` happens to be - and that knob says nothing about assignments. give `GroupAssignment` its own TTL like go's `assignmentRefreshInterval`.
##########
foreign/csharp/Iggy_SDK/Contracts/PolledMessages.cs:
##########
@@ -22,10 +22,17 @@ namespace Apache.Iggy.Contracts;
/// </summary>
public sealed class PolledMessages
{
+ /// <summary>
+ /// Partition id an empty group poll reports when the member currently owns no partition of the group,
+ /// for example mid-rebalance or when the group has more members than partitions. Matches the Go and
+ /// Node SDKs. Consumers should back off before polling again rather than spin.
+ /// </summary>
+ public const uint NO_ASSIGNED_PARTITION = 0xFFFF_FFFE;
Review Comment:
this is the only `public const` in the SDK and the only public SCREAMING_SNAKE name - everything else in that style is internal. rename to `NoAssignedPartition` before release, it is breaking after.
##########
foreign/csharp/Iggy_SDK/Consumers/IggyConsumer.cs:
##########
@@ -409,6 +416,12 @@ private async Task PollMessagesAsync(CancellationToken ct)
if (messages.Messages.Count == 0)
{
+ if (messages.PartitionId == PolledMessages.NO_ASSIGNED_PARTITION)
+ {
+ LogNoPartitionAssignedBackingOff(NoAssignedPartitionBackoffMs);
+ await Task.Delay(NoAssignedPartitionBackoffMs, ct);
Review Comment:
pre-existing, but this delay makes it fire on every shutdown: there is no `catch (OperationCanceledException)` rethrow here like `IggyConsumer.Rented.cs:198` has, so cancelling mid-delay gets published as a `Failed to poll messages` error. add the same rethrow.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(csharp): update integer properties to unsigned types for consistency [iggy]
Posted by "lukaszzborek (via GitHub)" <gi...@apache.org>.
lukaszzborek commented on code in PR #4027:
URL: https://github.com/apache/iggy/pull/4027#discussion_r3917071425
##########
foreign/csharp/Iggy_SDK/Vsr/ConsumerGroupClientState.cs:
##########
@@ -38,12 +38,15 @@ internal sealed class ConsumerGroupClientState
/// <summary>Nothing tells this client when another one resizes a topic, so the count expires on its own.</summary>
private const long PartitionCountTtlMs = 30_000;
- /// <summary>True when a non-empty assignment is cached for the group.</summary>
+ /// <summary>
+ /// True when an assignment is cached for the group, even one holding zero partitions. Treating an empty
+ /// assignment as missing would re-sync on every poll of a member that owns nothing.
+ /// </summary>
internal bool HasAssignment(GroupKey key)
Review Comment:
added TTL.
I also found that rust have similar behaviour like this (only resync during heartbeat). It would be good to verify thit
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(csharp): update integer properties to unsigned types for consistency [iggy]
Posted by "lukaszzborek (via GitHub)" <gi...@apache.org>.
lukaszzborek commented on code in PR #4027:
URL: https://github.com/apache/iggy/pull/4027#discussion_r3909035736
##########
foreign/csharp/Iggy_SDK/Mappers/BinaryMapper.cs:
##########
@@ -624,12 +632,18 @@ internal static Dictionary<HeaderKey, HeaderValue> MapHeaders(ReadOnlySpan<byte>
var valueKind = MapHeaderKind(payload[position]);
position++;
- var valueLength = BinaryPrimitives.ReadInt32LittleEndian(payload[position..(position + 4)]);
- if (valueLength is 0 or > 255)
+ var valueLength = (int)BinaryPrimitives.ReadUInt32LittleEndian(payload[position..(position + 4)]);
+ if (valueLength is <= 0 or > 255)
{
throw new ArgumentException("Value has incorrect size, must be between 1 and 255", nameof(valueLength));
}
+ if (!ValueLengthMatchesKind(valueKind, valueLength))
Review Comment:
dropped `TryMapHeaders`, `MapHeaders` is the single parser now
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(csharp): update integer properties to unsigned types for consistency [iggy]
Posted by "hubcio (via GitHub)" <gi...@apache.org>.
hubcio merged PR #4027:
URL: https://github.com/apache/iggy/pull/4027
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(csharp): update integer properties to unsigned types for consistency [iggy]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #4027:
URL: https://github.com/apache/iggy/pull/4027#issuecomment-5499100725
## [Codecov](https://app.codecov.io/gh/apache/iggy/pull/4027?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `69.69697%` with `60 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 83.96%. Comparing base ([`831b2a6`](https://app.codecov.io/gh/apache/iggy/commit/831b2a652ba71af89497aca9a08e2b8742d61e03?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`99bbcdc`](https://app.codecov.io/gh/apache/iggy/commit/99bbcdc05605e5fd97308fbb84f80067906d6da0?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 1 commits behind head on master.
| [Files with missing lines](https://app.codecov.io/gh/apache/iggy/pull/4027?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [foreign/csharp/Iggy\_SDK/Mappers/BinaryMapper.cs](https://app.codecov.io/gh/apache/iggy/pull/4027?src=pr&el=tree&filepath=foreign%2Fcsharp%2FIggy_SDK%2FMappers%2FBinaryMapper.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9jc2hhcnAvSWdneV9TREsvTWFwcGVycy9CaW5hcnlNYXBwZXIuY3M=) | 82.80% | [22 Missing and 5 partials :warning: ](https://app.codecov.io/gh/apache/iggy/pull/4027?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [foreign/csharp/Iggy\_SDK/Kinds/Consumer.cs](https://app.codecov.io/gh/apache/iggy/pull/4027?src=pr&el=tree&filepath=foreign%2Fcsharp%2FIggy_SDK%2FKinds%2FConsumer.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9jc2hhcnAvSWdneV9TREsvS2luZHMvQ29uc3VtZXIuY3M=) | 0.00% | [14 Missing :warning: ](https://app.codecov.io/gh/apache/iggy/pull/4027?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [foreign/csharp/Iggy\_SDK/Kinds/Partitioning.cs](https://app.codecov.io/gh/apache/iggy/pull/4027?src=pr&el=tree&filepath=foreign%2Fcsharp%2FIggy_SDK%2FKinds%2FPartitioning.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9jc2hhcnAvSWdneV9TREsvS2luZHMvUGFydGl0aW9uaW5nLmNz) | 0.00% | [10 Missing :warning: ](https://app.codecov.io/gh/apache/iggy/pull/4027?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...eign/csharp/Iggy\_SDK/Contracts/Tcp/TcpContracts.cs](https://app.codecov.io/gh/apache/iggy/pull/4027?src=pr&el=tree&filepath=foreign%2Fcsharp%2FIggy_SDK%2FContracts%2FTcp%2FTcpContracts.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9jc2hhcnAvSWdneV9TREsvQ29udHJhY3RzL1RjcC9UY3BDb250cmFjdHMuY3M=) | 20.00% | [2 Missing and 2 partials :warning: ](https://app.codecov.io/gh/apache/iggy/pull/4027?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [foreign/csharp/Iggy\_SDK/Consumers/IggyConsumer.cs](https://app.codecov.io/gh/apache/iggy/pull/4027?src=pr&el=tree&filepath=foreign%2Fcsharp%2FIggy_SDK%2FConsumers%2FIggyConsumer.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9jc2hhcnAvSWdneV9TREsvQ29uc3VtZXJzL0lnZ3lDb25zdW1lci5jcw==) | 50.00% | [2 Missing :warning: ](https://app.codecov.io/gh/apache/iggy/pull/4027?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...n/csharp/Iggy\_SDK/Consumers/IggyConsumer.Rented.cs](https://app.codecov.io/gh/apache/iggy/pull/4027?src=pr&el=tree&filepath=foreign%2Fcsharp%2FIggy_SDK%2FConsumers%2FIggyConsumer.Rented.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9jc2hhcnAvSWdneV9TREsvQ29uc3VtZXJzL0lnZ3lDb25zdW1lci5SZW50ZWQuY3M=) | 66.66% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/iggy/pull/4027?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...DK/IggyClient/Implementations/HttpMessageStream.cs](https://app.codecov.io/gh/apache/iggy/pull/4027?src=pr&el=tree&filepath=foreign%2Fcsharp%2FIggy_SDK%2FIggyClient%2FImplementations%2FHttpMessageStream.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9jc2hhcnAvSWdneV9TREsvSWdneUNsaWVudC9JbXBsZW1lbnRhdGlvbnMvSHR0cE1lc3NhZ2VTdHJlYW0uY3M=) | 50.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/iggy/pull/4027?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...IggyClient/Implementations/TcpMessageStream.Vsr.cs](https://app.codecov.io/gh/apache/iggy/pull/4027?src=pr&el=tree&filepath=foreign%2Fcsharp%2FIggy_SDK%2FIggyClient%2FImplementations%2FTcpMessageStream.Vsr.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9jc2hhcnAvSWdneV9TREsvSWdneUNsaWVudC9JbXBsZW1lbnRhdGlvbnMvVGNwTWVzc2FnZVN0cmVhbS5Wc3IuY3M=) | 50.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/iggy/pull/4027?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #4027 +/- ##
============================================
- Coverage 85.13% 83.96% -1.18%
Complexity 1402 1402
============================================
Files 1226 1225 -1
Lines 181308 181384 +76
Branches 147612 147625 +13
============================================
- Hits 154359 152301 -2058
- Misses 22902 25130 +2228
+ Partials 4047 3953 -94
```
| [Components](https://app.codecov.io/gh/apache/iggy/pull/4027/components?src=pr&el=components&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [Rust Core](https://app.codecov.io/gh/apache/iggy/pull/4027/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `86.06% <ø> (ø)` | |
| [Java SDK](https://app.codecov.io/gh/apache/iggy/pull/4027/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `67.29% <ø> (ø)` | |
| [C# SDK](https://app.codecov.io/gh/apache/iggy/pull/4027/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `50.64% <69.69%> (-24.74%)` | :arrow_down: |
| [Python SDK](https://app.codecov.io/gh/apache/iggy/pull/4027/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `90.06% <ø> (ø)` | |
| [PHP SDK](https://app.codecov.io/gh/apache/iggy/pull/4027/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `85.65% <ø> (ø)` | |
| [Node SDK](https://app.codecov.io/gh/apache/iggy/pull/4027/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `96.24% <ø> (ø)` | |
| [Go SDK](https://app.codecov.io/gh/apache/iggy/pull/4027/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `69.31% <ø> (ø)` | |
| [Files with missing lines](https://app.codecov.io/gh/apache/iggy/pull/4027?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [...ign/csharp/Iggy\_SDK/Contracts/Auth/AuthResponse.cs](https://app.codecov.io/gh/apache/iggy/pull/4027?src=pr&el=tree&filepath=foreign%2Fcsharp%2FIggy_SDK%2FContracts%2FAuth%2FAuthResponse.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9jc2hhcnAvSWdneV9TREsvQ29udHJhY3RzL0F1dGgvQXV0aFJlc3BvbnNlLmNz) | `100.00% <100.00%> (ø)` | |
| [foreign/csharp/Iggy\_SDK/Contracts/ClientInfo.cs](https://app.codecov.io/gh/apache/iggy/pull/4027?src=pr&el=tree&filepath=foreign%2Fcsharp%2FIggy_SDK%2FContracts%2FClientInfo.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9jc2hhcnAvSWdneV9TREsvQ29udHJhY3RzL0NsaWVudEluZm8uY3M=) | `100.00% <ø> (ø)` | |
| [...oreign/csharp/Iggy\_SDK/Contracts/PolledMessages.cs](https://app.codecov.io/gh/apache/iggy/pull/4027?src=pr&el=tree&filepath=foreign%2Fcsharp%2FIggy_SDK%2FContracts%2FPolledMessages.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9jc2hhcnAvSWdneV9TREsvQ29udHJhY3RzL1BvbGxlZE1lc3NhZ2VzLmNz) | `0.00% <ø> (ø)` | |
| [.../csharp/Iggy\_SDK/Contracts/PolledMessagesRental.cs](https://app.codecov.io/gh/apache/iggy/pull/4027?src=pr&el=tree&filepath=foreign%2Fcsharp%2FIggy_SDK%2FContracts%2FPolledMessagesRental.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9jc2hhcnAvSWdneV9TREsvQ29udHJhY3RzL1BvbGxlZE1lc3NhZ2VzUmVudGFsLmNz) | `100.00% <ø> (ø)` | |
| [foreign/csharp/Iggy\_SDK/Contracts/StatsResponse.cs](https://app.codecov.io/gh/apache/iggy/pull/4027?src=pr&el=tree&filepath=foreign%2Fcsharp%2FIggy_SDK%2FContracts%2FStatsResponse.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9jc2hhcnAvSWdneV9TREsvQ29udHJhY3RzL1N0YXRzUmVzcG9uc2UuY3M=) | `100.00% <ø> (ø)` | |
| [...oreign/csharp/Iggy\_SDK/Contracts/StreamResponse.cs](https://app.codecov.io/gh/apache/iggy/pull/4027?src=pr&el=tree&filepath=foreign%2Fcsharp%2FIggy_SDK%2FContracts%2FStreamResponse.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9jc2hhcnAvSWdneV9TREsvQ29udHJhY3RzL1N0cmVhbVJlc3BvbnNlLmNz) | `100.00% <ø> (ø)` | |
| [...n/csharp/Iggy\_SDK/Consumers/IggyConsumer.Rented.cs](https://app.codecov.io/gh/apache/iggy/pull/4027?src=pr&el=tree&filepath=foreign%2Fcsharp%2FIggy_SDK%2FConsumers%2FIggyConsumer.Rented.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9jc2hhcnAvSWdneV9TREsvQ29uc3VtZXJzL0lnZ3lDb25zdW1lci5SZW50ZWQuY3M=) | `60.52% <66.66%> (-8.17%)` | :arrow_down: |
| [...DK/IggyClient/Implementations/HttpMessageStream.cs](https://app.codecov.io/gh/apache/iggy/pull/4027?src=pr&el=tree&filepath=foreign%2Fcsharp%2FIggy_SDK%2FIggyClient%2FImplementations%2FHttpMessageStream.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9jc2hhcnAvSWdneV9TREsvSWdneUNsaWVudC9JbXBsZW1lbnRhdGlvbnMvSHR0cE1lc3NhZ2VTdHJlYW0uY3M=) | `19.37% <50.00%> (-55.44%)` | :arrow_down: |
| [...IggyClient/Implementations/TcpMessageStream.Vsr.cs](https://app.codecov.io/gh/apache/iggy/pull/4027?src=pr&el=tree&filepath=foreign%2Fcsharp%2FIggy_SDK%2FIggyClient%2FImplementations%2FTcpMessageStream.Vsr.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9jc2hhcnAvSWdneV9TREsvSWdneUNsaWVudC9JbXBsZW1lbnRhdGlvbnMvVGNwTWVzc2FnZVN0cmVhbS5Wc3IuY3M=) | `45.79% <50.00%> (-29.91%)` | :arrow_down: |
| [foreign/csharp/Iggy\_SDK/Consumers/IggyConsumer.cs](https://app.codecov.io/gh/apache/iggy/pull/4027?src=pr&el=tree&filepath=foreign%2Fcsharp%2FIggy_SDK%2FConsumers%2FIggyConsumer.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9jc2hhcnAvSWdneV9TREsvQ29uc3VtZXJzL0lnZ3lDb25zdW1lci5jcw==) | `50.00% <50.00%> (-23.58%)` | :arrow_down: |
| ... and [4 more](https://app.codecov.io/gh/apache/iggy/pull/4027?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | |
... and [47 files with indirect coverage changes](https://app.codecov.io/gh/apache/iggy/pull/4027/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(csharp): update integer properties to unsigned types for consistency [iggy]
Posted by "hubcio (via GitHub)" <gi...@apache.org>.
hubcio commented on code in PR #4027:
URL: https://github.com/apache/iggy/pull/4027#discussion_r3912226867
##########
foreign/csharp/Iggy_SDK/IggyClient/Implementations/TcpMessageStream.Vsr.cs:
##########
@@ -88,7 +88,7 @@ public sealed partial class TcpMessageStream : ISessionGenerationProvider
/// <c>RESYNC_REQUIRED_PARTITION_SENTINEL</c> (<c>u32::MAX</c>). The reply header carries no status for an
/// empty poll, so the sentinel is the only channel the coordinator has to ask for a re-sync.
/// </summary>
- private const int VsrResyncRequiredPartitionSentinel = -1;
+ private const uint VsrResyncRequiredPartitionSentinel = uint.MaxValue;
Review Comment:
pre-existing, not this PR: a member holding zero partitions fails `HasAssignment`, so every poll re-syncs the group, returns empty, and the consumer re-polls with no delay unless `PollingIntervalMs > 0`. mark that empty reply with the `0xFFFF_FFFE` no-assigned-partition sentinel go and node use, and back off in the consumer when it sees it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org