Skip to content

[Server] Serve clients from Armeria directly and remove the Vert.x URL transcoder - #1979

Merged
yili-db merged 4 commits into
unitycatalog:mainfrom
s-maling-celonis:upstream-pr/remove-vertx-transcoder
Oct 26, 2026
Merged

yili-db merged 4 commits into
unitycatalog:mainfrom
s-maling-celonis:upstream-pr/remove-vertx-transcoder

Conversation

@s-maling-celonis

@s-maling-celonis s-maling-celonis commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

PR Checklist

  • A description of the changes is added to the description of this PR.
  • If there is a related issue, make sure it is linked to this PR.
  • If you've fixed a bug or added code that should be tested, add tests!
  • If you've added or modified a feature, documentation in docs is updated

Description of changes

Today the launcher runs a Vert.x verticle on the client port. It forwards every request over HTTP/1.1 to Armeria on port + 1. It does one rewrite: Iceberg's nested-namespace separator %1F becomes ., in the path and in query values. Unity Catalog has no nested namespaces, so that rewrite doesn't make any request succeed. It only changes which error a client gets for a name it could never resolve.

#1918 had to size the transcoder's connection pool to the JDBC pool, and answer /livez in front of it, so a saturated proxy wouldn't become the bottleneck. Removing the transcoder makes all of that unnecessary.

This change:

  • removes URLTranscoderVerticle and the vertx-core, vertx-web and vertx-web-client dependencies;
  • binds Armeria to the -p port in main, instead of port + 1, and closes the server if it can't start;
  • binds the API port on all interfaces. Clients now connect to it directly, and the loopback bind from Bind the backend server to loopback interfaces #1750 only existed because the transcoder sat in front;
  • drops the port + 1 handling from the observability-port check;
  • updates docs/server/observability.md, which described the client port and the internal port + 1 API port.

Reasons

  • Simpler implementation: the server runs as one Armeria process on one port, with no Vert.x proxy in front.
    • About 410 lines go, including the transcoder and its 250-line test.
  • Removes the unused \^_ transcoding: Unity Catalog has no nested namespaces, so rewriting %1F to . never made a request succeed.
  • Fewer dependencies: vertx-core, vertx-web and vertx-web-client are removed, so there are fewer libraries to patch for CVEs.
  • No proxy pool to size: the workarounds [Server] Offload blocking catalog work from Armeria event loops #1918 needed go away, i.e. matching the proxy pool to JDBC and answering /livez in front of it.
  • Better tail latency under load: cheap requests no longer queue for a shared HTTP/1.1 connection pool or run through a single Vert.x thread.
    • The saving per request is small, under a millisecond; the gain is mostly in p99 under concurrency.
  • Fixes Datadog spans: spans aren't closed properly, likely because the Datadog agent doesn't support the Vert.x transcoder, so they stay open until the client drops the idle connection about 30s later.
  • No more hidden proxy behaviour: request and response bodies are no longer held in memory, there are no unconfigurable timeouts, and the code that caused bugs [Server] Fix URL transcoder hanging on responses with no body #1716 and [Server] Wait for the client-facing port before reporting the server started #1855 is gone.
  • Real client addresses: Armeria sees the caller's actual IP instead of 127.0.0.1, which helps logging and metrics.
  • HTTP/2 end to end: HTTP/2 clients reach Armeria directly instead of being downgraded to HTTP/1.1.

Behavior changes

  • The server listens on one API port. Nothing binds port + 1 any more.
  • The API port is reachable from other machines again, as it was before Bind the backend server to loopback interfaces #1750. Deployments that put a network policy in front of it are unaffected.
  • GET /v1/catalogs/{c}/namespaces/a%1Fb and GET /v1/catalogs/{c}/namespaces?parent=a%1Fb now return 404 NoSuchNamespaceException instead of 400. Neither form ever matched a schema.
  • The hostname_pattern label of http_server_requests_total now names the -p port (*:8080 by default) instead of port + 1 (*:8081). Dashboards or alerts that filter on *:8081 need updating.
  • One fewer hop and one fewer HTTP/1.1 connection pool per request. HTTP/2 clients now reach Armeria directly.

No REST API, property, or CLI changes.

