Skip to content

HBASE-26469 correct HBase shell exit behavior to match code passed to exit #4018

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

busbey
Copy link
Contributor

@busbey busbey commented Jan 8, 2022

For previous discussion see HBASE-26469 and the draft PR #3901

Based on those discussions, this patch

  • refactors how we handle running the passed in initialization script to make use of IRB sessions directly instead of reimplementing things ourselves
  • simplify how we initialize our IRB config
  • insert a shim for capturing exit codes passed via user calls to exit
  • make use of user provided exit code unless we're reading stdin in interactive mode

for comparison to previously provided summaries of return codes, this patch results in:

clean exit code error exit code
cli, default 0 1
cli, -n 0 1
stdin, default 0 0
stdin, -n 0 1

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 22s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
_ master Compile Tests _
+1 💚 mvninstall 5m 37s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 5m 19s the patch passed
-0 ⚠️ rubocop 0m 18s The patch generated 17 new + 48 unchanged - 15 fixed = 65 total (was 63)
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
_ Other Tests _
+1 💚 asflicense 0m 15s The patch does not generate ASF License warnings.
14m 19s
Subsystem Report/Notes
Docker ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-4018/1/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #4018
Optional Tests dupname asflicense javac rubocop
uname Linux c8792ab84118 4.15.0-163-generic #171-Ubuntu SMP Fri Nov 5 11:55:11 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / dda337f
Default Java AdoptOpenJDK-1.8.0_282-b08
rubocop https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-4018/1/artifact/yetus-general-check/output/diff-patch-rubocop.txt
Max. process+thread count 65 (vs. ulimit of 30000)
modules C: hbase-shell U: hbase-shell
Console output https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-4018/1/console
versions git=2.17.1 maven=3.6.3 rubocop=0.80.0
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 6m 12s Docker mode activated.
-0 ⚠️ yetus 0m 3s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚 mvninstall 4m 35s master passed
+1 💚 javadoc 0m 15s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 4m 20s the patch passed
+1 💚 javadoc 0m 13s the patch passed
_ Other Tests _
+1 💚 unit 6m 58s hbase-shell in the patch passed.
23m 30s
Subsystem Report/Notes
Docker ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-4018/1/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile
GITHUB PR #4018
Optional Tests javac javadoc unit
uname Linux aba0c971af34 4.15.0-163-generic #171-Ubuntu SMP Fri Nov 5 11:55:11 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / dda337f
Default Java AdoptOpenJDK-1.8.0_282-b08
Test Results https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-4018/1/testReport/
Max. process+thread count 1561 (vs. ulimit of 30000)
modules C: hbase-shell U: hbase-shell
Console output https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-4018/1/console
versions git=2.17.1 maven=3.6.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 21s Docker mode activated.
-0 ⚠️ yetus 0m 3s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚 mvninstall 6m 31s master passed
+1 💚 javadoc 0m 24s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 6m 6s the patch passed
+1 💚 javadoc 0m 15s the patch passed
_ Other Tests _
+1 💚 unit 8m 16s hbase-shell in the patch passed.
23m 57s
Subsystem Report/Notes
Docker ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-4018/1/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR #4018
Optional Tests javac javadoc unit
uname Linux faa392d25ddd 4.15.0-163-generic #171-Ubuntu SMP Fri Nov 5 11:55:11 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / dda337f
Default Java AdoptOpenJDK-11.0.10+9
Test Results https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-4018/1/testReport/
Max. process+thread count 1644 (vs. ulimit of 30000)
modules C: hbase-shell U: hbase-shell
Console output https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-4018/1/console
versions git=2.17.1 maven=3.6.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

Copy link
Contributor

@petersomogyi petersomogyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@busbey
Copy link
Contributor Author

busbey commented Jan 12, 2022

yeah most of them do, even if most are in relocated old code. I'll see which of them I can correct before merging. some of the IRB interactions might be v specific due to the quirks of that library.

