Skip to content

HBASE-29495: Integrate key management with existing encryption - #7297

Merged
virajjasani merged 30 commits into
apache:HBASE-29368-key-management-featurefrom
haridsv:keymeta-integration
Sep 24, 2025
Merged

HBASE-29495: Integrate key management with existing encryption#7297
virajjasani merged 30 commits into
apache:HBASE-29368-key-management-featurefrom
haridsv:keymeta-integration

Conversation

@haridsv

Copy link
Copy Markdown
Contributor

This PR addresses HBASE-29495 to allow the new managed keys being detected and used by the existing encryption

Squashing the below changes for the convenience of rebasing:
2f6c381a71 Write path integration
9befa74658 Provision to instantiate ManagedKeyAccessor without server for the sake of tools
81540a0ca8 Test coverage with L2 disabled
a16313d1c1 Improved test coverage
332f4e756b null check for server on write path
- Also includes a couple of fixes for typos
- Refactored some of the key management test code so that it is reusable from a shell test.
…y search in global namespace
- Also fixes an issue with point lookups for active keys.
…gion operations
- The approach involves creating a new KeyManagementSerice interface and
passing it along the Server in as many code paths as possible.
- Also improved the assertions in the encryption E2E test.
Also added test coverage to read the HFile.
Also reverted some prior changes and added overloaded methods to reduce impact on tests following existing pattern.
@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

…e dropped
With mockito-inline enabled, at least the below 2 tests are failing:
- org.apache.hadoop.hbase.TestHBaseTestingUtil
Could not initialize plugin: interface org.mockito.plugins.MockMaker (alternate: null)
- org.apache.hadoop.hbase.security.access.TestRpcAccessChecks
java.lang.NullPointerException: Cannot invoke "org.apache.hbase.thirdparty.com.google.protobuf.Descriptors$ServiceDescriptor.getFullName()" because "service" is null
at org.apache.hadoop.hbase.ipc.CoprocessorRpcUtils.getServiceName(CoprocessorRpcUtils.java:77)
at org.apache.hadoop.hbase.master.HMaster.registerService(HMaster.java:3479)
The later is especially weird. The NPE should be ocuring even now as the mock is not stubbed, but it is somehow working.
@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@haridsv

Copy link
Copy Markdown
ContributorAuthor

Ran the tests locally using the mvn command from nightly master and got a clean run:

$ time mvn --batch-mode --threads=2 -DHBasePatchProcess -Dhadoop-three.version=3.3.5 -PrunAllTests -Dtest.exclude.pattern=**/snapshot.TestMobSecureExportSnapshot.java,**/quotas.TestDefaultHandlerUsageQuota.java,**/regionserver.TestCompactionState.java,**/master.TestMasterRegionMutation1.java,**/replication.TestSyncReplicationStandbyAsyncFSWAL.java,**/snapshot.TestSnapshotClientRetries.java,**/master.procedure.TestSCPWithMetaWithReplicas.java,**/util.TestProcDispatcher.java,**/security.TestMutualTlsServerSide.java,**/client.TestMobCloneSnapshotFromClientAfterSplittingRegion.java,**/backup.TestIncrementalBackup.java,**/master.procedure.TestHBCKSCP.java,**/regionserver.wal.TestLogRolling.java,**/master.balancer.TestStochasticLoadBalancerRegionReplicaHighReplication.java,**/client.TestAdminShell2.java,**/regionserver.TestSplitTransactionOnCluster.java,**/regionserver.TestRegionServerReportForDuty.java,**/namequeues.TestTooLargeLog.java,**/io.hfile.bucket.TestPrefetchPersistence.java,**/replication.TestNamespaceReplication.java,**/master.TestDLSFSHLog.java,**/master.assignment.TestRollbackSCP.java,**/replication.regionserver.TestBasicWALEntryStreamFSHLog.java,**/replication.TestBidirectionSerialReplicationStuck.java,**/io.TestFileChangeWatcher.java,**/snapshot.TestRestoreSnapshotHelper.java,**/io.hfile.bucket.TestBucketCache.java,**/client.TestBufferedMutator.java,**/regionserver.TestFailedAppendAndSync.java,**/regionserver.wal.TestHBaseWalOnEC.java,**/monitoring.TestTaskMonitor.java,**/quotas.TestClusterScopeQuotaThrottle.java,**/replication.regionserver.TestMetaRegionReplicaReplication.java,**/security.TestNettyTLSIPCFileWatcher.java,**/regionserver.wal.TestFSHLog.java,**/regionserver.TestTags.java,**/rsgroup.TestRSGroupsAdmin1.java,**/master.region.TestMasterRegionCompaction.java,**/namequeues.TestWALEventTracker.java,**/snapshot.TestSecureExportSnapshot.java,**/regionserver.TestBytesReadServerSideScanMetrics.java,**/master.region.TestMasterRegionWALCleaner.java,**/io.hfile.bucket.TestRecoveryPersistentBucketCache.java,**/io.asyncfs.TestSaslFanOutOneBlockAsyncDFSOutput.java,**/security.access.TestZKPermissionWatcher.java,**/quotas.TestThreadHandlerUsageQuota.java,**/io.hfile.TestPrefetchRSClose.java,**/security.access.TestAccessController.java,**/client.TestClientScannerTimeouts.java,**/replication.multiwal.TestReplicationEndpointWithMultipleAsyncWAL.java,**/io.hfile.bucket.TestBucketCachePersister.java,**/master.balancer.TestBalancerDecision.java,**/master.procedure.TestSnapshotProcedureRSCrashes.java clean test -fae -Dsurefire.testFailureIgnore=true -Dmaven.test.failure.ignore=true
...
[INFO] Reactor Summary for Apache HBase 4.0.0-alpha-1-SNAPSHOT:
[INFO]
[INFO] Apache HBase ....................................... SUCCESS [ 1.116 s]
[INFO] Apache HBase - Checkstyle .......................... SUCCESS [ 0.210 s]
[INFO] Apache HBase - Annotations ......................... SUCCESS [ 0.629 s]
[INFO] Apache HBase - Build Configuration ................. SUCCESS [ 0.088 s]
[INFO] Apache HBase - Logging ............................. SUCCESS [ 0.774 s]
[INFO] Apache HBase - Shaded Protocol ..................... SUCCESS [ 24.792 s]
[INFO] Apache HBase - Common .............................. SUCCESS [01:54 min]
[INFO] Apache HBase - Metrics API ......................... SUCCESS [ 3.042 s]
[INFO] Apache HBase - Metrics Implementation .............. SUCCESS [ 6.786 s]
[INFO] Apache HBase - Hadoop Compatibility ................ SUCCESS [ 17.231 s]
[INFO] Apache HBase - Client .............................. SUCCESS [01:08 min]
[INFO] Apache HBase - Zookeeper ........................... SUCCESS [ 27.474 s]
[INFO] Apache HBase - Replication ......................... SUCCESS [ 7.986 s]
[INFO] Apache HBase - Balancer ............................ SUCCESS [12:07 min]
[INFO] Apache HBase - Resource Bundle ..................... SUCCESS [ 0.101 s]
[INFO] Apache HBase - HTTP ................................ SUCCESS [ 30.334 s]
[INFO] Apache HBase - Asynchronous FileSystem ............. SUCCESS [ 28.486 s]
[INFO] Apache HBase - Procedure ........................... SUCCESS [ 59.235 s]
[INFO] Apache HBase - Server .............................. SUCCESS [ 03:07 h]
[INFO] Apache HBase - MapReduce ........................... SUCCESS [22:14 min]
[INFO] Apache HBase - Diagnostics Tools ................... SUCCESS [03:17 min]
[INFO] Apache HBase - Testing Util ........................ SUCCESS [01:19 min]
[INFO] Apache HBase - Thrift .............................. SUCCESS [06:07 min]
[INFO] Apache HBase - Shell ............................... SUCCESS [06:30 min]
[INFO] Apache HBase - Coprocessor Endpoint ................ SUCCESS [02:57 min]
[INFO] Apache HBase - Backup .............................. SUCCESS [14:18 min]
[INFO] Apache HBase - Integration Tests ................... SUCCESS [ 29.585 s]
[INFO] Apache HBase - Rest ................................ SUCCESS [03:06 min]
[INFO] Apache HBase - Examples ............................ SUCCESS [01:22 min]
[INFO] Apache HBase - Shaded .............................. SUCCESS [ 0.361 s]
[INFO] Apache HBase - Shaded - Client (with Hadoop bundled) SUCCESS [ 1.040 s]
[INFO] Apache HBase - Shaded - Client ..................... SUCCESS [ 1.116 s]
[INFO] Apache HBase - Shaded - MapReduce .................. SUCCESS [ 3.394 s]
[INFO] Apache HBase - Extensions .......................... SUCCESS [ 0.051 s]
[INFO] Apache HBase - OpenSSL support for TLS RPC ......... SUCCESS [ 0.136 s]
[INFO] Apache HBase - External Block Cache ................ SUCCESS [ 6.907 s]
[INFO] Apache HBase - HBTop ............................... SUCCESS [ 11.495 s]
[INFO] Apache HBase - Compression ......................... SUCCESS [ 0.156 s]
[INFO] Apache HBase - Compression - Aircompressor ......... SUCCESS [ 40.375 s]
[INFO] Apache HBase - Compression - Brotli ................ SUCCESS [ 33.545 s]
[INFO] Apache HBase - Compression - LZ4 ................... SUCCESS [ 22.442 s]
[INFO] Apache HBase - Compression - Snappy ................ SUCCESS [ 23.443 s]
[INFO] Apache HBase - Compression - ZStandard ............. SUCCESS [06:45 min]
[INFO] Apache HBase - Assembly ............................ SUCCESS [ 4.141 s]
[INFO] Apache HBase - Assembly without Hadoop and its transitive dependencies SUCCESS [ 4.176 s]
[INFO] Apache HBase - Shaded - Testing Util ............... SUCCESS [ 10.873 s]
[INFO] Apache HBase - Shaded - Testing Util Tester ........ SUCCESS [ 23.381 s]
[INFO] Apache HBase Shaded Packaging Invariants ........... SUCCESS [ 2.463 s]
[INFO] Apache HBase Shaded Packaging Invariants (with Hadoop bundled) SUCCESS [ 1.069 s]
[INFO] Apache HBase - Archetypes .......................... SUCCESS [ 0.227 s]
[INFO] Apache HBase - Exemplar for hbase-client archetype . SUCCESS [ 31.074 s]
[INFO] Apache HBase - Exemplar for hbase-shaded-client archetype SUCCESS [ 33.723 s]
[INFO] Apache HBase - Archetype builder ................... SUCCESS [ 0.415 s]
[INFO] Apache HBase - Generate Dev Classpath .............. SUCCESS [ 3.723 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 04:04 h (Wall Clock)
[INFO] Finished at: 2025-09-21T13:27:51-07:00
[INFO] ------------------------------------------------------------------------
...
real 244m43.832s
user 1368m30.870s
sys 171m3.674s

@haridsv
haridsv marked this pull request as ready for review September 22, 2025 05:13
@Apache-HBase

This comment has been minimized.

@haridsv

haridsv commented Sep 22, 2025

Copy link
Copy Markdown
ContributorAuthor

Looks like mvn surefire-report:report-only is broken, so I got a count of total tests run this way:

$ sed -En 's/.* Tests run: ([0-9]+).*/\1/p' /tmp/mvn-test.out | paste -s -d+ | bc
23678

The last green nightly build had 33,242 tests run, however, when I ran the above command on the test output file from the nightly build, I got a similar number (my branch must be having higher count because of new tests):

$ gsed -En 's/.* Tests run: ([0-9]+).*/\1/p' /tmp/patch-unit-root.txt | gpaste -s -d+ | bc
22793

The count is higher at the overall build level probably because of tests run in different profiles, such as hadoop3-backwards-3.3.5 etc.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

Copy link
Copy Markdown

💔 -1 overall

VoteSubsystemRuntimeLogfileComment
+0 🆗reexec0m 33sDocker mode activated.
-0 ⚠️yetus0m 4sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --author-ignore-list --blanks-eol-ignore-file --blanks-tabs-ignore-file --quick-hadoopcheck
_ Prechecks _
_ HBASE-29368-key-management-feature Compile Tests _
+0 🆗mvndep0m 29sMaven dependency ordering for branch
+1 💚mvninstall3m 26sHBASE-29368-key-management-feature passed
+1 💚compile2m 14sHBASE-29368-key-management-feature passed
+1 💚javadoc3m 21sHBASE-29368-key-management-feature passed
+1 💚shadedjars6m 20sbranch has no errors when building our shaded downstream artifacts.
-0 ⚠️patch7m 1sUsed diff version of patch file. Binary files and potentially other changes not applied. Please rebase and squash commits if necessary.
_ Patch Compile Tests _
+0 🆗mvndep0m 11sMaven dependency ordering for patch
+1 💚mvninstall3m 12sthe patch passed
+1 💚compile2m 14sthe patch passed
+1 💚javac2m 14sthe patch passed
-0 ⚠️javadoc0m 27s/results-javadoc-javadoc-hbase-server.txthbase-server generated 2 new + 63 unchanged - 0 fixed = 65 total (was 63)
-0 ⚠️javadoc1m 58s/results-javadoc-javadoc-root.txtroot generated 2 new + 210 unchanged - 0 fixed = 212 total (was 210)
+1 💚shadedjars6m 15spatch has no errors when building our shaded downstream artifacts.
_ Other Tests _
-1 ❌unit3m 20s/patch-unit-root.txtroot in the patch failed.
36m 38s
SubsystemReport/Notes
DockerClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7297/13/artifact/yetus-jdk17-hadoop3-check/output/Dockerfile
GITHUB PR#7297
JIRA IssueHBASE-29495
Optional Testsjavac javadoc unit compile shadedjars
unameLinux e3161587d2f7 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionHBASE-29368-key-management-feature / f52ca4f
Default JavaEclipse Adoptium-17.0.11+9
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7297/13/testReport/
Max. process+thread count317 (vs. ulimit of 30000)
modulesC: hbase-protocol-shaded hbase-common hbase-client hbase-server hbase-shell . U: .
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7297/13/console
versionsgit=2.34.1 maven=3.9.8
Powered byApache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

💔 -1 overall

VoteSubsystemRuntimeLogfileComment
+0 🆗reexec0m 30sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 1sNo case conflicting files found.
+0 🆗codespell0m 1scodespell was not available.
+0 🆗detsecrets0m 1sdetect-secrets was not available.
+0 🆗buf0m 0sbuf was not available.
+0 🆗buf0m 0sbuf was not available.
+1 💚@author0m 0sThe patch does not contain any @author tags.
+1 💚hbaseanti0m 0sPatch does not have any anti-patterns.
_ HBASE-29368-key-management-feature Compile Tests _
+0 🆗mvndep0m 31sMaven dependency ordering for branch
+1 💚mvninstall3m 31sHBASE-29368-key-management-feature passed
+1 💚compile8m 30sHBASE-29368-key-management-feature passed
+1 💚checkstyle1m 12sHBASE-29368-key-management-feature passed
-1 ❌spotbugs1m 35s/branch-spotbugs-hbase-server-warnings.htmlhbase-server in HBASE-29368-key-management-feature has 2 extant spotbugs warnings.
-1 ❌spotbugs7m 33s/branch-spotbugs-root-warnings.htmlroot in HBASE-29368-key-management-feature has 2 extant spotbugs warnings.
-1 ❌spotless0m 42sbranch has 43 errors when running spotless:check, run spotless:apply to fix.
-0 ⚠️patch1m 17sUsed diff version of patch file. Binary files and potentially other changes not applied. Please rebase and squash commits if necessary.
_ Patch Compile Tests _
+0 🆗mvndep0m 12sMaven dependency ordering for patch
+1 💚mvninstall3m 8sthe patch passed
+1 💚compile8m 26sthe patch passed
+1 💚cc8m 26sthe patch passed
-0 ⚠️javac8m 26s/results-compile-javac-root.txtroot generated 3 new + 1895 unchanged - 1 fixed = 1898 total (was 1896)
+1 💚blanks0m 0sThe patch has no blanks issues.
-0 ⚠️checkstyle1m 12s/results-checkstyle-root.txtroot: The patch generated 5 new + 31 unchanged - 0 fixed = 36 total (was 31)
-0 ⚠️rubocop0m 9s/results-rubocop.txtThe patch generated 13 new + 1 unchanged - 13 fixed = 14 total (was 14)
+1 💚xmllint0m 0sNo new issues.
+1 💚spotbugs13m 17sthe patch passed
+1 💚hadoopcheck12m 21sPatch does not cause any errors with Hadoop 3.3.6 3.4.0.
+1 💚hbaseprotoc4m 52sthe patch passed
+1 💚spotless0m 45spatch has no errors when running spotless:check.
_ Other Tests _
+1 💚asflicense0m 53sThe patch does not generate ASF License warnings.
81m 44s
SubsystemReport/Notes
DockerClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7297/13/artifact/yetus-general-check/output/Dockerfile
GITHUB PR#7297
JIRA IssueHBASE-29495
Optional Testsdupname asflicense codespell detsecrets spotless javac spotbugs checkstyle compile hadoopcheck hbaseanti cc buflint bufcompat hbaseprotoc xmllint rubocop
unameLinux 66e7ad1809ce 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionHBASE-29368-key-management-feature / f52ca4f
Default JavaEclipse Adoptium-17.0.11+9
spotlesshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7297/13/artifact/yetus-general-check/output/branch-spotless.txt
Max. process+thread count190 (vs. ulimit of 30000)
modulesC: hbase-protocol-shaded hbase-common hbase-client hbase-server hbase-shell . U: .
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7297/13/console
versionsgit=2.34.1 maven=3.9.8 spotbugs=4.7.3 rubocop=1.37.1 xmllint=20913
Powered byApache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@virajjasani
virajjasani merged commit 4d4d167 into apache:HBASE-29368-key-management-featureSep 24, 2025
1 check failed
Sign up for freeto 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.

3 participants

@haridsv@Apache-HBase@virajjasani