Repository navigation
[Feature][Connector-V2][Paimon] Support REST catalog for source and sink - #13141
Conversation
Signed-off-by: Goutam Adwant <workwithgoutam@gmail.com>
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks a lot for this feature, @goutamadwant. REST catalog support has been requested for a while (#10967 / #10968), and the PR is careful about security: credentials are validated without echoing their values, REST-reserved keys are rejected in the Hadoop storage map, and the docs are honest about the Paimon 1.1.1 dependency limits (DEBUG logging in HadoopUtils, redirect forwarding of x-dlf-security-token). I traced the change through the factories, PaimonConfig, PaimonCatalogLoader and the existing catalog lifecycle on dev. I did not find a blocking correctness issue. Below are a few points, mostly about validation depth and small cleanups.
What Problem Does This PR Solve?
The Paimon connector only supported filesystem and hive catalogs. This PR adds catalog_type = rest for source, sink, the catalog factory and the SaveMode path. It reuses catalog_uri as the REST endpoint, treats warehouse as the managed warehouse name, and forwards Paimon 1.1.1's token.provider, token and dlf.* options. No Paimon version upgrade is involved, and the REST classes and the shaded OkHttp client are already in the paimon-bundle 1.1.1 jar the connector ships.
1 Code Change Review
1.1 Core logic
Runtime flow for a REST job:
PaimonSourceFactory / PaimonSinkFactory / PaimonCatalogFactory
optionRule: conditional(catalog_type == REST -> catalog_uri, token.provider)
-> new PaimonConfig(readonlyConfig) (PaimonConfig.java:81-121)
catalog_uri required, validateRestUri() (:123)
token.provider in {bear, dlf}; bear -> token; dlf -> both access keys
dlf.security-token header-character check (:160)
restOptions = only the configured REST keys
-> new PaimonCatalogLoader(config)
restStorageOptions = explicit XML + paimon.hadoop.conf only, reserved keys rejected
(PaimonCatalogLoader.java:136-177)
-> loadCatalog() -> loadRestCatalog() (:116-134)
options = storage + "hadoop."-prefixed storage + warehouse/metastore/uri + restOptions
-> createCatalog(options) -> CatalogFactory.createCatalog(...) (:179)
-> PaimonCatalog.close(): REST catalogs are now closed (PaimonCatalog.java:87-99)
The filesystem and hive branches of loadCatalog() are unchanged apart from the extraction of createCatalog(...), which contains exactly the previous body (Options, CatalogContext, runSecured, the PrivilegedCatalog check and the PaimonConnectorException wrapping). testFilesystemOptionsUnchanged and testHiveOptionsUnchanged pin that.
1.2 Compatibility
- Additive only: a new enum value and new optional options. Existing
filesystem/hiveconfigs produce the same option maps and the same catalog. warehouse/catalog_uridescriptions change, but their keys and defaults do not.PaimonConfigandPaimonCatalogLoaderareSerializableand gain plainHashMap<String, String>fields; nothing is persisted in checkpoint state, so there is no state-compatibility concern.ConfigShadeUtils.java:64-65(shared core) adds two entries to the existing log-mask-only list. It only affects log masking (not encryption), and the existing suffix/exact matching rules mean it cannot mask unrelated options such astoken.provider(covered inConfigBuilderTest). This is the same kind of one-line addition earlier connectors made.
1.3 Side effects
PaimonCatalog.close()now callscatalog.close()for REST catalogs and catchesExceptioninstead ofIOException. All existing call sites (PaimonSink,PaimonSinkWriter,PaimonSourceFactory, the SaveMode handler) already close thePaimonCatalog, so the HTTP client is released on the normal path.- Source and sink keep using
Tableobjects after the factory has closed itsPaimonCatalog. Your IT reads through the source after the factory closed its catalog, which is good evidence that this works with REST tables in a single JVM.
1.4 Error handling / logging
Error messages for an invalid URI or security token deliberately leave out the value, which is the right call for credentials. The HTTP-outside-loopback warning resolves no DNS, which is good.
Issue 1: no engine-level E2E for the REST path
- Location:
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-paimon-e2e/src/test/java/org/apache/seatunnel/e2e/connector/paimon/PaimonRestCatalogIT.java:86-331 - Problem:
PaimonRestCatalogITis a plain JUnit test in the E2E module. It drives the factories, writer, committer, enumerator and reader directly in the test JVM, with mocked reader/enumerator contexts. It does not extendTestSuiteBaseand does not submit a job to a Zeta, Flink or Spark container. That leaves three things unexercised: the plugin classloader of the packaged connector jar, Java serialization ofPaimonSource/PaimonSink(and the REST-backedTable/CatalogLoaderthey carry) to the workers, and commit on the engine side. - Risk: medium. These are the usual places a new catalog type breaks in production even when an in-JVM test is green.
- Best improvement: add one
@TestTemplatecase that runs a smallFakeSource -> Paimon (rest)job and aPaimon (rest) -> Assertjob against the REST test server. You can reach the server from the container withTestcontainers.exposeHostPorts, and put the warehouse on a shared bind mount. If that is too heavy for this PR, please say so explicitly in the description and track it as a follow-up. At minimum, add a serialization round-trip ofPaimonSource/PaimonSink(viaSerializationUtils) to the existing IT. - Severity: Medium (strongly recommended; I am not treating it as a hard blocker given the in-JVM coverage)
- Raised by another reviewer: No
Issue 2: REST-only special case in PaimonCatalog.close() is not explained
- Location:
seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/catalog/PaimonCatalog.java:87-99 - Problem: the condition is now
catalog instanceof Closeable || catalog_type == REST. Readers will not know why REST needs a separate branch (in Paimon 1.1.1CatalogisAutoCloseable, but the REST catalog chain is notjava.io.Closeable), or why other catalog types still keep the old rule. - Best improvement: add a short comment that explains this and states that the old rule is kept on purpose for
filesystem/hive. - Severity: Low
- Raised by another reviewer: No
Issue 3: reserved-key rejection throws a bare IllegalArgumentException
- Location:
PaimonCatalogLoader.java:163-177 - Problem:
PaimonConfigreports REST validation failures withSeaTunnelException, but the storage-key check throwsIllegalArgumentExceptionfrom thePaimonCatalogLoaderconstructor. Users get two different error styles for the same kind of misconfiguration. - Best improvement: use the same exception type, or a
PaimonConnectorExceptionwith a config error code, so it is consistent. - Severity: Low
- Raised by another reviewer: No
2 Quality
2.1 Code standards
PaimonCatalogLoader.java:139,143,145use fully qualifiedorg.apache.hadoop.fs.Pathandjava.nio.file.Pathin the method body to avoid the name clash. It would be cleaner to import one of them and keep the other qualified (or usePaths.get(...).toUri()directly), but this is a nit.- The non-obvious steps have comments (why storage options are also forwarded with the
hadoop.prefix, why DNS is not resolved, why token errors do not echo values). Please also add a brief Javadoc onloadRestStorageOptionssaying it reads only explicit settings (Configuration(false)) so Hadoop defaults cannot override what the server supplies. That is the key design decision here.
2.2 Tests
PaimonCatalogLoaderTest(new, 21 cases): option forwarding, reserved-key rejection (map and XML), URI and credential validation without echoing values, close behavior, and unchangedfilesystem/hivemaps. These are precise assertions that would fail if the behavior regressed. Stable (pure in-memory plus temp files).PaimonOptionRuleTest#testRestOptionsDeclaredByAllFactories: makes sure all three factories declare the new options. Stable.ConfigBuilderTest#testPaimonRestCredentialsAreMaskedWithoutChangingEncryptionKeys: checks the core masking change, including the nesteddlf { ... }form and thattoken.provideris not masked. Stable.PaimonRestCatalogIT(3 cases,@Timeout(60)): bearer source/sink/SaveMode round trip, wrong-token rejection, DLF signing, and server-supplied defaults. Stable as far as I can see (local REST test server on an ephemeral port,@TempDir). See Issue 1 for what it does not cover.- The
connector-paimon-e2e/pom.xmlchanges are test-scoped. Two small asks: (a)paimon.versionis redefined as1.1.1atpom.xml:31, which can drift from the connector's own property; please add a comment that it must matchconnector-paimon, or reuse a shared property. (b) Please explain in the description whyconnector-cdc-base(pom.xml:67) is needed; nothing in the new IT imports it.
2.3 Documentation
The EN and ZH source and sink pages are updated in parity, with option table rows, authentication rules, examples and known limitations. Very thorough. The new table rows break the column alignment of the existing tables; that is only cosmetic.
3 Architecture
The REST handling stays inside the Paimon connector (config, loader, factories), apart from the two masking keywords in core, which is the right boundary. Delegating to CatalogFactory.createCatalog with metastore = rest instead of instantiating RESTCatalog directly keeps the caching and privilege wrappers consistent with the other catalog types.
4 Issue table
| # | Location | Summary | Severity | Blocker |
|---|---|---|---|---|
| 1 | PaimonRestCatalogIT.java:86-331 |
No engine-level (container) E2E; serialization and classloader path untested | Medium | No (strongly recommended) |
| 2 | PaimonCatalog.java:87-99 |
REST-only close condition needs an explanatory comment | Low | No |
| 3 | PaimonCatalogLoader.java:163-177 |
Inconsistent exception type for REST misconfiguration | Low | No |
| 4 | connector-paimon-e2e/pom.xml:31,67 |
Duplicated paimon.version; unexplained connector-cdc-base test dependency |
Low | No |
5 Merge recommendation
Ready to merge once CI is green, with Issue 1 strongly recommended (either in this PR or as an explicitly tracked follow-up).
- Blockers (non-CI): none.
- Non-blocking: Issues 1-4 and the import/Javadoc nits.
- CI: the fork
Buildrun for the current head is still queued (https://github.com/goutamadwant/seatunnel/actions/runs/41984271522). The branch is one commit behinddev. I will take another look and approve once CI is green.
Thanks again for the careful, security-conscious implementation.
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for keeping this contribution moving. The CI fact cited previously has changed on unchanged head 0a063ee861da1a77415a2fb2603df862061519a2. The previous Paimon REST source conclusion had no blocking source finding; the engine-container test recommendation remains a non-blocking follow-up.
The Apache Build is SUCCESS.
CI was previously the only remaining blocker from my review; CI is now passing, so my technical conclusion is being changed to approve. This does not claim that any separate workflow-approval, maintainer-review or merge-queue gate has been bypassed.
This is an unchanged-head discussion/CI update, not a second full source review. No local tests were run. Daniel has READ permission; any approval records my technical conclusion, while effective maintainer approval, dismissal and merge remain separate.
DanielLeens
left a comment
There was a problem hiding this comment.
Hi @goutamadwant, thanks for keeping this branch up to date.
Re-checked the new head 50fc2a73: the only change since my last review (0a063ee8) is a merge of the latest dev (4ee722e9). The PR's own diff is unchanged in substance: the same 18 files with identical added lines. The only touched area is the sensitive-option list in ConfigShadeUtils.java, where dev had added consumer_key / consumer_secret (WooCommerce) after connection_string. The merge keeps both sides. dlf.access-key-id and dlf.access-key-secret are inserted before the WooCommerce keys, nothing is dropped, and ConfigBuilderTest keeps both the Paimon REST masking test and the test that came from dev. That accounts for the one-line difference in the diff stat (a trailing comma).
Previous review points
- No non-CI blocker in my earlier review, which I approved. The engine-container test idea stays a non-blocking follow-up.
CI
- The fork
Buildrun on this head is still running: https://github.com/goutamadwant/seatunnel/actions/runs/42765842871. No job has failed yet. - Heads-up: this merge took
devat4ee722e9, one commit before #13203. That commit replaced the removedatmoz/sftp:alpine-3.7Docker image. This head still uses the old tag, soconnector-file-sftp-it(JDK 11/17) is expected to fail, and a rerun won't fix it. The smallest next step is to merge the latestdevonce more (1 commit, #13203).
Conclusion: Ready to merge
- Blockers (non-CI): None.
- I'll approve again once
Buildis green on the head that includes #13203.
Thank you for this contribution!
DanielLeens
left a comment
There was a problem hiding this comment.
Re-checked the new head 3d170e4d, @goutamadwant: compared with the head I last reviewed (50fc2a73), the only change is the Sync dev for current CI fixtures merge, and the PR's own net diff against dev is byte-identical (same files, same changed lines). Thanks for syncing.
Previous points: my earlier conclusion had no non-CI blocker, and the merge does not touch the PR's files, so nothing changes on the source side.
CI: the fork Build for this head has just started (no failures so far). Because the head moved, I am leaving this as a comment and will approve once that run is green.
Branch state: ahead, ahead 3 / behind 0 of dev; no conflicts reported.
Conclusion: Ready to merge
- Blockers (non-CI): none.
- Remaining gate: CI on this head.
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for the update on CI. The CI fact cited previously has changed. On unchanged head 3d170e4d0be6a3ffbe99002d7423647dcaf39131, fork Build 42979503587 has completed successfully, and the PR now reports Signal pull request update=SUCCESS; Build=SUCCESS. My earlier pending/missing-workflow guidance is obsolete.
I checked my previous conclusion: no source, test-coverage, compatibility or documentation blocker remained; any listed suggestions were explicitly non-blocking. CI was previously the only remaining blocker; CI is now passing, so the conclusion is being changed to approve.
5. Merge Recommendation
Conclusion: Ready to merge
- Blockers — must be fixed: None from my existing source review or current CI. The repository still reports
REVIEW_REQUIRED: a write-capable maintainer must provide the effective required review and make the merge decision. - Recommended fixes — non-blocking: Earlier optional suggestions remain optional; no additional source change is requested.
The comparison with dev is diverged, ahead 3 / behind 9, with no reported conflict. This is recorded as branch metadata, not a reason to request a sync while these checks are green. This publication updates the CI gate on an already-reviewed head; it is not a new full source review, and I ran no local build or job. My account has READ permission, so this technical approval must not be confused with a write-capable maintainer's effective approval or dismissal of a historical review entry.
davidzollo
left a comment
There was a problem hiding this comment.
+1
LGTM
Thanks for your contribution!
Please join our Apache SeaTunnel contributors channel on Slack for technical discussions and collaboration: https://s.apache.org/seatunnel-slack
Purpose of this pull request
Closes #13140. Related: #10967, #10968.
Adds
catalog_type = restfor the Paimon source, sink, catalog factory and SaveMode path. REST reusescatalog_uri, takeswarehouseas the managed warehouse name, and forwards Paimon 1.1.1'stoken.provider,token,dlf.access-key-id,dlf.access-key-secret,dlf.security-tokenanddlf.region. No dependency upgrade.Only explicitly configured Hadoop settings are passed to the REST catalog, so Hadoop's built-in defaults cannot override server-supplied defaults; REST option keys inside
paimon.hadoop.confor XML files are rejected.catalog_urimust be HTTP or HTTPS with a host and no user information (plain HTTP outside loopback logs a warning),token.providermust bebearordlfwith the matching credentials present, and REST catalogs are closed when no longer used. DLF credentials are masked in the parsed-config log; encryption behaviour is unchanged.filesystemandhiveare unchanged.Does this PR introduce any user-facing change?
Yes: a new
catalog_typevalue and the authentication options above, documented in the EN and ZH source and sink guides, including what is not supported (DLF token loaders and refresh) and two dependency limits (Paimon'sHadoopUtilsDEBUG logging can print storage settings; Paimon's HTTP client forwardsx-dlf-security-tokenacross host redirects). Existing configurations are unaffected.How was this patch tested?
ConfigBuilderTestpass on JDK 11 and 17.PaimonRestCatalogIT(3 tests) against Paimon's REST test server on JDK 11 and 17: SaveMode table creation, write and commit, read-back through the source, discovery, wrong-token rejection, DLF request signing, and server-supplied storage defaults.Check list
incompatible-changes.mdif necessary (not needed: additive)