busbey added a commit that referenced this pull request Jan 14, 2022
… exit (#4018)

* refactors how we handle running the passed in initialization script to make use of IRB sessions
  directly instead of reimplementing things ourselves
* simplify how we initialize our IRB config
* insert a shim for capturing exit codes passed via user calls to exit
* make use of user provided exit code unless we're reading stdin in interactive mode

This changes the exit code of the shell
* a 0 return code, or no return code, passed to a call to exit from stdin in non-interactive mode
  will now exit cleanly. in prior versions this would have exitted with an error and non-zero exit
  code.
* for other combinations of passing in an initilization script or reading from stdin with using the
  non-interactive flag, the exit code being 0 or non-0 should now line up with releases prior to
  2.4.z, which is a change in behavior compared to 2.4.z.

Signed-off-by: Peter Somogyi <psomogyi@apache.org>
busbey added a commit that referenced this pull request Jan 15, 2022
… exit (#4018)

* refactors how we handle running the passed in initialization script to make use of IRB sessions
  directly instead of reimplementing things ourselves
* simplify how we initialize our IRB config
* insert a shim for capturing exit codes passed via user calls to exit
* make use of user provided exit code unless we're reading stdin in interactive mode

This changes the exit code of the shell
* a 0 return code, or no return code, passed to a call to exit from stdin in non-interactive mode
  will now exit cleanly. in prior versions this would have exitted with an error and non-zero exit
  code.
* for other combinations of passing in an initilization script or reading from stdin with using the
  non-interactive flag, the exit code being 0 or non-0 should now line up with releases prior to
  2.4.z, which is a change in behavior compared to 2.4.z.

Signed-off-by: Peter Somogyi <psomogyi@apache.org>
(cherry picked from commit 821e6a3)
busbey added a commit that referenced this pull request Jan 15, 2022
… exit (#4018)

* refactors how we handle running the passed in initialization script to make use of IRB sessions
  directly instead of reimplementing things ourselves
* simplify how we initialize our IRB config
* insert a shim for capturing exit codes passed via user calls to exit
* make use of user provided exit code unless we're reading stdin in interactive mode

This changes the exit code of the shell
* a 0 return code, or no return code, passed to a call to exit from stdin in non-interactive mode
  will now exit cleanly. in prior versions this would have exitted with an error and non-zero exit
  code.
* for other combinations of passing in an initilization script or reading from stdin with using the
  non-interactive flag, the exit code being 0 or non-0 should now line up with releases prior to
  2.4.z, which is a change in behavior compared to 2.4.z.

Signed-off-by: Peter Somogyi <psomogyi@apache.org>
(cherry picked from commit 821e6a3)
busbey added a commit that referenced this pull request Jan 15, 2022
… exit (#4018)

* refactors how we handle running the passed in initialization script to make use of IRB sessions
  directly instead of reimplementing things ourselves
* simplify how we initialize our IRB config
* insert a shim for capturing exit codes passed via user calls to exit
* make use of user provided exit code unless we're reading stdin in interactive mode

This changes the exit code of the shell. Note that the below can be summarized as lining up with
behavior from earlier HBase releases. This behavior changes in future 2.5+ releases of HBase and
you should see the jira for more details.
* exit called in an initialization script will result in a non-zero exit code iff a non-zero code
  is passed to the exit call.
* when reading user input from stdin, a call to exit will result in a 0 exit code if the shell
  is interactive, and a non-zero exit code if the shell is non-interactive. any optional code
  passed to the call to exit won't change wether the exit code is zero or non-zero.

Signed-off-by: Peter Somogyi <psomogyi@apache.org>
(cherry picked from commit 821e6a3)
@busbey busbey closed this Jan 16, 2022
@busbey busbey deleted the HBASE-26469 branch January 16, 2022 21:52
vinayakphegde pushed a commit to vinayakphegde/hbase that referenced this pull request Apr 4, 2024
… exit (apache#4018)

* refactors how we handle running the passed in initialization script to make use of IRB sessions
  directly instead of reimplementing things ourselves
* simplify how we initialize our IRB config
* insert a shim for capturing exit codes passed via user calls to exit
* make use of user provided exit code unless we're reading stdin in interactive mode

This changes the exit code of the shell. Note that the below can be summarized as lining up with
behavior from earlier HBase releases. This behavior changes in future 2.5+ releases of HBase and
you should see the jira for more details.
* exit called in an initialization script will result in a non-zero exit code iff a non-zero code
  is passed to the exit call.
* when reading user input from stdin, a call to exit will result in a 0 exit code if the shell
  is interactive, and a non-zero exit code if the shell is non-interactive. any optional code
  passed to the call to exit won't change wether the exit code is zero or non-zero.

Signed-off-by: Peter Somogyi <psomogyi@apache.org>
(cherry picked from commit 821e6a3)
(cherry picked from commit 8b370f7)
Change-Id: Id2a201e3355ea70cac5ed4d9dc66042e7cd4ed55
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.

3 participants