Skip to content

HBASE-28660 list_namespace not working after an incorrect user input (branch-2)#7971

Open
arvindKandpal-ksolves wants to merge 1 commit intoapache:branch-2from
arvindKandpal-ksolves:HBASE-28660-branch-2
Open

HBASE-28660 list_namespace not working after an incorrect user input (branch-2)#7971
arvindKandpal-ksolves wants to merge 1 commit intoapache:branch-2from
arvindKandpal-ksolves:HBASE-28660-branch-2

Conversation

@arvindKandpal-ksolves
Copy link
Copy Markdown
Contributor

Why are the changes needed?

This is a backport of the fix for HBASE-28660 to branch-2.
When a user enters an incorrect command like list_namespace, 'ns.*', the JRuby parser mistakenly creates a local variable initialized to nil before throwing a SyntaxError. Because Ruby prioritizes local variables over method calls, subsequent valid commands return empty/nil instead of executing the actual shell command.

How does this PR fix the problem?

  • Added the same cleanup mechanism inside hirb.rb's eval_input loop that was merged into the master branch.
  • Checks for collisions (shadowing) with registered HBase shell commands.
  • Warns the user via stderr and safely discards the polluted binding.
  • Includes the updated comprehensive test cases in general_test_cluster.rb covering all 5 affected commands (list, list_namespace, list_snapshots, scan, processlist).

Tests run

Ran the shell tests locally on branch-2 with the Hadoop 3 profile and verified that all tests pass without regressions.
mvn test -Dtest=TestShell -pl hbase-shell -Dhadoop.profile=3.0

@arvindKandpal-ksolves
Copy link
Copy Markdown
Contributor Author

I've updated this PR based on the feedback:

  • Cherry-picked the commit from master and amended the commit message to include the standard cherry-pick suffix.
  • Ran manual tests on a local standalone cluster using the sanity script. When testing the bad syntax (list_namespace, 'ns.*') and variable assignments (list = 10), the shell correctly printed the expected WARN messages and JRuby SyntaxError.
  • Most importantly, the shell didn't hang or break. All subsequent commands (create, put, scan, etc.) ran smoothly without corrupting the binding.
  • Automated shell tests (mvn test -Dtest=TestShell -pl hbase-shell -Dhadoop.profile=3.0) also passed locally.

This looks ready from my side. Let me know if it's good to merge! I'll start working on the branch-2.5 backport next.

cc @NihalJain @Apache9 @liuxiaocs7 @vaijosh

@NihalJain
Copy link
Copy Markdown
Contributor

Thank you @arvindKandpal-ksolves

@NihalJain NihalJain added the backport This PR is a back port of some issue or issues already committed to master label Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a back port of some issue or issues already committed to master

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants