Skip to content

feat(java): migrate the TCP client to the VSR wire protocol - #3841

Merged
mmodzelewski merged 9 commits into
masterfrom
java-vsr
Aug 10, 2026
Merged

feat(java): migrate the TCP client to the VSR wire protocol#3841
mmodzelewski merged 9 commits into
masterfrom
java-vsr

Conversation

@mmodzelewski

Copy link
Copy Markdown
Member

The Java SDK spoke only the legacy TCP framing, so it could not
talk to server-ng, which frames every request in the VSR
(Viewstamped Replication) consensus protocol.

The Netty pipeline now encodes requests with VSR headers from a
per-connection consensus session (client id, request counter,
fence epoch) and decodes VSR replies, replacing the legacy frame
codec. The server binds the session to one transport connection,
so the pool pins a single channel and the connectionPoolSize
builder option is gone. Transient denials replay the same encoded
frame so the server dedup sees one request id: not-committed for
the full 30s budget (outcome unknown), not-accepted for 2s only
(refused outright, typically a demoted primary). A failed pool
acquire starts a background redial that alternates the current
node with the seed and replays the builder credentials.

The VSR broker routes explicit partitions only, so balanced and
key-based sends resolve to a concrete partition client-side
(round-robin cursor, xxh32(key) % count) and group polls pick the
partition from the member's assignment, synced through the new
consumer-group SYNC command and fenced by generation, matching
the Rust SDK. Cached routing facts refresh past a 5s staleness
budget. sendMessages returns the commit confirmation (partition
and base offset) instead of Void.

Java CI, BDD, and examples lanes run against iggy-server-ng with
the vsr feature; the SDK version bumps to 0.9.0-SNAPSHOT. On the
server side, a login whose credentials were rejected no longer
falls through to the malformed-payload rejection but reports
InvalidCredentials.

@github-actions github-actions Bot added the S-waiting-on-review PR is waiting on a reviewer label Aug 7, 2026
@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.86497% with 245 lines in your changes missing coverage. Please review.
✅ Project coverage is 32.46%. Comparing base (1ac819e) to head (b51e3bb).

Files with missing lines Patch % Lines
...ache/iggy/client/async/tcp/AsyncTcpConnection.java 73.38% 53 Missing and 17 partials ⚠️
...ache/iggy/client/async/tcp/AsyncIggyTcpClient.java 61.86% 31 Missing and 14 partials ⚠️
...pache/iggy/client/async/tcp/MessagesTcpClient.java 60.21% 29 Missing and 8 partials ⚠️
.../iggy/client/async/tcp/vsr/VsrResponseHandler.java 81.81% 12 Missing and 10 partials ⚠️
core/server-ng/src/dispatch.rs 6.25% 15 Missing ⚠️
...apache/iggy/client/async/tcp/vsr/VsrNamespace.java 80.82% 6 Missing and 8 partials ⚠️
...pache/iggy/client/async/tcp/vsr/VsrLoginCodec.java 74.35% 5 Missing and 5 partials ⚠️
...g/apache/iggy/client/async/tcp/vsr/VsrHeaders.java 57.14% 8 Missing and 1 partial ⚠️
...he/iggy/client/async/tcp/vsr/ConsensusSession.java 82.35% 2 Missing and 4 partials ⚠️
...pache/iggy/client/async/tcp/IggyAuthenticator.java 25.00% 3 Missing ⚠️
... and 10 more
Additional details and impacted files
@@              Coverage Diff              @@
##             master    #3841       +/-   ##
=============================================
- Coverage     76.62%   32.46%   -44.16%     
- Complexity     1046     1316      +270     
=============================================
  Files          1348     1375       +27     
  Lines        171070   148717    -22353     
  Branches     142405   117846    -24559     
=============================================
- Hits         131087    48288    -82799     
- Misses        36174    99154    +62980     
+ Partials       3809     1275     -2534     
Components Coverage Δ
Rust Core 20.43% <6.25%> (-55.37%) ⬇️
Java SDK 66.40% <77.94%> (+2.73%) ⬆️
C# SDK 51.93% <ø> (-20.16%) ⬇️
Python SDK 89.98% <ø> (ø)
PHP SDK 82.97% <ø> (ø)
Node SDK 96.36% <ø> (+0.08%) ⬆️
Go SDK 69.13% <ø> (-0.06%) ⬇️
Files with missing lines Coverage Δ
core/server-ng/src/auth.rs 44.70% <ø> (ø)
...apache/iggy/connector/flink/source/IggySource.java 0.00% <ø> (ø)
...apache/iggy/client/async/ConsumerGroupsClient.java 0.00% <ø> (ø)
...a/org/apache/iggy/client/async/MessagesClient.java 0.00% <ø> (ø)
...ache/iggy/client/async/tcp/ClientRoutingState.java 100.00% <100.00%> (ø)
...iggy/client/async/tcp/ConsumerGroupsTcpClient.java 100.00% <100.00%> (ø)
...apache/iggy/client/async/tcp/LoginRoutingHook.java 100.00% <100.00%> (ø)
...rg/apache/iggy/client/async/tcp/ReconnectPlan.java 100.00% <100.00%> (ø)
...y/client/blocking/tcp/ConsumerGroupsTcpClient.java 100.00% <100.00%> (ø)
...iggy/client/blocking/tcp/IggyTcpClientBuilder.java 84.21% <ø> (-0.79%) ⬇️
... and 29 more

... and 810 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mmodzelewski
mmodzelewski force-pushed the java-vsr branch 2 times, most recently from 0271112 to 2530c70 Compare August 7, 2026 20:33
The Java SDK spoke only the legacy TCP framing, so it could not
talk to server-ng, which frames every request in the VSR
(Viewstamped Replication) consensus protocol.

The Netty pipeline now encodes requests with VSR headers from a
per-connection consensus session (client id, request counter,
fence epoch) and decodes VSR replies, replacing the legacy frame
codec. The server binds the session to one transport connection,
so the pool pins a single channel and the connectionPoolSize
builder option is gone. Transient denials replay the same encoded
frame so the server dedup sees one request id: not-committed for
the full 30s budget (outcome unknown), not-accepted for 2s only
(refused outright, typically a demoted primary). A failed pool
acquire starts a background redial that alternates the current
node with the seed and replays the builder credentials.

The VSR broker routes explicit partitions only, so balanced and
key-based sends resolve to a concrete partition client-side
(round-robin cursor, xxh32(key) % count) and group polls pick the
partition from the member's assignment, synced through the new
consumer-group SYNC command and fenced by generation, matching
the Rust SDK. Cached routing facts refresh past a 5s staleness
budget. sendMessages returns the commit confirmation (partition
and base offset) instead of Void.

Java CI, BDD, and examples lanes run against iggy-server-ng with
the vsr feature; the SDK version bumps to 0.9.0-SNAPSHOT. On the
server side, a login whose credentials were rejected no longer
falls through to the malformed-payload rejection but reports
InvalidCredentials.
slbotbm
slbotbm previously requested changes Aug 8, 2026
@github-actions github-actions Bot added S-waiting-on-author PR is waiting on author response and removed S-waiting-on-review PR is waiting on a reviewer labels Aug 8, 2026
@mmodzelewski

Copy link
Copy Markdown
Member Author

@slbotbm Thanks for the review. I've addressed all the comments.

/ready

@github-actions github-actions Bot added S-waiting-on-review PR is waiting on a reviewer and removed S-waiting-on-author PR is waiting on author response labels Aug 9, 2026
numinnex
numinnex previously approved these changes Aug 10, 2026
hubcio
hubcio previously approved these changes Aug 10, 2026
numinnex
numinnex previously approved these changes Aug 10, 2026
@hubcio
hubcio dismissed slbotbm’s stale review August 10, 2026 08:34

committer fixed mentioned issues

@mmodzelewski
mmodzelewski dismissed stale reviews from numinnex and hubcio via f1681c7 August 10, 2026 08:52
@mmodzelewski
mmodzelewski merged commit 4a8394a into master Aug 10, 2026
104 checks passed
@mmodzelewski
mmodzelewski deleted the java-vsr branch August 10, 2026 09:10
@github-actions github-actions Bot removed the S-waiting-on-review PR is waiting on a reviewer label Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants