Repository navigation
Move Bigtable source/sink to bigtable-hbase 2.x and HBase 2.5 shaded - #1636
deepika-lalwani123 wants to merge 5 commits into
Conversation
avro-mapred 1.11.4 pulls in avro-ipc and avro-ipc-jetty, which bring velocity-engine-core 2.3 (shaded commons-io 2.8.0, CVE-2024-47554) and org.tukaani:xz into lib/ of google-cloud-0.25.0-SNAPSHOT.jar, as seen in the image scan of gcr.io/cdapio/cdap (/opt/cdap/master/artifacts/google-cloud-*.jar/lib/velocity-engine-core-2.3.jar). The plugins only use org.apache.avro.mapred.AvroKey and org.apache.avro.mapreduce.* (BigQuery sink AvroOutputFormat / AvroRecordWriter, Dataplex tests). Avro RPC and tether jobs, the only users of avro-ipc, are not used. The Avro output codecs the plugins allow are snappy and deflate (FileSetUtil), so dropping xz is safe. Versions: - org.apache.avro:avro-ipc 1.11.4 -> removed (exclusion on avro-mapred) - org.apache.avro:avro-ipc-jetty 1.11.4 -> removed (exclusion on avro-mapred) - velocity-engine-core 2.3 and xz 1.9 no longer packaged Bugs: none closed alone. The other commons-io 2.8.0 copy (inside format-avro-2.13.0.jar) is removed by hydrator-plugins HP-1. Risk: very low. No plugin code path uses avro-ipc. Testing: JDK 8, Checkstyle on (0 violations). mvn clean verify: 647 tests, 0 failures, 5 errors, 8 skipped. The 5 errors are cloud ITs that pick up the Cloudtop's ambient GCP project and fail with PERMISSION_DENIED (GCSConnectorTest x2, SpannerConnectorTest x2, BigQueryConnectorTest); they fail the same way on develop. All other unit tests pass, including AvroRecordWriterTest and DataPlexOutputFormatProviderTest. mvn dependency:tree: avro-mapred:1.11.4 has no children; avro-ipc, avro-ipc-jetty, velocity-engine-core and xz are gone. unzip -l target/google-cloud-0.25.0-SNAPSHOT.jar: lib/ has no avro-ipc*, velocity-* or xz-* jar.
Patch-level alignment with the cross-track targets used by the Platform CLs. No row of the current gcr.io/cdapio/cdap image scan points at these top-level jars in google-cloud, but they are below the versions used everywhere else and would re-open on the next scan: snappy-java 1.1.10.5 is below the 1.1.10.12 target, and httpcore 4.4.14 (transitive) did not match httpclient. 4.5.14 / 4.4.16 are what google-http-client-apache-v2 already uses, so nothing is downgraded. Versions: - org.xerial.snappy:snappy-java 1.1.10.5 -> 1.1.10.12 (direct dependency) - org.apache.httpcomponents:httpclient 4.5.13 -> 4.5.14 (httpclient.version, now also in dependencyManagement) - org.apache.httpcomponents:httpcore 4.4.14 -> 4.4.16 (new httpcore.version property, managed in dependencyManagement) Bugs: none (no scanned rows; prevents a re-open). Risk: very low. Same-line patch releases. Testing: JDK 8, Checkstyle on (0 violations). mvn clean verify: 647 tests, 0 failures, 5 errors, 8 skipped; the 5 errors are the same cloud ITs as on develop (GCSConnectorTest x2, SpannerConnectorTest x2, BigQueryConnectorTest: PERMISSION_DENIED on the Cloudtop's ambient GCP project, no test credentials). mvn dependency:tree: snappy-java 1.1.10.12, httpclient 4.5.14 and httpcore 4.4.16 at compile scope; no other version of them on the runtime classpath (httpcore-nio 4.4.5 stays test-only via cdap-unit-test). unzip -l target/google-cloud-0.25.0-SNAPSHOT.jar: lib/httpclient-4.5.14.jar, lib/httpcore-4.4.16.jar, lib/snappy-java-1.1.10.12.jar.
The image scan of gcr.io/cdapio/cdap reports these top-level jars in lib/ of google-cloud-0.25.0-SNAPSHOT.jar: - jackson-core 2.12.3 (CVE-2025-49128, CVE-2025-52999, CVE-2026-68494, CVE-2026-89425), jackson-databind 2.13.4.2 (11 CVEs) and jackson-dataformat-cbor 2.9.9 (CVE-2020-28491) - protobuf-java 3.19.4 (CVE-2022-3171, CVE-2022-3509, CVE-2022-3510, CVE-2024-7254) - google-oauth-client 1.31.2 (CVE-2021-22573) Jackson is now aligned with an imported jackson-bom, so the cbor module that comes in through google-cloud-bigquery moves with core/databind. protobuf-bom aligns protobuf-java-util (3.17.3) with protobuf-java. No libraries-bom is imported here, so nothing brings a protobuf 4.x that could be downgraded. google-oauth-client 1.33.3 is built against google-http-client 1.41.x, so google-http-client-bom 1.41.8 is imported to keep the whole google-http-client family (core, jackson2, gson, apache-v2, appengine, protobuf) on one version instead of mixing 1.38.0 / 1.39.2 with 1.41. Versions: - jackson-core 2.12.3, jackson-databind / jackson-annotations 2.13.4.x, jackson-dataformat-cbor 2.9.9 -> 2.18.12 (jackson.core.version, now also used for the jackson-bom import) - protobuf-java 3.19.4 -> 3.25.5 (google.protobuf.java.version); protobuf-java-util 3.17.3 -> 3.25.5 (protobuf-bom import) - google-oauth-client 1.31.2 -> 1.33.3 (managed, new google.oauth.client.version) - google-http-client* 1.38.0 / 1.39.2 -> 1.41.8 (google-http-client-bom import, new google.http.client.version) The copies bundled inside bigtable-hbase-1.x-hadoop-1.17.1.jar (jackson-core 2.11.1, protobuf 3.12.2, oauth-client 1.31.0) are handled by GC-4; the Jackson copy inside format-avro-2.13.0.jar is handled in hydrator-plugins. Bugs: jackson-dataformat-cbor b/578686984 (closed by this change alone). Risk: medium. Minor-version jumps. Jackson 2.18 keeps the 2.x API but has stricter defaults (e.g. StreamReadConstraints limits on very large numbers / strings). protobuf 3.25 runtime is backward compatible with code generated by older 3.x protoc (grpc 1.39 / gax). Testing: JDK 8, Checkstyle on (0 violations). mvn clean verify: 647 tests, 0 failures, 5 errors, 8 skipped; the 5 errors are the same cloud ITs as on develop (GCSConnectorTest x2, SpannerConnectorTest x2, BigQueryConnectorTest: PERMISSION_DENIED on the Cloudtop's ambient GCP project, no test credentials). BigQuery, GCS, Spanner, Datastore, Pub/Sub, Dataplex unit tests pass. mvn dependency:tree: jackson-* 2.18.12, protobuf-java / protobuf-java-util 3.25.5, google-oauth-client 1.33.3, google-http-client* 1.41.8 at compile scope; 2.12.3 / 2.13.4.2 / 2.9.9 / 3.19.4 / 1.31.2 are gone. unzip -l target/google-cloud-0.25.0-SNAPSHOT.jar: lib/ has only the new versions (jackson-core-2.18.12, jackson-databind-2.18.12, jackson-dataformat-cbor-2.18.12, protobuf-java-3.25.5, google-oauth-client-1.33.3, google-http-client-1.41.8). Not run: e2e tests (need GCP credentials).
The image scan of gcr.io/cdapio/cdap reports org.json:json 20180813 (CVE-2022-45688, CVE-2023-5072, CVE-2026-59171) in lib/ of google-cloud-0.25.0-SNAPSHOT.jar. It comes in through tink 1.3.0-rc3 (and tink-gcpkms) and is used directly by GCSTinkTool and TinkDecryptor (JSONObject) to write and read the Tink encryption metadata of encrypted GCS files, and by Tink's JsonKeysetReader / JsonKeysetWriter. Kept separate from the other MINOR bumps because newer org.json releases change parsing behavior (stricter handling of malformed input, number conversion). A new unit test, TinkKeysetJsonTest, writes the metadata the same way GCSTinkTool does (JsonKeysetWriter -> JSONObject.toString(4)) and reads it back the same way TinkDecryptor does (new JSONObject -> getJSONObject("keyset") -> JsonKeysetReader), then decrypts a stream with the result, with a local AEAD key in place of Cloud KMS. It passes with both 20180813 and 20260719. Versions: - org.json:json 20180813 -> 20260719 (new org.json.version property, managed in dependencyManagement) Bugs: b/578504385, b/578575239, b/584531579 (closed once the hydrator-plugins HP-2b and wrangler WR-3b copies are also bumped). Risk: medium. org.json behavior changes; the Tink metadata round trip and Tink-encrypted read path are covered by the new test. Testing: JDK 8, Checkstyle on (0 violations). mvn clean verify: 648 tests, 0 failures, 5 errors, 8 skipped; the 5 errors are the same cloud ITs as on develop (GCSConnectorTest x2, SpannerConnectorTest x2, BigQueryConnectorTest: PERMISSION_DENIED on the Cloudtop's ambient GCP project, no test credentials). TinkKeysetJsonTest passes on this branch and with the old 20180813. mvn dependency:tree -Dincludes=org.json: tink:1.3.0-rc3 -> org.json:json:20260719 only. unzip -l target/google-cloud-0.25.0-SNAPSHOT.jar: lib/json-20260719.jar. Not run: GCS e2e with a real Cloud KMS key (needs GCP credentials).
The image scan of gcr.io/cdapio/cdap reports 64 CVEs in jars bundled in lib/ of google-cloud-0.25.0-SNAPSHOT.jar by the Bigtable plugins: - bigtable-hbase-1.x-hadoop-1.17.1.jar: Netty 4.1.48 (codec, codec-http, codec-http2, common, handler, handler-proxy, native-epoll), jackson-core 2.11.1, protobuf 3.12.2, guava 29.0, gson 2.8.6, oauth-client 1.31.0, httpclient 4.5.12 - hbase-shaded-client-1.4.13.jar / hbase-shaded-server-1.4.13.jar: Hadoop 2.7.4 (hadoop-common, yarn-server-common), avro 1.7.7, commons-compress 1.4.1, commons-io 2.4, commons-net 3.1, snappy-java 1.0.5, protobuf 2.5.0, guava 12.0.1, gson 2.8.5, httpclient 4.5.2, java-xmlbuilder 0.4 None of these can be fixed inside the 1.x line. bigtable-hbase-1.x-mapreduce 1.17.1 is replaced by the shaded bigtable-hbase-2.x-hadoop 2.21.0 (its unshaded hbase-client 2.6.4 is excluded), and hbase-shaded-client / -server 1.4.13 by hbase-shaded-mapreduce 2.5.16-hadoop3, which provides the HBase 2 client API and TableInputFormat / TableOutputFormat with HBase's own third-party jars relocated. hbase-shaded-mapreduce declares Hadoop 3.4.3 jars (hadoop-distcp, -hdfs-client, -annotations), slf4j and log4j2 as compile dependencies; they are excluded because CDAP provides Hadoop and logging. javax.annotation-api 1.2 from it is excluded so the 1.3.2 used by the Google Cloud clients stays. google-cloud-bigtable 1.17.1 (admin / data client) is only used by the e2e test setup, so it moves from the plugin's compile dependencies to the e2e-tests profile at test scope. Code changes (HBase 2 API): - BigtableSink: HTableDescriptor / HColumnDescriptor -> TableDescriptorBuilder / ColumnFamilyDescriptorBuilder; Table.getTableDescriptor().getFamiliesKeys() -> Table.getDescriptor().getColumnFamilyNames() - BigtableSource: same getDescriptor() change - HBaseResultToRecordTransformer: Cell.getFamilyArray() / getQualifierArray() / getValueArray() -> CellUtil.cloneFamily / cloneQualifier / cloneValue (the *Array() getters return the backing array, which is only correct when offset = 0 and length = array length) - BigtableInputFormat / BigtableOutputFormat: no change needed; TableInputFormat.createRecordReader and TableOutputFormat getRecordWriter / checkOutputSpecs / setConf keep the same signatures. BigtableConfiguration / BigtableOptionsFactory keys used by the plugins are unchanged in 2.x. Versions: - com.google.cloud.bigtable:bigtable-hbase-1.x-mapreduce 1.17.1 -> bigtable-hbase-2.x-hadoop 2.21.0 (google.cloud.bigtable.version) - org.apache.hbase:hbase-shaded-client 1.4.13 and hbase-shaded-server 1.4.13 -> hbase-shaded-mapreduce 2.5.16-hadoop3 (new hbase-shaded-mapreduce.version; the two old properties are removed) - com.google.cloud:google-cloud-bigtable 1.17.1: compile -> test scope in the e2e-tests profile - New small runtime jars: opentelemetry-api / -context 1.49.0, opentelemetry-semconv 1.29.0-alpha, audience-annotations 0.13.0, jakarta.annotation-api 1.3.5, jakarta.validation-api 2.0.2, jakarta.inject 2.6.1, javassist 3.30.2-GA Bugs: b/578424402, b/578429556, b/578451083, b/578453650, b/578458777, b/578489641, b/578495801, b/578496916, b/578501872, b/578521895, b/578579901, b/578591566, b/578635525, b/578636017, b/578637267, b/578639096, b/578662249, b/578746169, b/578756088, b/578782461 (closed by this change alone). Plugins side done for b/571156599, b/578423875, b/578436101, b/578436419, b/578437560, b/578496596, b/578559913, b/578580043, b/578580079, b/578597409, b/578600761, b/578643165, b/578659719. Not fixed / net-new copies (checked by unzipping the built plugin jar): - bigtable-hbase-2.x-hadoop-2.21.0.jar bundles grpc-netty-shaded with Netty 4.2.15.Final and jackson-core 2.18.3, so the 13 Netty CVEs fixed only in 4.2.16+ and jackson-core CVE-2026-89425 stay open (exception). - hbase-shaded-mapreduce-2.5.16-hadoop3.jar (hbase-thirdparty 4.1.14) bundles relocated Netty 4.1.131.Final (31 modules incl. netty-all), Jetty 9.4.58.v20250814 (10 modules), protobuf-java 2.5.0, httpclient 4.5.13 / httpcore 4.4.13, commons-codec 1.15, zookeeper 3.8.6, jackson 2.21.1, guava 33.4.8, gson 2.13.2, jersey 2.47. The Netty / Jetty / protobuf 2.5.0 copies are expected to show up as new rows on the next scan; run a Pantheon / Container Analysis scan of the built jar before merging. Risk: high. Major-version client change for the Bigtable source and sink (HBase 1.4 API -> HBase 2.5 API, Bigtable HBase client 1.x -> 2.x on the veneer data client). bigtable-hbase-2.x 2.21.0 is built against hbase-client 2.6.4 but runs here on the 2.5.16 client classes; the connection constructor used by HBase 2.5's ConnectionFactory exists. Testing: JDK 8, Checkstyle on (0 violations). mvn clean verify: 648 tests, 0 failures, 5 errors, 8 skipped; the 5 errors are the same cloud ITs as on develop (GCSConnectorTest x2, SpannerConnectorTest x2, BigQueryConnectorTest: PERMISSION_DENIED on the Cloudtop's ambient GCP project, no test credentials). Bigtable unit tests pass: HBaseResultToRecordTransformerTest, RecordToHBaseMutationTransformerTest, BigtableSinkConfigTest, BigtableSourceConfigTest. Runtime smoke check (scratch class on the test classpath, not committed): BigtableConfiguration.configure, Scan -> TableMapReduceUtil.convertScanToString, TableDescriptorBuilder, HBase ConnectionFactory.createConnection -> hbase2_x.BigtableConnection, Connection.getTable, BigtableInputFormat.setConf and BigtableOutputFormat.setConf all work; the channel reached the Bigtable API and got NOT_FOUND for the fake instance, as expected. mvn dependency:tree: no bigtable-hbase-1.x-*, hbase-shaded-client / -server or google-cloud-bigtable at compile scope; no Hadoop jar at compile scope. unzip -l target/google-cloud-0.25.0-SNAPSHOT.jar: lib/ has bigtable-hbase-2.x-hadoop-2.21.0.jar and hbase-shaded-mapreduce-2.5.16-hadoop3.jar and no bigtable-hbase-1.x-*, hbase-shaded-client-*, hbase-shaded-server-*, google-cloud-bigtable-*, grpc-google-cloud-bigtable-* or hadoop-* jar. Not run: Bigtable e2e tests and Bigtable source/sink on MapReduce and Spark in a CDAP 6.11 sandbox (need a Bigtable instance and credentials).
There was a problem hiding this comment.
Code Review
This pull request updates the Google Cloud Bigtable and HBase dependencies to newer versions (including upgrading Bigtable to 2.21.0 and switching to hbase-shaded-mapreduce 2.5.16-hadoop3), adapting the codebase to HBase 2.x APIs. It also adds a new test for Tink keyset JSON round-trips. Feedback on the changes highlights a performance concern in HBaseResultToRecordTransformer.java, where using CellUtil.cloneFamily and CellUtil.cloneQualifier introduces unnecessary byte array allocations. It is recommended to use the Bytes.toString overload with offsets and lengths to avoid garbage collection pressure in high-throughput pipelines.
| String columnName = Bytes.toString(CellUtil.cloneFamily(cell)) + ':' + | ||
| Bytes.toString(CellUtil.cloneQualifier(cell)); |
There was a problem hiding this comment.
Using CellUtil.cloneFamily(cell) and CellUtil.cloneQualifier(cell) allocates a new byte[] for every cell in every row. In high-throughput data pipelines, this creates significant garbage collection pressure.
Instead, you can use the Bytes.toString(byte[], int, int) overload with the cell's array, offset, and length to decode the string directly from the backing array without allocating intermediate byte arrays.
| String columnName = Bytes.toString(CellUtil.cloneFamily(cell)) + ':' + | |
| Bytes.toString(CellUtil.cloneQualifier(cell)); | |
| String columnName = Bytes.toString(cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength()) + ':' + | |
| Bytes.toString(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength()); |
Move Bigtable source/sink to bigtable-hbase 2.x and HBase 2.5 shaded
Repo: data-integrations/google-cloud
Branch: vuln/gc-4-major-bigtable-hbase-2x → base develop (stacked)
Commit: 6812dd1
Part of the CVE fixes for the CDAP 6.11.2 patch release (container image scanning of gcr.io/cdapio/cdap).
The image scan of gcr.io/cdapio/cdap reports 64 CVEs in jars bundled in
lib/ of google-cloud-0.25.0-SNAPSHOT.jar by the Bigtable plugins:
codec-http2, common, handler, handler-proxy, native-epoll), jackson-core
2.11.1, protobuf 3.12.2, guava 29.0, gson 2.8.6, oauth-client 1.31.0,
httpclient 4.5.12
Hadoop 2.7.4 (hadoop-common, yarn-server-common), avro 1.7.7,
commons-compress 1.4.1, commons-io 2.4, commons-net 3.1, snappy-java
1.0.5, protobuf 2.5.0, guava 12.0.1, gson 2.8.5, httpclient 4.5.2,
java-xmlbuilder 0.4
None of these can be fixed inside the 1.x line.
bigtable-hbase-1.x-mapreduce 1.17.1 is replaced by the shaded
bigtable-hbase-2.x-hadoop 2.21.0 (its unshaded hbase-client 2.6.4 is
excluded), and hbase-shaded-client / -server 1.4.13 by
hbase-shaded-mapreduce 2.5.16-hadoop3, which provides the HBase 2 client
API and TableInputFormat / TableOutputFormat with HBase's own third-party
jars relocated. hbase-shaded-mapreduce declares Hadoop 3.4.3 jars
(hadoop-distcp, -hdfs-client, -annotations), slf4j and log4j2 as compile
dependencies; they are excluded because CDAP provides Hadoop and logging.
javax.annotation-api 1.2 from it is excluded so the 1.3.2 used by the
Google Cloud clients stays.
google-cloud-bigtable 1.17.1 (admin / data client) is only used by the
e2e test setup, so it moves from the plugin's compile dependencies to the
e2e-tests profile at test scope.
Code changes (HBase 2 API):
TableDescriptorBuilder / ColumnFamilyDescriptorBuilder;
Table.getTableDescriptor().getFamiliesKeys() ->
Table.getDescriptor().getColumnFamilyNames()
getQualifierArray() / getValueArray() -> CellUtil.cloneFamily /
cloneQualifier / cloneValue (the *Array() getters return the backing
array, which is only correct when offset = 0 and length = array length)
TableInputFormat.createRecordReader and TableOutputFormat
getRecordWriter / checkOutputSpecs / setConf keep the same signatures.
BigtableConfiguration / BigtableOptionsFactory keys used by the plugins
are unchanged in 2.x.
Versions:
bigtable-hbase-2.x-hadoop 2.21.0 (google.cloud.bigtable.version)
1.4.13 -> hbase-shaded-mapreduce 2.5.16-hadoop3 (new
hbase-shaded-mapreduce.version; the two old properties are removed)
the e2e-tests profile
opentelemetry-semconv 1.29.0-alpha, audience-annotations 0.13.0,
jakarta.annotation-api 1.3.5, jakarta.validation-api 2.0.2,
jakarta.inject 2.6.1, javassist 3.30.2-GA
Not fixed / net-new copies (checked by unzipping the built plugin jar):
Netty 4.2.15.Final and jackson-core 2.18.3, so the 13 Netty CVEs fixed
only in 4.2.16+ and jackson-core CVE-2026-89425 stay open (exception).
bundles relocated Netty 4.1.131.Final (31 modules incl. netty-all),
Jetty 9.4.58.v20250814 (10 modules), protobuf-java 2.5.0, httpclient
4.5.13 / httpcore 4.4.13, commons-codec 1.15, zookeeper 3.8.6,
jackson 2.21.1, guava 33.4.8, gson 2.13.2, jersey 2.47. The Netty /
Jetty / protobuf 2.5.0 copies are expected to show up as new rows on
the next scan; run a container image scan of the built
jar before merging.
Risk: high. Major-version client change for the Bigtable source and
sink (HBase 1.4 API -> HBase 2.5 API, Bigtable HBase client 1.x -> 2.x on
the veneer data client). bigtable-hbase-2.x 2.21.0 is built against
hbase-client 2.6.4 but runs here on the 2.5.16 client classes; the
connection constructor used by HBase 2.5's ConnectionFactory exists.
Testing: JDK 8, Checkstyle on (0 violations).
mvn clean verify: 648 tests, 0 failures, 5 errors, 8 skipped; the 5
errors are the same cloud ITs as on develop (GCSConnectorTest x2,
SpannerConnectorTest x2, BigQueryConnectorTest: PERMISSION_DENIED on the
Linux workstation's ambient GCP project, no test credentials). Bigtable unit
tests pass: HBaseResultToRecordTransformerTest,
RecordToHBaseMutationTransformerTest, BigtableSinkConfigTest,
BigtableSourceConfigTest.
Runtime smoke check (scratch class on the test classpath, not
committed): BigtableConfiguration.configure, Scan ->
TableMapReduceUtil.convertScanToString, TableDescriptorBuilder,
HBase ConnectionFactory.createConnection -> hbase2_x.BigtableConnection,
Connection.getTable, BigtableInputFormat.setConf and
BigtableOutputFormat.setConf all work; the channel reached the Bigtable
API and got NOT_FOUND for the fake instance, as expected.
mvn dependency:tree: no bigtable-hbase-1.x-, hbase-shaded-client /
-server or google-cloud-bigtable at compile scope; no Hadoop jar at
compile scope.
unzip -l target/google-cloud-0.25.0-SNAPSHOT.jar: lib/ has
bigtable-hbase-2.x-hadoop-2.21.0.jar and
hbase-shaded-mapreduce-2.5.16-hadoop3.jar and no bigtable-hbase-1.x-,
hbase-shaded-client-, hbase-shaded-server-, google-cloud-bigtable-,
grpc-google-cloud-bigtable- or hadoop-* jar.
Not run: Bigtable e2e tests and Bigtable source/sink on MapReduce and
Spark in a CDAP 6.11 sandbox (need a Bigtable instance and credentials).