Skip to content

HBASE-30222 Avoid re-parsing HBase configuration on every CipherProvider construction#8354

Open
haridsv wants to merge 1 commit into
apache:masterfrom
haridsv:HBASE-30222
Open

HBASE-30222 Avoid re-parsing HBase configuration on every CipherProvider construction#8354
haridsv wants to merge 1 commit into
apache:masterfrom
haridsv:HBASE-30222

Conversation

@haridsv

@haridsv haridsv commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

DefaultCipherProvider and CryptoCipherProvider initialized their conf field inline with HBaseConfiguration.create(), parsing hbase-default.xml and hbase-site.xml on every construction. The value was immediately discarded: Encryption.getCipherProvider() builds the provider via ReflectionUtils.newInstance(), which runs the no-arg constructor and then calls setConf(), overwriting the field. The eager parse was pure waste.

Drop the inline initializer so conf is set only via setConf(), and add a fail-fast Preconditions guard in getConf() so a caller that forgets setConf() fails loudly instead of NPE-ing deep inside cipher construction. Mark the test-only getInstance() accessor as LimitedPrivate(UNITTEST). Add guard tests covering both providers.

Generated-by: Claude Code (Opus 4.8)

…der construction

DefaultCipherProvider and CryptoCipherProvider initialized their conf field
inline with HBaseConfiguration.create(), parsing hbase-default.xml and
hbase-site.xml on every construction. The value was immediately discarded:
Encryption.getCipherProvider() builds the provider via
ReflectionUtils.newInstance(), which runs the no-arg constructor and then
calls setConf(), overwriting the field. The eager parse was pure waste.

Drop the inline initializer so conf is set only via setConf(), and add a
fail-fast Preconditions guard in getConf() so a caller that forgets setConf()
fails loudly instead of NPE-ing deep inside cipher construction. Mark the
test-only getInstance() accessor as LimitedPrivate(UNITTEST). Add guard tests
covering both providers.

Generated-by: Claude Code (Opus 4.8)
Sign up for free to 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.

1 participant