Verification

  • build/sbt javafmtAll
  • build/sbt "server/testOnly io.unitycatalog.server.ArmeriaServerBuilderTest io.unitycatalog.server.UnityCatalogServerTest io.unitycatalog.server.UnityCatalogServerShutdownTest io.unitycatalog.server.EventLoopStallTest io.unitycatalog.server.service.IcebergRestCatalogTest": 42 tests. The first run had one ServerPortBindException on a random test port. IcebergRestCatalogTest then passed 26/26 on rerun.

🤖 Generated with Claude Code

@s-maling-celonis
s-maling-celonis force-pushed the upstream-pr/remove-vertx-transcoder branch 3 times, most recently from f6e01b1 to eeddeb6 Compare October 22, 2026 07:24
…L transcoder

The launcher ran a Vert.x verticle on the client port that forwarded
every request over HTTP/1.1 to Armeria on port + 1. Its only rewrite
turned Iceberg's %1F nested-namespace separator into a period. Unity
Catalog has no nested namespaces, so that rewrite only changed which
error a client got for a name it could never resolve.

Removing it means one listener, one event-loop stack, no second
connection pool to keep sized to the JDBC pool, and no Vert.x and
Netty 4.1 dependency line next to Armeria's Netty 4.2.

- main binds Armeria to the -p port instead of port + 1, and closes
  the server if it cannot start.
- The API port binds all interfaces, since clients now connect to it
  directly. The loopback bind existed only because the transcoder sat
  in front.
- A %1F namespace now reaches the Iceberg service as-is and is
  reported as a missing namespace (404) instead of a bad request.
- The http_server_requests_total hostname_pattern label now names the
  -p port (*:8080 by default) instead of port + 1 (*:8081).

Signed-off-by: s-maling-celonis <[email protected]>
@s-maling-celonis
s-maling-celonis force-pushed the upstream-pr/remove-vertx-transcoder branch from eeddeb6 to 3715b33 Compare October 22, 2026 07:34
@s-maling-celonis
s-maling-celonis marked this pull request as ready for review October 22, 2026 07:37
BaseServerTest picks two free ports with ServerSocket(0) and closes
them before the server binds, so another process can take one in
between. CI hit this as a ServerPortBindException in
AuthServiceAllowlistTest. Now that the API port binds all interfaces
instead of loopback, it can collide with more sockets.

Retry the start with fresh ports, up to three attempts, when the cause
is a ServerPortBindException. Any other start failure is thrown as
before.

Signed-off-by: s-maling-celonis <[email protected]>
@yili-db

yili-db commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

Hi @s-maling-celonis. While this Vert.x URL transcoder is largely useless for now, we are finding new use of it: running other pluggable component so that it helps to consolidate all endpoints in one single public facing listening port.
For example: #1825

So I think we'll still keep it.

@s-maling-celonis

s-maling-celonis commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor Author

@yili-db Thank you for linking to the OpenSharing use case.

I still believe this, and all the required features, are fully achievable with just Armeria. For example, I created a draft PR, #2036, which shows how Armeria can forward from the public port to OpenSharing.

In the meantime, I've also opened #2035 to bump Vert.x. A Vert.x security vulnerability and the Netty version misalignment between Vert.x and Armeria are what originally led me to investigate why both Vert.x and Armeria are used.

@yili-db

yili-db commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator

/review

@yili-db yili-db left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AI Assisted] nit: docs/integrations/unity-catalog-puppygraph.md:207 says "8081 is used by Unity Catalog", which is no longer true now that nothing binds port + 1.

// threads holding it open with nothing listening.
try {
vertx.deployVerticle(transcodeVerticle).toCompletionStage().toCompletableFuture().join();
unityCatalogServer.start();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AI Assisted] The deleted testDeploymentFailsWhenTheTranscodePortIsTaken was the only test that a taken port fails startup. Can we add one? Start a server on a port held by a ServerSocket, expect a CompletionException caused by ServerPortBindException, and check close() still succeeds.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added startFailsWhenThePortIsTaken in UnityCatalogServerTest in 53c11d9. It holds a port with a ServerSocket, expects start() to throw a CompletionException caused by ServerPortBindException, then checks that close() doesn't throw. This also covers the cause that BaseServerTest's retry depends on.

try {
vertx.deployVerticle(transcodeVerticle).toCompletionStage().toCompletableFuture().join();
unityCatalogServer.start();
} catch (CompletionException e) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AI Assisted] Only CompletionException is caught here. start() runs cleanupWorker.start() after Armeria is already listening, so a RuntimeException from it skips close() and can leave the process running with the port held. Should this catch RuntimeException?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. main() now catches RuntimeException, so a failure in cleanupWorker.start() after Armeria is listening also goes through close(). It logs the whole exception now, since an exception thrown directly has no useful cause. Fixed in 53c11d9.

// Iceberg clients join nested namespace levels with %1F. It is not rewritten to a period, so
// the name matches no schema and the namespace is reported missing.
assertErrorType(
client.get(TEST_BASE_PREFIX + "/namespaces/nested%1Fnamespace").aggregate().join(),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AI Assisted] The description also lists ?parent=a%1Fb returning 404, but only the path form is tested here. Can you add the query form too?

Also, the comment on the nested.namespace case above now reads as if that is how a nested namespace arrives. It arrives with U+001F instead, so can you reword it to say that . names are rejected as invalid, while U+001F names are simply not found?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added ?parent=nested%1Fnamespace → 404 NoSuchNamespaceException to the ListNamespaces test, next to the existing ?parent=noSuchSchema case. I also reworded the nested.namespace comment to say that names containing a period are rejected as invalid. The %1F comment below it already says those names are simply not found.

unityCatalogServer.start();
} catch (CompletionException e) {
unityCatalogServer.close();
unityCatalogServer = null;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AI Assisted] nit: on the last failed attempt, unityCatalogServer is set to null before the rethrow, so tearDown skips hibernateConfigurator.close() and the pool leaks. It only happens when setup already failed, so low priority.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. When the last start attempt fails, the injected hibernateConfigurator is now closed before the rethrow, since tearDown skips a null server.

@yili-db

yili-db commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

@yili-db Thank you for linking to the OpenSharing use case.

I still believe this, and all the required features, are fully achievable with just Armeria. For example, I created a draft PR, #2036, which shows how Armeria can forward from the public port to OpenSharing.

In the meantime, I've also opened #2035 to bump Vert.x. A Vert.x security vulnerability and the Netty version misalignment between Vert.x and Armeria are what originally led me to investigate why both Vert.x and Armeria are used.

@s-maling-celonis I think this PR is good. Removing Vert.x is the right move. Thanks!

- main closes the server on any RuntimeException from start(), not
  only a CompletionException. cleanupWorker.start() runs after Armeria
  is listening, so a failure there used to leave the port held.
- Test that a taken port fails start() with a ServerPortBindException
  cause and that close() still succeeds. The removed transcoder test
  was the only coverage of this, and BaseServerTest's retry relies on
  that cause.
- Test that ?parent=a%1Fb is a missing namespace (404), alongside the
  path form, and reword the period-name comment to say such names are
  rejected as invalid.
- BaseServerTest closes the injected Hibernate configurator when the
  last start attempt fails, since tearDown skips a null server.
- The PuppyGraph guide points at Unity Catalog on 8080 instead of 8081,
  which nothing binds any more, and no longer says 8081 is taken.

Signed-off-by: s-maling-celonis <[email protected]>
@s-maling-celonis

Copy link
Copy Markdown
Contributor Author

Thanks, fixed the line 207 note. The same guide had a second stale port: schema.json (line 144) pointed PuppyGraph's metastore at http://<host-name>:8081, where nothing listens now. It probably broke back in #1750, since 8081 was loopback-only and the PuppyGraph container couldn't reach it. It now uses 8080, the port the guide's Spark examples use.

…nto upstream-pr/remove-vertx-transcoder

Signed-off-by: s-maling-celonis <[email protected]>

# Conflicts:
#	build.sbt
#	server/src/test/java/io/unitycatalog/server/UnityCatalogServerTest.java
#	server/src/test/java/io/unitycatalog/server/base/BaseServerTest.java
@yili-db

yili-db commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

/review

@yili-db
yili-db merged commit 1308e4a into unitycatalog:main Oct 26, 2026
18 checks passed
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.

2 participants