Conversation
Add contrib/datalake_agent, the Java gRPC service that datalake_fdw talks to over the contract in contrib/datalake_agent/proto. This establishes the process, transport, error and version handling, configuration, and logging scaffolding before Iceberg operations and catalog providers fill in RPC bodies. Startup runs in this order: Main builds the Guice graph; the server registers every service and binds the endpoint with grpc.health.v1.Health answering NOT_SERVING, then becomes ready: it starts the parent-process watchdog (--parent.pid) and flips health to SERVING. Until then a business call is answered UNAVAILABLE "dlagent is not ready", which a client may retry since the call did not run. Handlers run on a bounded pool. Any startup failure exits 1. Default transport is a Unix domain socket with configured file mode, guarded by a lock on <socket>.lock that the agent holds for its lifetime, so a second agent on the same path refuses to start rather than take the socket over; TCP requires TLS and a mode-0600 bearer token file supporting live rotation. Every failure returns an ErrorDetail with BusinessErrorCode, retryable flag, and correlation id; unexpected exceptions return a generic INTERNAL without leaking stack traces. Every response carries contract version headers, and incompatible clients are refused with FAILED_PRECONDITION. All IcebergCatalogService RPCs (and opt-in CatalogManagementService RPCs) currently answer UNIMPLEMENTED naming the RPC. Settings come from the packaged application.properties, overridden by the environment and by --key=value arguments, with relaxed binding and placeholders as Spring Boot defines them; they hold process settings only. The agent logs to dlagent-YYYY-MM-DD.log under --logging.file.path (default $COORDINATOR_DATA_DIRECTORY/log; with neither it refuses to start), with java.util.logging bridged in. RequestOptionMapper maps datalake_fdw server and user mapping options to Iceberg catalog/FileIO properties while keeping credentials in StorageConfig.credentials. A Log4j rewrite policy scrubs request credentials and bearer tokens across agent, Netty, and gRPC logs. Add unit, in-process, UDS, TCP/TLS, process-level (cold start, logging, watchdog), and credential-scrubbing tests under mvn -B verify along with the datalake-agent CI workflow. Closes apache#2011.
Replace the default stub metadata engine with the gRPC-backed agent engine (src/meta/engine_agent) and add DL_ERR_CONFLICT (reported as serialization failure) to distinguish optimistic concurrency conflicts from I/O or internal errors. Split the client cleanly across a plain C boundary: agent_engine.c runs in PostgreSQL (settings, MetaCtx conversion, wait events, per-backend RPC accounting for EXPLAIN ANALYZE), while agent_rpc.cpp drives gRPC completion-queue polls with signal masking and query cancellation checks without including server headers or letting C++ exceptions/longjmps cross. Carry the table lifecycle family (CreateTable, LoadTable, DropTable, TableExists) with an initial health/version handshake, ErrorDetail-based error mapping, credentials routed via StorageConfig.credentials, and build-time stub generation from contrib/datalake_agent/proto and fragment.proto, with LLVM bitcode rules for the generated sources. Builds without gRPC still succeed and report clear errors on agent calls. Add datalake_fdw.meta_engine_for_testing for stub-only regression clusters. An agent that is still starting is waited for: a handshake answered NOT_SERVING, and a call the agent's readiness gate refused with UNAVAILABLE "dlagent is not ready", are tried again every 200 ms within the RPC's one deadline, with the cancel check between tries. No other UNAVAILABLE is replayed, since such a call may have run. Add meta_conformance, fake_agent, and real-agent plumbing tests, and update CI to build datalake_fdw with gRPC on Rocky 9/10 (and verify the no-gRPC fallback on Rocky 8) and run agent tests against a live datalake_agent, started with its socket and log directory as arguments. Closes apache#2012.
Implement the catalog-free Iceberg kernel in datalake_agent where every operation targets an explicit, immutable metadata_location (or table location for CreateTable) supplied by the caller alongside volume storage options and credentials. Support CreateTable (exclusive initial metadata file, one create at a time per table location), LoadTable, TableExists, GetStatistics, DropTable (UUID check and optional purge), GetFragment (back-pressured streaming splits with pooled delete files and residual filters), PlanFileGroups (per-partition bin-packing), and staged Append/Update writes returning a new metadata file as staging_id. Filters on nested fields bind by full column path, and 64-bit counts travel as decimal strings. Add idempotent operation_id handling with deterministic staged paths, claim coalescing, and payload-mismatch rejection. Requests without a location and catalog-level commits stay UNIMPLEMENTED. Wire per-configuration leased S3FileIO and Hadoop-free LocalFileIO on iceberg-java 1.12.0, speaking the settled 1.0.0 contract (optional snapshots/sequence numbers, Iceberg JSON schemas/specs, file format and content enums, column metrics, and credentials restricted to StorageConfig.credentials). Add local kernel, in-process gRPC, S3 end-to-end (SeaweedFS in CI), and datalake_fdw agent_location lifecycle regression tests. Closes apache#2013.
This was referenced Dec 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2013. Part of #2008.
What does this PR do?
Fills in the agent's Iceberg operations for tables reached by metadata
location: the path of one immutable Iceberg
metadata.json, which names oneversion of a table. The caller sends that location, the volume's storage
settings and credentials with every request, and the agent keeps no catalog
of its own. Which version is current is the caller's to record; #2473 keeps
it in PostgreSQL.
CreateTableLoadTable,TableExists,GetStatisticsDropTableGetFragmentPlanFileGroupsAppend,UpdateRequests without a location, and the catalog-level commits, still answer
UNIMPLEMENTED.Decisions worth a look:
AppendandUpdatewrite a newmetadata file on top of the version named and return its location as
staging_id. Nothing points at it until the caller moves its own pointer,so a transaction that rolls back leaves an unreferenced file, not a
changed table.
operation_id. A staged write's path is derivedfrom the operation id, so a retried request finds its own earlier result;
concurrent copies of one request wait for the first; the same id with a
different payload is refused.
creates at one location with different operation ids are serialized, so
exactly one succeeds and the others get
ALREADY_EXISTS. The cost: twoagent processes on one volume are not serialized against each other.
GetFragmentstreams with back-pressure. Fragments come in batches;each batch carries a pool of delete files that its fragments refer to by
index, so a delete file shared by many data files is sent once per batch.
nested field cannot bind to a top-level column of the same name.
GetStatistics, as thecontract requires for integers that a
doublecannot hold exactly.S3FileIOper storage configuration, and aLocalFileIOwithout Hadoop.LocalFileIOpublishes files atomically butdoes not
fsync, so it survives a process crash, not a power loss; theextension does not put tables on
file://volumes (datalake_fdw: add Builtin catalog version tracking #2473), and this classserves the agent's own tests and hand-made requests.
Type of Change
Test Plan
mvn -B verify, 123 tests, 0 failures, 1skipped (
PlanMemoryTest, which runs only whenDATALAKE_TEST_PLAN_CALLSis set). They include the operations on alocal directory, the whole gRPC chain in process, concurrent creates
and replays, and an S3 end-to-end test against SeaweedFS that CI runs
too.
agent_locationindatalake_fdwruns the table lifecycle by location against a real agent.
make installcheckofcontrib/datalake_fdw: 16 tests, 0failures.
Impact
User-facing changes: none yet.
Dependencies: Iceberg 1.12.0 (
iceberg-core,iceberg-aws, ...) and theAWS SDK for Java 2.54.17, in the agent only.
Checklist
Additional Context
Draft until #2470 and #2471 are merged. Next: #2473, the Builtin catalog.