RANGER-5656: TagSync Atlas REST sync fails with AbstractMethodError after RANGER-4076 Jersey 2 migration#1035
Conversation
…fter RANGER-4076 Jersey 2 migration Replace AtlasClientV2 with HttpURLConnection-based AtlasRESTHttpClient so TagSync does not load Jersey 1.x on the same classpath as Ranger Jersey 2.x REST sink. Remove atlas-client-v1/v2 from tagsync dependencies and assembly tarball.
9a52f62 to
e483eac
Compare
…re resolveTag comments Collapse multi-line statements in AtlasRESTHttpClient and restore original resolveTag block and inline comments in AtlasRESTTagSource.
mneethiraj
left a comment
There was a problem hiding this comment.
@ramackri - this update reduces Ranger dependency on few Atlas libraries, which is good! Please review couple of comments on handling SSL and multiple URLs. It will be ideal if RangerRESTClient can be reused here. Though few log messages in RangerRESTClient refer to Ranger admin, the rest of the code seem to be generic to talk to any HTTP server; please review.
Replace HttpURLConnection Atlas client with RangerRESTClient so TagSync reuses the same SSL and multi-URL failover as TagAdminRESTSink. Initialize AtlasRESTHttpClient from comma-separated endpoints and keep basic auth when credentials are configured alongside Kerberos.
…asRESTHttpClient Add blank line between javax and java imports for checkstyle, use single return in execute(), and keep Atlas REST client initialization on one line.
|
What changes were proposed in this pull request?
Fixes RANGER-5656: TagSync Atlas REST tag source fails when
TAG_SOURCE_ATLASREST_ENABLED=trueafter RANGER-4076 migrated TagSync to Jersey 2.x, whileAtlasRESTTagSourcestill usedAtlasClientV2(Jersey 1.x fromatlas-client-v2).Problem
TagSync reads classifications from Atlas via
AtlasClientV2and pushes tags to Ranger Admin viaTagAdminRESTSink(Jersey 2). Both JAX-RS stacks load on the same JVM:The Atlas REST sync thread exits on the first poll. TagSync may appear running, but no automatic Atlas → Ranger tag push occurs.
AtlasClientV2: Jersey 1AtlasClientV2: Jersey 1HttpURLConnection; sink: Jersey 2Solution
AtlasRESTHttpClient(new) — minimal Atlas REST client usingHttpURLConnection+ AtlasAtlasTypeJSON helpers (no Jersey, noAtlasClientV2).POST api/atlas/v2/search/basic— classified entity searchGET api/atlas/v2/types/typedefs/— typedef loadUserGroupInformation.doAs)AtlasRESTTagSource— callAtlasRESTHttpClientinstead ofAtlasClientV2; removegetAtlasClient().Packaging — remove
atlas-client-v1/atlas-client-v2fromtagsync/pom.xmland fromdistro/src/main/assembly/tagsync.xmlso Jersey 1 client JARs are not shipped in the TagSync tarball.Not changed:
TagSynchronizer,TagAdminRESTSink, Atlas Kafka tag source, Hive plugin.Files changed
tagsync/.../AtlasRESTHttpClient.javatagsync/.../AtlasRESTTagSource.javatagsync/pom.xmlatlas-client-v1/v2dependenciesdistro/src/main/assembly/tagsync.xmlatlas-client-*fromlib/How was this patch tested?
Build and static checks
tagsyncmodule compile/packageAtlasRESTHttpClient.javaManual testing (Atlas + Ranger + Hive integration)
Manual validation used a docker environment with Ranger Admin, TagSync, Apache Atlas, and Hive (Kerberos-enabled), with
TAG_SOURCE_ATLASREST_ENABLED=trueand Atlas REST credentials configured in TagSync install properties.1. TagSync starts without Jersey conflict
TagSynchronizerprocess is running and noAbstractMethodError/UriBuilderImplerrors appear in TagSync logs on startup or first poll.2. Atlas classification → Ranger tag mapping (automatic sync)
createdBy: rangertagsync, GUID matches Atlas).GET /service/tags/resources?serviceName=<hive-service>andGET /service/tags/tagresourcemaps?serviceName=<hive-service>.3. End-to-end tag policy enforcement in Hive
With tag mappings present, configured Ranger policies on
dev_hive(RBAC allow) anddev_tag(tag deny for one user; tag data maskhive:MASKfor another on tag PII). Loaded sample row data into the Hive table.SELECTnon-PII columnSELECTPII-tagged columnHiveAccessControlException)SELECTPII-tagged columnnnn-nn-nnnn)SELECTPII-tagged column4. Regression checks
TagAdminRESTSink(Jersey 2 unchanged).Related issues
AtlasClientV2adoption inAtlasRESTTagSource