-
Notifications
You must be signed in to change notification settings - Fork 446
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
Adds new accumulo command #5073
Conversation
Adds new `accumulo check-server-config-no-inst` command which performs the checks that `accumulo check-server-config` does without the checks that require a running Accumulo instance. Useful for (at least mostly) validating the `accumulo.properties` file without a running instance.
@kevinrr888 - wondering if we could just run the no-instance checks if the error is thrown when an instance doesn't exist so that we can re-use the command? Thoughts? |
I considered that, but thought it might hide some issues. For example, if a user expects that they have a running instance and run |
I was thinking a stern warning could printed to the screen that no instance is running so we are doing a reduced set of checks. I assume someone is going to run this interactively and not via a script. If we don't want to make that assumption, we could return a non-zero code. |
Yeah, I think a warning like that would be a way to replace the extra command. However, another thing I'm thinking of is it might be tricky to identify what a no-instance exception is. There is a certain exception that currently occurs, but that exception may change. |
We could just raise our own exception, NoInstanceException, for example. |
Deleted CheckServerConfigNoInstance and moved functionality to CheckServerConfig
I removed the new check and now check if an instance exists before the full set of checks runs in I wanted to avoid just surrounding the existing code:
with a *to the best of my knowledge |
One issue with this current impl is that the stack trace will still show an exception (this time a
The subset of the checks have still occurred and passed (noted in the output), but the exception unfortunately makes the info less visible and it might be better if the exception was not seen here. |
Regarding the exception being printed, that might be due to the logging configuration for the client (log4j2.properties). If that is set to direct output to a file, then you likely would not see that. For that reason, any output that we have from the command may want to use System.out or System.err |
Gotcha. Changed to print the warning. That logged error from my running of it was my only concern with this, but if it's fine to you then I have no problems with it. |
server/base/src/main/java/org/apache/accumulo/server/conf/CheckServerConfig.java
Outdated
Show resolved
Hide resolved
Checks the accumulo config at the given file path if one is provided. Otherwise, attempts to find and check the config file. Useful for checking the accumulo config without a running instance.
server/base/src/main/java/org/apache/accumulo/server/conf/CheckAccumuloConfig.java
Outdated
Show resolved
Hide resolved
Appears unnacceptable in our build constraints
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested alternate wording, up to you if you decide to take it or not. Otherwise, looks good.
server/base/src/main/java/org/apache/accumulo/server/conf/CheckAccumuloConfig.java
Outdated
Show resolved
Hide resolved
server/base/src/main/java/org/apache/accumulo/server/conf/CheckAccumuloConfig.java
Outdated
Show resolved
Hide resolved
server/base/src/main/java/org/apache/accumulo/server/conf/CheckAccumuloConfig.java
Outdated
Show resolved
Hide resolved
server/base/src/main/java/org/apache/accumulo/server/conf/CheckAccumuloConfig.java
Outdated
Show resolved
Hide resolved
server/base/src/main/java/org/apache/accumulo/server/conf/CheckAccumuloConfig.java
Outdated
Show resolved
Hide resolved
server/base/src/main/java/org/apache/accumulo/server/conf/CheckAccumuloConfig.java
Outdated
Show resolved
Hide resolved
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; | ||
|
||
@AutoService(KeywordExecutable.class) | ||
public class CheckAccumuloConfig implements KeywordExecutable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Give the new command name, I'd rename the file to CheckAccumuloProperties. After that, this should be fine to merge.
* Remove main method and move implementation to the execute method in the new CheckAccumuloProperties command * Add the new KeywordExecutable class to the IT
closes #5034
I did a deep dive into the code executed by
accumulo check-server-config
to figure out what is being checked to see if an instance can be avoided or what could be checked without an instance. Here is root code for reference:accumulo/server/base/src/main/java/org/apache/accumulo/server/conf/CheckServerConfig.java
Lines 30 to 34 in ed4161e
Here is a summary of my findings:
SiteConfiguration.auto()
does validation: checks that the deprecatedaccumulo-site.xml
file doesn't exist, loads properties from the config file (accumulo.properties
), checks that both deprecated and the replacement properties aren't both declared in the file, replaces deprecated properties with their non-deprecated versions, and returns a new SiteConfiguration object (the SiteConfiguration object constructor callsConfigCheckUtil.validate(config)
to validate the config passed in)context.getConfiguration()
does validation. However, as far as I can tell, the only validation done from this call requires an instance (the only validation seems to stem fromZooBasedConfiguration
/PropSnapshot
/PropStore
/PropStoreKey
/etc.). Validates at least theinstance.secret
property (maybe more). Since this is related to an instance, seems fine that it wouldn't be validated here anyways.new ServerContext(SiteConfiguration.auto())
(=new ServerContext(new ServerInfo(SiteConfiguration.auto()))
) does validation. This creates anew ServerInfo(siteConfig)
passing that to theServerContext
constructor. There is no validation done in theServerContext
constructor: most fields are memoized suppliers (the only one we access isServerConfigurationFactory serverConfFactory
which is accessed throughcontext.getConfiguration()
and we went into that code above). The ones that aren't memoized suppliers don't do any validation. But there is validation done from constructingServerInfo
. We will take what we can (does some form of validation and is not reliant on an instance) and use that in our new check.With this info, I wrote a new check
CheckServerConfigNoInstance
which, to the best of my knowledge, is all the validation that the currentCheckServerConfig
would be able to do without a running instance. So, this PR adds a newaccumulo check-server-config-no-inst
(in addition to the existingaccumulo check-server-config
) which performs the checks thataccumulo check-server-config
does without the checks that require a running Accumulo instance. Useful for (at least mostly) validating theaccumulo.properties
file without an instance.I'm not sure which branch this should target. Targeting 2.1 for now since the change could be made as early as 2.1 and it may be a desireable command here, but not sure if we would want to add a new command in the 2.1 line.
Any input/suggestions on this PR would be appreciated.