RANGER-5763: Fix NPE in HBase plugin snapshot hooks when table descriptor is null - #1184
Open
shmilygkd wants to merge 1 commit into
Open
RANGER-5763: Fix NPE in HBase plugin snapshot hooks when table descriptor is null#1184shmilygkd wants to merge 1 commit into
shmilygkd wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
HBase 2.6.3/2.6.4 call the preSnapshot coprocessor hook with a null TableDescriptor when the table does not exist: HBASE-29361 moved the snapshot hooks ahead of the table-existence check and passes the descriptor from getTableDescriptors().get() without a null check. RangerAuthorizationCoprocessor dereferences the descriptor in preSnapshot/preCloneSnapshot/preRestoreSnapshot, so taking a snapshot of a non-existent table throws an NPE inside the coprocessor, and with hbase.coprocessor.abortonerror defaulting to true the HMaster aborts.
HBase corrected the ordering in HBASE-29955 (2.6.5); this change makes the plugin tolerate a null descriptor: the permission check is skipped when the descriptor is null, and the operation is rejected by HBase itself.
How was this patch tested?
Unit tests added to RangerAuthorizationCoprocessorTest: the snapshot hooks skip the permission check when the table descriptor is null and run it when the descriptor is present. The failure mode was observed on a cluster running HBase 2.6.3 with the ranger hbase plugin.