Skip to content
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

HDDS-11719. Remove dependency on server components from ozonefs-common #7438

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

adoroszlai
Copy link
Contributor

What changes were proposed in this pull request?

ozonefs-common depends on some server-side components with test scope, but doesn't actually use any of those. It shouldn't need them, since it's a client-side component.

OzoneFsShell requires commons-cli due to the parent class from Hadoop. It gets the dependency accidentally, because ozone fs uses the ozone-tools classpath, which has it:

fs)
OZONE_CLASSNAME=org.apache.hadoop.fs.ozone.OzoneFsShell
OZONE_FS_OPTS="${OZONE_FS_OPTS} ${RATIS_OPTS} ${OZONE_MODULE_ACCESS_ARGS}"
OZONE_RUN_ARTIFACT_NAME="ozone-tools"

Similarly, TestOzoneFsShell gets the dependency transitively via the server-side components. It started failing after removing the test-scoped dependencies:

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.153 s <<< FAILURE! - in org.apache.hadoop.fs.ozone.TestOzoneFsShell
org.apache.hadoop.fs.ozone.TestOzoneFsShell.testOzoneFsShellRegisterDeleteCmd  Time elapsed: 0.132 s  <<< ERROR!
java.lang.NullPointerException: Cannot invoke "org.apache.hadoop.fs.shell.CommandFactory.getNames()" because "factory" is null
	at org.apache.hadoop.fs.ozone.TestOzoneFsShell.testOzoneFsShellRegisterDeleteCmd(TestOzoneFsShell.java:59)

factory is initialized in FsShell.init() <- FsShell.run() <- ToolRunner.run() (which the test calls), but it fails due to classpath issue, and the test suppresses the exception, leaving factory as null.

Test is updated to let it fail with the original problem, if it happens.

Classpath issue is fixed by removing exclusion of commons-cli in client-side dependencies.

https://issues.apache.org/jira/browse/HDDS-11719

How was this patch tested?

CI:
https://github.com/adoroszlai/ozone/actions/runs/11859467136

@adoroszlai adoroszlai added the build Pull request that modifies the build process label Nov 15, 2024
@adoroszlai adoroszlai self-assigned this Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Pull request that modifies the build process
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant