ctubbsii commented on code in PR #5073:
URL: https://github.com/apache/accumulo/pull/5073#discussion_r1870010599


##########
server/base/src/main/java/org/apache/accumulo/server/conf/CheckAccumuloConfig.java:
##########
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.server.conf;
+
+import java.io.IOException;
+
+import org.apache.accumulo.core.conf.SiteConfiguration;
+import org.apache.accumulo.server.ServerDirs;
+import org.apache.accumulo.server.fs.VolumeManagerImpl;
+import org.apache.accumulo.start.spi.KeywordExecutable;
+import org.apache.hadoop.conf.Configuration;
+
+import com.google.auto.service.AutoService;
+
+@AutoService(KeywordExecutable.class)
+public class CheckAccumuloConfig implements KeywordExecutable {
+
+  public static void main(String[] args) {
+    var hadoopConfig = new Configuration();
+    var siteConfig = SiteConfiguration.auto();
+
+    try {
+      VolumeManagerImpl.get(siteConfig, hadoopConfig);
+    } catch (IOException e) {
+      throw new IllegalStateException(e);

Review Comment:
   It's better to just add IOException to the main method's "throws". Either 
way, the command is about to die. There's not much point modifying the stack 
trace that's about to be printed to the console. It's better to give them the 
actual stack trace rather than nest it in another layer before the process dies 
and the stack trace is printed.



##########
server/base/src/main/java/org/apache/accumulo/server/conf/CheckAccumuloConfig.java:
##########
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.server.conf;
+
+import java.io.IOException;
+
+import org.apache.accumulo.core.conf.SiteConfiguration;
+import org.apache.accumulo.server.ServerDirs;
+import org.apache.accumulo.server.fs.VolumeManagerImpl;
+import org.apache.accumulo.start.spi.KeywordExecutable;
+import org.apache.hadoop.conf.Configuration;
+
+import com.google.auto.service.AutoService;
+
+@AutoService(KeywordExecutable.class)
+public class CheckAccumuloConfig implements KeywordExecutable {
+
+  public static void main(String[] args) {
+    var hadoopConfig = new Configuration();
+    var siteConfig = SiteConfiguration.auto();
+
+    try {
+      VolumeManagerImpl.get(siteConfig, hadoopConfig);
+    } catch (IOException e) {
+      throw new IllegalStateException(e);
+    }
+    new ServerDirs(siteConfig, hadoopConfig);
+  }
+
+  @Override
+  public String keyword() {
+    return "check-accumulo-config";

Review Comment:
   It's not clear which config it is checking. This could be changed to:
   ```suggestion
       return "check-accumulo-properties";
   ```
   
   That way, it's a bit more clear that it's checking the `accumulo.properties` 
file.
   An option could be added to check a client properties file's validity also. 
That could influence the name of this utility, too.



##########
server/base/src/main/java/org/apache/accumulo/server/conf/CheckAccumuloConfig.java:
##########
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.server.conf;
+
+import java.io.IOException;
+
+import org.apache.accumulo.core.conf.SiteConfiguration;
+import org.apache.accumulo.server.ServerDirs;
+import org.apache.accumulo.server.fs.VolumeManagerImpl;
+import org.apache.accumulo.start.spi.KeywordExecutable;
+import org.apache.hadoop.conf.Configuration;
+
+import com.google.auto.service.AutoService;
+
+@AutoService(KeywordExecutable.class)
+public class CheckAccumuloConfig implements KeywordExecutable {
+
+  public static void main(String[] args) {
+    var hadoopConfig = new Configuration();
+    var siteConfig = SiteConfiguration.auto();

Review Comment:
   I still think you should avoid using `SiteConfiguration.auto()` here, and 
instead explicitly require a file path to be provided as an input argument. 
That way, there's no ambiguity when a user says "check this config file" which 
file is being checked. It's a lot less clear for the command to work like 
"check whatever config file you automatically detect in the environment"



##########
server/base/src/main/java/org/apache/accumulo/server/conf/CheckAccumuloConfig.java:
##########
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.server.conf;
+
+import java.io.IOException;
+
+import org.apache.accumulo.core.conf.SiteConfiguration;
+import org.apache.accumulo.server.ServerDirs;
+import org.apache.accumulo.server.fs.VolumeManagerImpl;
+import org.apache.accumulo.start.spi.KeywordExecutable;
+import org.apache.hadoop.conf.Configuration;
+
+import com.google.auto.service.AutoService;
+
+@AutoService(KeywordExecutable.class)
+public class CheckAccumuloConfig implements KeywordExecutable {
+
+  public static void main(String[] args) {
+    var hadoopConfig = new Configuration();
+    var siteConfig = SiteConfiguration.auto();
+
+    try {
+      VolumeManagerImpl.get(siteConfig, hadoopConfig);
+    } catch (IOException e) {
+      throw new IllegalStateException(e);
+    }
+    new ServerDirs(siteConfig, hadoopConfig);
+  }
+
+  @Override
+  public String keyword() {
+    return "check-accumulo-config";
+  }
+
+  @Override
+  public String description() {
+    return "Checks Accumulo configuration. This check can be used before an 
instance is created, "
+        + "so it performs a subset of the checks performed by "

Review Comment:
   With the change to require a file, the description could be updated to:
   
   ```suggestion
       return "Checks the provided Accumulo configuration file for errors. "
           + "This only checks the contents of the file and not any running 
Accumulo system, "
           + "so it can be used prior to init, but only performs a subset of 
the checks done by "
   ```



##########
server/base/src/main/java/org/apache/accumulo/server/conf/CheckAccumuloConfig.java:
##########
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.server.conf;
+
+import java.io.IOException;
+
+import org.apache.accumulo.core.conf.SiteConfiguration;
+import org.apache.accumulo.server.ServerDirs;
+import org.apache.accumulo.server.fs.VolumeManagerImpl;
+import org.apache.accumulo.start.spi.KeywordExecutable;
+import org.apache.hadoop.conf.Configuration;
+
+import com.google.auto.service.AutoService;
+
+@AutoService(KeywordExecutable.class)
+public class CheckAccumuloConfig implements KeywordExecutable {
+
+  public static void main(String[] args) {
+    var hadoopConfig = new Configuration();
+    var siteConfig = SiteConfiguration.auto();
+
+    try {
+      VolumeManagerImpl.get(siteConfig, hadoopConfig);
+    } catch (IOException e) {
+      throw new IllegalStateException(e);
+    }
+    new ServerDirs(siteConfig, hadoopConfig);
+  }
+
+  @Override
+  public String keyword() {
+    return "check-accumulo-config";

Review Comment:
   It's not clear which config it is checking. This could be changed to:
   ```suggestion
       return "check-accumulo-properties";
   ```
   
   That way, it's a bit more clear that it's checking the `accumulo.properties` 
file.
   An option could be added to check a client properties file's validity also. 
That could influence the name of this utility, too.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to